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 
00004    This program is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this program; see the file COPYING.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #ifndef MYSQLMIGRATE_H
00021 #define MYSQLMIGRATE_H
00022 
00023 #include "migration/keximigrate.h"
00024 #include "kexidb/field.h"
00025 #include "kexidb/connection.h"
00026 #include "kexidb/drivers/mySQL/mysqlconnection_p.h"
00027 
00028 namespace KexiMigration
00029 {
00030 
00031     class MySQLMigrate : public KexiMigrate
00032     {
00033         Q_OBJECT
00034         KEXIMIGRATION_DRIVER
00035 
00036         private:
00037             MySqlConnectionInternal *d;
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 bool drv_copyTable(const QString& srcTable, 
00051                 KexiDB::Connection *destConn, KexiDB::TableSchema* dstTable);
00052 
00053             virtual bool drv_progressSupported() { return true; }
00054             virtual bool drv_getTableSize(const QString& table, Q_ULLONG& size);
00055 
00056 //TODO: move this somewhere to low level class (MIGRATION?)
00057 //          virtual bool drv_getTablesList( QStringList &list );
00058 //TODO: move this somewhere to low level class (MIGRATION?)
00059 //          virtual bool drv_containsTable( const QString &tableName );
00060 
00061         public:
00062 //          MySQLMigrate();
00063             MySQLMigrate(QObject *parent, const char *name, const QStringList& args = QStringList());
00064             ~MySQLMigrate();
00065             
00066             KexiDB::Field::Type type(const QString& table, const MYSQL_FIELD* t);
00067             
00068             KexiDB::Field::Type examineBlobField(const QString& table, 
00069                                                  const MYSQL_FIELD* fld);
00070             
00071             QStringList examineEnumField(const QString& table,
00072                                          const MYSQL_FIELD* fld);
00073             void getConstraints(int mysqlConstraints, KexiDB::Field* fld);
00074             void getOptions(int flags, KexiDB::Field* fld);
00075     };
00076 }
00077 
00078 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys