kexi
pqxxmigrate.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef PQXXIMPORT_H
00022 #define PQXXIMPORT_H
00023
00024 #include <migration/keximigrate.h>
00025
00026
00027 #include <kexidb/field.h>
00028 #include <kexidb/connection.h>
00029
00030 #include <pqxx/all.h>
00031
00032 namespace KexiMigration
00033 {
00034 class PqxxMigrate : public KexiMigrate
00035 {
00036 Q_OBJECT
00037 KEXIMIGRATION_DRIVER
00038
00039 public:
00040 PqxxMigrate(QObject *parent, const char *name, const QStringList &args = QStringList());
00041 virtual ~PqxxMigrate();
00042
00043 protected:
00044
00045 virtual bool drv_tableNames(QStringList& tablenames);
00046
00047
00048 virtual bool drv_readTableSchema(
00049 const QString& originalName, KexiDB::TableSchema& tableSchema);
00050
00051
00052 virtual bool drv_connect();
00053 virtual bool drv_disconnect();
00054
00055 virtual tristate drv_queryStringListFromSQL(
00056 const QString& sqlStatement, uint columnNumber, QStringList& stringList,
00057 int numRecords = -1);
00058
00066
00067 virtual tristate drv_fetchRecordFromSQL(const QString& sqlStatement,
00068 KexiDB::RowData& data, bool &firstRecord);
00069
00070 virtual bool drv_copyTable(const QString& srcTable,
00071 KexiDB::Connection *destConn, KexiDB::TableSchema* dstTable);
00072
00073 private:
00074
00075
00076 pqxx::connection* m_conn;
00077
00078
00079 pqxx::nontransaction* m_trans;
00080
00081
00082 pqxx::result* m_res;
00083
00085 pqxx::result::const_iterator m_fetchRecordFromSQL_iter;
00086
00087
00088 bool query(const QString& statement);
00089
00090
00091 void clearResultInfo ();
00092
00093 pqxx::oid tableOid(const QString& tablename);
00094
00095
00096 KexiDB::Field::Type type(int t, const QString& fname);
00097
00098
00099
00100 bool primaryKey(pqxx::oid table, int col) const;
00101
00102
00103 bool uniqueKey(pqxx::oid table, int col) const;
00104
00105
00106 bool foreignKey(pqxx::oid table, int col) const;
00107
00108
00109 bool notNull(pqxx::oid table, int col) const;
00110
00111
00112 bool notEmpty(pqxx::oid table, int col) const;
00113
00114
00115 bool autoInc(pqxx::oid table, int col) const;
00116
00117 };
00118 }
00119
00120 #endif
|