Drizzled Public API Documentation

drizzledump_mysql.h

00001 /* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
00002  *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
00003  *
00004  *  Copyright (C) 2010 Andrew Hutchings
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; version 2 of the License.
00009  *
00010  *  This program is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *  GNU General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU General Public License
00016  *  along with this program; if not, write to the Free Software
00017  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00018  */
00019 
00020 #ifndef CLIENT_DRIZZLEDUMP_MYSQL_H
00021 #define CLIENT_DRIZZLEDUMP_MYSQL_H
00022 
00023 #include "drizzledump_data.h"
00024 
00025 class DrizzleDumpDatabaseMySQL;
00026 class DrizzleDumpDataMySQL;
00027 
00028 class DrizzleDumpIndexMySQL : public DrizzleDumpIndex
00029 {
00030   public:
00031     DrizzleDumpIndexMySQL(std::string &index, DrizzleDumpConnection *connection)
00032     : DrizzleDumpIndex(index, connection)
00033     { }
00034 
00035     ~DrizzleDumpIndexMySQL()
00036     {
00037       columns.clear();
00038     }
00039 
00040 };
00041 
00042 class DrizzleDumpFieldMySQL : public DrizzleDumpField
00043 {
00044   public:
00045     DrizzleDumpFieldMySQL(std::string &field, DrizzleDumpConnection *connection)
00046     : DrizzleDumpField(field, connection)
00047     { }
00048 
00049     ~DrizzleDumpFieldMySQL() { }
00050 
00051     void dateTimeConvert(void);
00052     void setCollate(const char* newCollate);
00053     void setType(const char* raw_type, const char* collation);
00054 };
00055 
00056 class DrizzleDumpTableMySQL : public DrizzleDumpTable
00057 {
00058   public:
00059     DrizzleDumpTableMySQL(std::string &table, DrizzleDumpConnection *connection)
00060     : DrizzleDumpTable(table, connection)
00061     { }
00062 
00063     ~DrizzleDumpTableMySQL()
00064     {
00065       fields.clear();
00066       indexes.clear();
00067     }
00068 
00069     bool populateFields();
00070     bool populateIndexes();
00071     bool populateFkeys();
00072     void setEngine(const char* newEngine);
00073     void setCollate(const char* newCollate);
00074     DrizzleDumpData* getData(void);
00075 };
00076 
00077 class DrizzleDumpDatabaseMySQL : public DrizzleDumpDatabase
00078 {
00079   public:
00080     DrizzleDumpDatabaseMySQL(const std::string &database,
00081       DrizzleDumpConnection *connection)
00082     : DrizzleDumpDatabase(database, connection)
00083     { }
00084     ~DrizzleDumpDatabaseMySQL()
00085     {
00086       tables.clear();
00087     }
00088     bool populateTables(void);
00089     bool populateTables(const std::vector<std::string> &table_names);
00090     void setCollate(const char* newCollate);
00091 };
00092 
00093 class DrizzleDumpDataMySQL : public DrizzleDumpData
00094 {
00095   public:
00096     DrizzleDumpDataMySQL(DrizzleDumpTable *dataTable,
00097       DrizzleDumpConnection *connection);
00098     ~DrizzleDumpDataMySQL();
00099 
00100     /* For 0000-00-00 -> NULL conversion */
00101     std::string convertDate(const char* oldDate) const;
00102     /* For xx:xx:xx -> INT conversion */
00103     long convertTime(const char* oldTime) const;
00104     std::string checkDateTime(const char* item, uint32_t field) const;
00105 };
00106 
00107 #endif /* CLIENT_DRIZZLEDUMP_MYSQL_H */