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 #pragma once
00021 
00022 #include "drizzledump_data.h"
00023 
00024 class DrizzleDumpDatabaseMySQL;
00025 class DrizzleDumpDataMySQL;
00026 
00027 class DrizzleDumpIndexMySQL : public DrizzleDumpIndex
00028 {
00029   public:
00030     DrizzleDumpIndexMySQL(std::string &index, DrizzleDumpConnection *connection)
00031     : DrizzleDumpIndex(index, connection)
00032     { }
00033 
00034     ~DrizzleDumpIndexMySQL()
00035     {
00036       columns.clear();
00037     }
00038 
00039 };
00040 
00041 class DrizzleDumpFieldMySQL : public DrizzleDumpField
00042 {
00043   public:
00044     DrizzleDumpFieldMySQL(std::string &field, DrizzleDumpConnection *connection)
00045     : DrizzleDumpField(field, connection)
00046     { }
00047 
00048     ~DrizzleDumpFieldMySQL() { }
00049 
00050     void dateTimeConvert(void);
00051     void setCollate(const char* newCollate);
00052     void setType(const char* raw_type, const char* collation);
00053 };
00054 
00055 class DrizzleDumpTableMySQL : public DrizzleDumpTable
00056 {
00057   public:
00058     DrizzleDumpTableMySQL(std::string &table, DrizzleDumpConnection *connection)
00059     : DrizzleDumpTable(table, connection)
00060     { }
00061 
00062     ~DrizzleDumpTableMySQL()
00063     {
00064       fields.clear();
00065       indexes.clear();
00066     }
00067 
00068     bool populateFields();
00069     bool populateIndexes();
00070     bool populateFkeys();
00071     void setEngine(const char* newEngine);
00072     void setCollate(const char* newCollate);
00073     DrizzleDumpData* getData(void);
00074 };
00075 
00076 class DrizzleDumpDatabaseMySQL : public DrizzleDumpDatabase
00077 {
00078   public:
00079     DrizzleDumpDatabaseMySQL(const std::string &database,
00080       DrizzleDumpConnection *connection)
00081     : DrizzleDumpDatabase(database, connection)
00082     { }
00083     ~DrizzleDumpDatabaseMySQL()
00084     {
00085       tables.clear();
00086     }
00087     bool populateTables(void);
00088     bool populateTables(const std::vector<std::string> &table_names);
00089     void setCollate(const char* newCollate);
00090 };
00091 
00092 class DrizzleDumpDataMySQL : public DrizzleDumpData
00093 {
00094   public:
00095     DrizzleDumpDataMySQL(DrizzleDumpTable *dataTable,
00096       DrizzleDumpConnection *connection);
00097     ~DrizzleDumpDataMySQL();
00098 
00099     /* For 0000-00-00 -> NULL conversion */
00100     std::string convertDate(const char* oldDate) const;
00101     /* For xx:xx:xx -> INT conversion */
00102     long convertTime(const char* oldTime) const;
00103     std::string checkDateTime(const char* item, uint32_t field) const;
00104 };