diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
commit | f008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch) | |
tree | 8e9244c4d4957c36be81e15b566b4aa5ea26c982 /kexi/migration/pqxx | |
parent | 1210f27b660efb7b37ff43ec68763e85a403471f (diff) | |
download | koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.tar.gz koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.zip |
TQt4 port koffice
This should enable compilation under both Qt3 and Qt4; fixes for any missed components will be forthcoming
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238284 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kexi/migration/pqxx')
-rw-r--r-- | kexi/migration/pqxx/pg_type.h | 4 | ||||
-rw-r--r-- | kexi/migration/pqxx/pqxxmigrate.cpp | 66 | ||||
-rw-r--r-- | kexi/migration/pqxx/pqxxmigrate.h | 23 |
3 files changed, 47 insertions, 46 deletions
diff --git a/kexi/migration/pqxx/pg_type.h b/kexi/migration/pqxx/pg_type.h index e0ead91a..a8b94f0a 100644 --- a/kexi/migration/pqxx/pg_type.h +++ b/kexi/migration/pqxx/pg_type.h @@ -152,10 +152,10 @@ //XX:XX:XX:XX:XX:XX, MAC address #define MACADDROID 829 -//IP address/netmask, host address, netmask optional +//IP address/nettqmask, host address, nettqmask optional #define INETOID 869 -//network IP address/netmask, network address +//network IP address/nettqmask, network address #define CIDROID 650 //access control list diff --git a/kexi/migration/pqxx/pqxxmigrate.cpp b/kexi/migration/pqxx/pqxxmigrate.cpp index 15715897..c01d68fd 100644 --- a/kexi/migration/pqxx/pqxxmigrate.cpp +++ b/kexi/migration/pqxx/pqxxmigrate.cpp @@ -21,9 +21,9 @@ #include "pqxxmigrate.h" #include "pg_type.h" -#include <qstring.h> +#include <tqstring.h> #include <kdebug.h> -#include <qstringlist.h> +#include <tqstringlist.h> //I maybe should not use stl? #include <string> @@ -50,15 +50,15 @@ KEXIMIGRATE_DRIVER_INFO( PqxxMigrate, pqxx ) //================================================================================== //Constructor /*PqxxMigrate::PqxxMigrate() - : KexiMigrate(parent, name, args) + : KexiMigrate(tqparent, name, args) { m_res=0; m_trans=0; m_conn=0; }*/ -PqxxMigrate::PqxxMigrate(QObject *parent, const char *name, const QStringList &args) - : KexiMigrate(parent, name, args) +PqxxMigrate::PqxxMigrate(TQObject *tqparent, const char *name, const TQStringList &args) + : KexiMigrate(tqparent, name, args) { m_res=0; m_trans=0; @@ -78,7 +78,7 @@ PqxxMigrate::~PqxxMigrate() //any any other attributes required by kexi //helped by reading the 'tables' test program bool PqxxMigrate::drv_readTableSchema( - const QString& originalName, KexiDB::TableSchema& tableSchema) + const TQString& originalName, KexiDB::TableSchema& tableSchema) { // m_table = new KexiDB::TableSchema(table); @@ -91,9 +91,9 @@ bool PqxxMigrate::drv_readTableSchema( //Loop round the fields for (uint i = 0; i < (uint)m_res->columns(); i++) { - QString fldName(m_res->column_name(i)); + TQString fldName(m_res->column_name(i)); KexiDB::Field::Type fldType = type(m_res->column_type(i), fldName); - QString fldID( KexiUtils::string2Identifier(fldName) ); + TQString fldID( KexiUtils::string2Identifier(fldName) ); const pqxx::oid toid = tableOid(originalName); if (toid==0) return false; @@ -124,7 +124,7 @@ bool PqxxMigrate::drv_readTableSchema( //================================================================================== //get a list of tables and put into the supplied string list -bool PqxxMigrate::drv_tableNames(QStringList& tableNames) +bool PqxxMigrate::drv_tableNames(TQStringList& tableNames) { /* //pg_ = standard postgresql tables, pga_ = tables added by pgaccess, sql_ = probably information schemas, kexi__ = existing kexi tables @@ -135,7 +135,7 @@ bool PqxxMigrate::drv_tableNames(QStringList& tableNames) for (pqxx::result::const_iterator c = m_res->begin(); c != m_res->end(); ++c) { // Copy the result into the return list - tableNames << QString::fromLatin1 (c[0].c_str()); + tableNames << TQString::tqfromLatin1 (c[0].c_str()); } return true; } @@ -147,7 +147,7 @@ bool PqxxMigrate::drv_tableNames(QStringList& tableNames) //================================================================================== //Convert a postgresql type to a kexi type -KexiDB::Field::Type PqxxMigrate::type(int t, const QString& fname) +KexiDB::Field::Type PqxxMigrate::type(int t, const TQString& fname) { switch(t) { @@ -193,8 +193,8 @@ bool PqxxMigrate::drv_connect() { kdDebug() << "drv_connect: " << m_migrateData->sourceName << endl; - QString conninfo; - QString socket; + TQString conninfo; + TQString socket; //Setup local/remote connection if (m_migrateData->source->hostName.isEmpty()) @@ -217,15 +217,15 @@ bool PqxxMigrate::drv_connect() if (m_migrateData->source->port == 0) m_migrateData->source->port = 5432; - conninfo += QString::fromLatin1(" port='%1'").arg(m_migrateData->source->port); + conninfo += TQString::tqfromLatin1(" port='%1'").tqarg(m_migrateData->source->port); - conninfo += QString::fromLatin1(" dbname='%1'").arg(m_migrateData->sourceName); + conninfo += TQString::tqfromLatin1(" dbname='%1'").tqarg(m_migrateData->sourceName); if (!m_migrateData->source->userName.isNull()) - conninfo += QString::fromLatin1(" user='%1'").arg(m_migrateData->source->userName); + conninfo += TQString::tqfromLatin1(" user='%1'").tqarg(m_migrateData->source->userName); if (!m_migrateData->source->password.isNull()) - conninfo += QString::fromLatin1(" password='%1'").arg(m_migrateData->source->password); + conninfo += TQString::tqfromLatin1(" password='%1'").tqarg(m_migrateData->source->password); try { @@ -257,7 +257,7 @@ bool PqxxMigrate::drv_disconnect() } //================================================================================== //Perform a query on the database and store result in m_res -bool PqxxMigrate::query(const QString& statement) +bool PqxxMigrate::query(const TQString& statement) { kdDebug() << "query: " << statement.latin1() << endl; @@ -303,10 +303,10 @@ void PqxxMigrate::clearResultInfo() //========================================================================= //Return the OID for a table -pqxx::oid PqxxMigrate::tableOid(const QString& table) +pqxx::oid PqxxMigrate::tableOid(const TQString& table) { - QString statement; - static QString otable; + TQString statement; + static TQString otable; static pqxx::oid toid; pqxx::nontransaction* tran = 0; @@ -368,7 +368,7 @@ pqxx::oid PqxxMigrate::tableOid(const QString& table) //TODO: Add result caching for speed bool PqxxMigrate::primaryKey(pqxx::oid table_uid, int col) const { - QString statement; + TQString statement; bool pkey; int keyf; @@ -377,7 +377,7 @@ bool PqxxMigrate::primaryKey(pqxx::oid table_uid, int col) const try { - statement = QString("SELECT indkey FROM pg_index WHERE ((indisprimary = true) AND (indrelid = %1))").arg(table_uid); + statement = TQString("SELECT indkey FROM pg_index WHERE ((indisprimary = true) AND (indrelid = %1))").tqarg(table_uid); tran = new pqxx::nontransaction(*m_conn, "find_pkey"); tmpres = new pqxx::result(tran->exec(statement.latin1())); @@ -425,7 +425,7 @@ bool PqxxMigrate::primaryKey(pqxx::oid table_uid, int col) const On success the result is stored in \a string and true is returned. \return cancelled if there are no records available. */ tristate PqxxMigrate::drv_queryStringListFromSQL( - const QString& sqlStatement, uint columnNumber, QStringList& stringList, int numRecords) + const TQString& sqlStatement, uint columnNumber, TQStringList& stringList, int numRecords) { std::string result; int i = 0; @@ -436,7 +436,7 @@ tristate PqxxMigrate::drv_queryStringListFromSQL( { if (it.size() > 0 && it.size() > columnNumber) { it.at(columnNumber).to(result); - stringList.append( QString::fromUtf8(result.c_str()) ); + stringList.append( TQString::fromUtf8(result.c_str()) ); } else { clearResultInfo(); @@ -480,7 +480,7 @@ tristate PqxxMigrate::drv_queryStringListFromSQL( mysql_free_result(res); return false; } - string = QString::fromLatin1(row[columnNumber], lengths[columnNumber]); + string = TQString::tqfromLatin1(row[columnNumber], lengths[columnNumber]); mysql_free_result(res); } else { kdDebug() << "PqxxMigrate::drv_querySingleStringFromSQL(): null result" << endl; @@ -491,7 +491,7 @@ tristate PqxxMigrate::drv_queryStringListFromSQL( }*/ } -tristate PqxxMigrate::drv_fetchRecordFromSQL(const QString& sqlStatement, +tristate PqxxMigrate::drv_fetchRecordFromSQL(const TQString& sqlStatement, KexiDB::RowData& data, bool &firstRecord) { if (firstRecord || !m_res) { @@ -520,7 +520,7 @@ tristate PqxxMigrate::drv_fetchRecordFromSQL(const QString& sqlStatement, //========================================================================= /*! Copy PostgreSQL table to KexiDB database */ -bool PqxxMigrate::drv_copyTable(const QString& srcTable, KexiDB::Connection *destConn, +bool PqxxMigrate::drv_copyTable(const TQString& srcTable, KexiDB::Connection *destConn, KexiDB::TableSchema* dstTable) { std::vector<std::string> R; @@ -533,7 +533,7 @@ bool PqxxMigrate::drv_copyTable(const QString& srcTable, KexiDB::Connection *des const KexiDB::QueryColumnInfo::Vector fieldsExpanded( dstTable->query()->fieldsExpanded() ); for (int n=0; (stream >> R); ++n) { - QValueList<QVariant> vals; + TQValueList<TQVariant> vals; std::vector<std::string>::const_iterator i, end( R.end() ); int index = 0; for ( i = R.begin(); i != end; ++i, index++) { @@ -560,7 +560,7 @@ bool PqxxMigrate::drv_copyTable(const QString& srcTable, KexiDB::Connection *des //TODO: Add result caching for speed bool PqxxMigrate::uniqueKey(pqxx::oid table_uid, int col) const { - QString statement; + TQString statement; bool ukey; int keyf; @@ -569,7 +569,7 @@ bool PqxxMigrate::uniqueKey(pqxx::oid table_uid, int col) const try { - statement = QString("SELECT indkey FROM pg_index WHERE ((indisunique = true) AND (indrelid = %1))").arg(table_uid); + statement = TQString("SELECT indkey FROM pg_index WHERE ((indisunique = true) AND (indrelid = %1))").tqarg(table_uid); tran = new pqxx::nontransaction(*m_conn, "find_ukey"); tmpres = new pqxx::result(tran->exec(statement.latin1())); @@ -635,7 +635,7 @@ bool PqxxMigrate::notEmpty(pqxx::oid /*table_uid*/, int /*col*/) const //================================================================================== //Return a list of database names -/*bool PqxxMigrate::drv_getDatabasesList( QStringList &list ) +/*bool PqxxMigrate::drv_getDatabasesList( TQStringList &list ) { KexiDBDrvDbg << "pqxxSqlConnection::drv_getDatabaseList" << endl; @@ -647,7 +647,7 @@ bool PqxxMigrate::notEmpty(pqxx::oid /*table_uid*/, int /*col*/) const // Read value of column 0 into a string N c[0].to(N); // Copy the result into the return list - list << QString::fromLatin1 (N.c_str()); + list << TQString::tqfromLatin1 (N.c_str()); KexiDBDrvDbg << N.c_str() << endl; } return true; diff --git a/kexi/migration/pqxx/pqxxmigrate.h b/kexi/migration/pqxx/pqxxmigrate.h index c09c8a7a..ee33c138 100644 --- a/kexi/migration/pqxx/pqxxmigrate.h +++ b/kexi/migration/pqxx/pqxxmigrate.h @@ -18,8 +18,8 @@ * Boston, MA 02110-1301, USA. */ -#ifndef PQXXIMPORT_H -#define PQXXIMPORT_H +#ifndef PTQXXIMPORT_H +#define PTQXXIMPORT_H #include <migration/keximigrate.h> @@ -34,26 +34,27 @@ namespace KexiMigration class PqxxMigrate : public KexiMigrate { Q_OBJECT + TQ_OBJECT KEXIMIGRATION_DRIVER public: - PqxxMigrate(QObject *parent, const char *name, const QStringList &args = QStringList()); + PqxxMigrate(TQObject *tqparent, const char *name, const TQStringList &args = TQStringList()); virtual ~PqxxMigrate(); protected: //Driver specific function to return table names - virtual bool drv_tableNames(QStringList& tablenames); + virtual bool drv_tableNames(TQStringList& tablenames); //Driver specific implementation to read a table schema virtual bool drv_readTableSchema( - const QString& originalName, KexiDB::TableSchema& tableSchema); + const TQString& originalName, KexiDB::TableSchema& tableSchema); //Driver specific connection implementation virtual bool drv_connect(); virtual bool drv_disconnect(); virtual tristate drv_queryStringListFromSQL( - const QString& sqlStatement, uint columnNumber, QStringList& stringList, + const TQString& sqlStatement, uint columnNumber, TQStringList& stringList, int numRecords = -1); /*! Fetches single record from result obtained @@ -64,10 +65,10 @@ namespace KexiMigration On success the result is stored in \a data and true is returned, \a data is resized to appropriate size. cancelled is returned on EOF. */ //! @todo SQL-dependent! - virtual tristate drv_fetchRecordFromSQL(const QString& sqlStatement, + virtual tristate drv_fetchRecordFromSQL(const TQString& sqlStatement, KexiDB::RowData& data, bool &firstRecord); - virtual bool drv_copyTable(const QString& srcTable, + virtual bool drv_copyTable(const TQString& srcTable, KexiDB::Connection *destConn, KexiDB::TableSchema* dstTable); private: @@ -85,15 +86,15 @@ namespace KexiMigration pqxx::result::const_iterator m_fetchRecordFromSQL_iter; //perform a query on the database - bool query(const QString& statement); + bool query(const TQString& statement); //Clear the result info void clearResultInfo (); - pqxx::oid tableOid(const QString& tablename); + pqxx::oid tableOid(const TQString& tablename); //Convert the pqxx type to a kexi type - KexiDB::Field::Type type(int t, const QString& fname); + KexiDB::Field::Type type(int t, const TQString& fname); //Find out the field constraints //Return whether or not the field is a pkey |