kexi
pqxxmigrate.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef PQXXIMPORT_H
00021 #define PQXXIMPORT_H
00022
00023 #include <migration/keximigrate.h>
00024
00025
00026 #include <kexidb/field.h>
00027 #include <kexidb/connection.h>
00028
00029 #include <pqxx/all.h>
00030
00031 namespace KexiMigration
00032 {
00033 class PqxxMigrate : public KexiMigrate
00034 {
00035 Q_OBJECT
00036 KEXIMIGRATION_DRIVER
00037
00038 public:
00039
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 bool drv_copyTable(const QString& srcTable,
00056 KexiDB::Connection *destConn, KexiDB::TableSchema* dstTable);
00057
00058
00059
00060
00061
00062 private:
00063
00064
00065 pqxx::connection* m_conn;
00066
00067 pqxx::nontransaction* m_trans;
00068
00069 pqxx::result* m_res;
00070
00071 bool query(const QString& statement);
00072
00073 void clearResultInfo ();
00074
00075 pqxx::oid tableOid(const QString& tablename);
00076
00077
00078 KexiDB::Field::Type type(int t, const QString& fname);
00079
00080
00081
00082 bool primaryKey(pqxx::oid table, int col) const;
00083
00084
00085 bool uniqueKey(pqxx::oid table, int col) const;
00086
00087
00088 bool foreignKey(pqxx::oid table, int col) const;
00089
00090
00091 bool notNull(pqxx::oid table, int col) const;
00092
00093
00094 bool notEmpty(pqxx::oid table, int col) const;
00095
00096
00097 bool autoInc(pqxx::oid table, int col) const;
00098
00099 };
00100 }
00101
00102 #endif
|