kexi

mysqlmigrate.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2004 Martin Ellis <m.a.ellis@ncl.ac.uk>
00003    Copyright (C) 2006 Jaroslaw Staniek <js@iidea.pl>
00004 
00005    This program is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
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 GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this program; see the file COPYING.  If not, write to
00017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  * Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #ifndef MYSQLMIGRATE_H
00022 #define MYSQLMIGRATE_H
00023 
00024 #include "migration/keximigrate.h"
00025 #include "kexidb/drivers/mySQL/mysqlconnection_p.h"
00026 
00027 namespace KexiMigration
00028 {
00029 
00030     class MySQLMigrate : public KexiMigrate
00031     {
00032         Q_OBJECT
00033         KEXIMIGRATION_DRIVER
00034 
00035         private:
00036             MySqlConnectionInternal *d;
00037             MYSQL_RES *m_mysqlres;
00038 
00039         protected:
00040             //Driver specific function to return table names
00041             virtual bool drv_tableNames(QStringList& tablenames);
00042             
00043             //Driver specific implementation to read a table schema
00044             virtual bool drv_readTableSchema(
00045                 const QString& originalName, KexiDB::TableSchema& tableSchema);
00046             //Driver specific connection implementation
00047             virtual bool drv_connect();
00048             virtual bool drv_disconnect();
00049 
00050             virtual tristate drv_queryStringListFromSQL(
00051                 const QString& sqlStatement, uint columnNumber, 
00052                 QStringList& stringList, int numRecords = -1);
00053 
00054             virtual tristate drv_fetchRecordFromSQL(const QString& sqlStatement, 
00055                 KexiDB::RowData& data, bool &firstRecord);
00056 
00057             virtual bool drv_copyTable(const QString& srcTable, 
00058                 KexiDB::Connection *destConn, KexiDB::TableSchema* dstTable);
00059 
00060             virtual bool drv_progressSupported() { return true; }
00061             virtual bool drv_getTableSize(const QString& table, Q_ULLONG& size);
00062 
00063 //TODO: move this somewhere to low level class (MIGRATION?)
00064 //          virtual bool drv_getTablesList( QStringList &list );
00065 //TODO: move this somewhere to low level class (MIGRATION?)
00066 //          virtual bool drv_containsTable( const QString &tableName );
00067 
00068         public:
00069 //          MySQLMigrate();
00070             MySQLMigrate(QObject *parent, const char *name, const QStringList& args = QStringList());
00071             ~MySQLMigrate();
00072             
00073             KexiDB::Field::Type type(const QString& table, const MYSQL_FIELD* t);
00074             
00075             KexiDB::Field::Type examineBlobField(const QString& table, 
00076                                                  const MYSQL_FIELD* fld);
00077             
00078             QStringList examineEnumField(const QString& table,
00079                                          const MYSQL_FIELD* fld);
00080             void getConstraints(int mysqlConstraints, KexiDB::Field* fld);
00081             void getOptions(int flags, KexiDB::Field* fld);
00082     };
00083 }
00084 
00085 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys