kexi

mysqlmigrate.h
1/* This file is part of the KDE project
2 Copyright (C) 2004 Martin Ellis <m.a.ellis@ncl.ac.uk>
3 Copyright (C) 2006 Jaroslaw Staniek <js@iidea.pl>
4
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this program; see the file COPYING. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19*/
20
21#ifndef MYSQLMIGRATE_H
22#define MYSQLMIGRATE_H
23
24#include "migration/keximigrate.h"
25#include "kexidb/drivers/mySQL/mysqlconnection_p.h"
26
27namespace KexiMigration
28{
29
30 class MySQLMigrate : public KexiMigrate
31 {
32 TQ_OBJECT
33
34 KEXIMIGRATION_DRIVER
35
36 private:
37 MySqlConnectionInternal *d;
38 MYSQL_RES *m_mysqlres;
39
40 protected:
41 //Driver specific function to return table names
42 virtual bool drv_tableNames(TQStringList& tablenames);
43
44 //Driver specific implementation to read a table schema
45 virtual bool drv_readTableSchema(
46 const TQString& originalName, KexiDB::TableSchema& tableSchema);
47 //Driver specific connection implementation
48 virtual bool drv_connect();
49 virtual bool drv_disconnect();
50
51 virtual tristate drv_queryStringListFromSQL(
52 const TQString& sqlStatement, uint columnNumber,
53 TQStringList& stringList, int numRecords = -1);
54
55 virtual tristate drv_fetchRecordFromSQL(const TQString& sqlStatement,
56 KexiDB::RowData& data, bool &firstRecord);
57
58 virtual bool drv_copyTable(const TQString& srcTable,
59 KexiDB::Connection *destConn, KexiDB::TableSchema* dstTable);
60
61 virtual bool drv_progressSupported() { return true; }
62 virtual bool drv_getTableSize(const TQString& table, TQ_ULLONG& size);
63
64//TODO: move this somewhere to low level class (MIGRATION?)
65// virtual bool drv_getTablesList( TQStringList &list );
66//TODO: move this somewhere to low level class (MIGRATION?)
67// virtual bool drv_containsTable( const TQString &tableName );
68
69 public:
70// MySQLMigrate();
71 MySQLMigrate(TQObject *parent, const char *name, const TQStringList& args = TQStringList());
72 ~MySQLMigrate();
73
74 KexiDB::Field::Type type(const TQString& table, const MYSQL_FIELD* t);
75
76 KexiDB::Field::Type examineBlobField(const TQString& table,
77 const MYSQL_FIELD* fld);
78
79 TQStringList examineEnumField(const TQString& table,
80 const MYSQL_FIELD* fld);
81 void getConstraints(int mysqlConstraints, KexiDB::Field* fld);
82 void getOptions(int flags, KexiDB::Field* fld);
83 };
84}
85
86#endif
Imports non-native databases into Kexi projects.
Definition keximigrate.h:79
virtual bool drv_connect()=0
Connect to source database (driver specific).
KexiMigration::Data * data() const
Definition keximigrate.h:87
virtual bool drv_disconnect()=0
Disconnect from source database (driver specific).
TQValueVector< TQVariant > RowData
structure for storing single record with type information
Definition connection.h:47
Framework for importing databases into native KexiDB databases.