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/kexidb/drivers/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/kexidb/drivers/pqxx')
-rw-r--r-- | kexi/kexidb/drivers/pqxx/pqxxconnection.cpp | 66 | ||||
-rw-r--r-- | kexi/kexidb/drivers/pqxx/pqxxconnection.h | 31 | ||||
-rw-r--r-- | kexi/kexidb/drivers/pqxx/pqxxconnection_p.h | 6 | ||||
-rw-r--r-- | kexi/kexidb/drivers/pqxx/pqxxcursor.cpp | 32 | ||||
-rw-r--r-- | kexi/kexidb/drivers/pqxx/pqxxcursor.h | 32 | ||||
-rw-r--r-- | kexi/kexidb/drivers/pqxx/pqxxdriver.cpp | 44 | ||||
-rw-r--r-- | kexi/kexidb/drivers/pqxx/pqxxdriver.h | 29 | ||||
-rw-r--r-- | kexi/kexidb/drivers/pqxx/pqxxpreparedstatement.h | 4 |
8 files changed, 123 insertions, 121 deletions
diff --git a/kexi/kexidb/drivers/pqxx/pqxxconnection.cpp b/kexi/kexidb/drivers/pqxx/pqxxconnection.cpp index 8465bcf4..c81f04ad 100644 --- a/kexi/kexidb/drivers/pqxx/pqxxconnection.cpp +++ b/kexi/kexidb/drivers/pqxx/pqxxconnection.cpp @@ -18,8 +18,8 @@ */ #include "pqxxconnection.h" -#include <qvariant.h> -#include <qfile.h> +#include <tqvariant.h> +#include <tqfile.h> #include <kdebug.h> #include <kexidb/error.h> #include <kexidb/global.h> @@ -70,7 +70,7 @@ pqxxSqlConnection::~pqxxSqlConnection() //================================================================================== //Return a new query based on a query statment -Cursor* pqxxSqlConnection::prepareQuery( const QString& statement, uint cursor_options) +Cursor* pqxxSqlConnection::prepareQuery( const TQString& statement, uint cursor_options) { Q_UNUSED(cursor_options); return new pqxxSqlCursor(this, statement, 1); //Always used buffered cursor @@ -86,9 +86,9 @@ Cursor* pqxxSqlConnection::prepareQuery( QuerySchema& query, uint cursor_options //================================================================================== //Properly escaped a database object name -QString pqxxSqlConnection::escapeName(const QString &name) const +TQString pqxxSqlConnection::escapeName(const TQString &name) const { - return QString("\"" + name + "\""); + return TQString("\"" + name + "\""); } //================================================================================== @@ -116,7 +116,7 @@ bool pqxxSqlConnection::drv_disconnect() //================================================================================== //Return a list of database names -bool pqxxSqlConnection::drv_getDatabasesList( QStringList &list ) +bool pqxxSqlConnection::drv_getDatabasesList( TQStringList &list ) { // KexiDBDrvDbg << "pqxxSqlConnection::drv_getDatabaseList" << endl; @@ -128,7 +128,7 @@ bool pqxxSqlConnection::drv_getDatabasesList( QStringList &list ) // 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()); } return true; } @@ -138,7 +138,7 @@ bool pqxxSqlConnection::drv_getDatabasesList( QStringList &list ) //================================================================================== //Create a new database -bool pqxxSqlConnection::drv_createDatabase( const QString &dbName ) +bool pqxxSqlConnection::drv_createDatabase( const TQString &dbName ) { KexiDBDrvDbg << "pqxxSqlConnection::drv_createDatabase: " << dbName << endl; @@ -150,16 +150,16 @@ bool pqxxSqlConnection::drv_createDatabase( const QString &dbName ) //================================================================================== //Use this as our connection instead of connect -bool pqxxSqlConnection::drv_useDatabase( const QString &dbName, bool *cancelled, +bool pqxxSqlConnection::drv_useDatabase( const TQString &dbName, bool *cancelled, MessageHandler* msgHandler ) { Q_UNUSED(cancelled); Q_UNUSED(msgHandler); KexiDBDrvDbg << "pqxxSqlConnection::drv_useDatabase: " << dbName << endl; - QString conninfo; - QString socket; - QStringList sockets; + TQString conninfo; + TQString socket; + TQStringList sockets; if (data()->hostName.isEmpty() || data()->hostName == "localhost") { @@ -167,9 +167,9 @@ bool pqxxSqlConnection::drv_useDatabase( const QString &dbName, bool *cancelled, { sockets.append("/tmp/.s.PGSQL.5432"); - for(QStringList::ConstIterator it = sockets.constBegin(); it != sockets.constEnd(); it++) + for(TQStringList::ConstIterator it = sockets.constBegin(); it != sockets.constEnd(); it++) { - if(QFile(*it).exists()) + if(TQFile(*it).exists()) { socket = (*it); break; @@ -190,15 +190,15 @@ bool pqxxSqlConnection::drv_useDatabase( const QString &dbName, bool *cancelled, if (data()->port == 0) data()->port = 5432; - conninfo += QString::fromLatin1(" port='%1'").arg(data()->port); + conninfo += TQString::tqfromLatin1(" port='%1'").tqarg(data()->port); - conninfo += QString::fromLatin1(" dbname='%1'").arg(dbName); + conninfo += TQString::tqfromLatin1(" dbname='%1'").tqarg(dbName); if (!data()->userName.isNull()) - conninfo += QString::fromLatin1(" user='%1'").arg(data()->userName); + conninfo += TQString::tqfromLatin1(" user='%1'").tqarg(data()->userName); if (!data()->password.isNull()) - conninfo += QString::fromLatin1(" password='%1'").arg(data()->password); + conninfo += TQString::tqfromLatin1(" password='%1'").tqarg(data()->password); try { @@ -213,7 +213,7 @@ bool pqxxSqlConnection::drv_useDatabase( const QString &dbName, bool *cancelled, catch(const std::exception &e) { KexiDBDrvDbg << "pqxxSqlConnection::drv_useDatabase:exception - " << e.what() << endl; - d->errmsg = QString::fromUtf8( e.what() ); + d->errmsg = TQString::fromUtf8( e.what() ); } catch(...) @@ -244,7 +244,7 @@ bool pqxxSqlConnection::drv_closeDatabase() //================================================================================== //Drops the given database -bool pqxxSqlConnection::drv_dropDatabase( const QString &dbName ) +bool pqxxSqlConnection::drv_dropDatabase( const TQString &dbName ) { KexiDBDrvDbg << "pqxxSqlConnection::drv_dropDatabase: " << dbName << endl; @@ -257,7 +257,7 @@ bool pqxxSqlConnection::drv_dropDatabase( const QString &dbName ) //================================================================================== //Execute an SQL statement -bool pqxxSqlConnection::drv_executeSQL( const QString& statement ) +bool pqxxSqlConnection::drv_executeSQL( const TQString& statement ) { // KexiDBDrvDbg << "pqxxSqlConnection::drv_executeSQL: " << statement << endl; bool ok = false; @@ -299,7 +299,7 @@ bool pqxxSqlConnection::drv_executeSQL( const QString& statement ) catch (const std::exception &e) { //If an error ocurred then put the error description into _dbError - d->errmsg = QString::fromUtf8( e.what() ); + d->errmsg = TQString::fromUtf8( e.what() ); KexiDBDrvDbg << "pqxxSqlConnection::drv_executeSQL:exception - " << e.what() << endl; } catch(...) @@ -323,7 +323,7 @@ bool pqxxSqlConnection::drv_isDatabaseUsed() const //================================================================================== //Return the oid of the last insert - only works if sql was insert of 1 row -Q_ULLONG pqxxSqlConnection::drv_lastInsertRowID() +TQ_ULLONG pqxxSqlConnection::drv_lastInsertRowID() { if (d->res) { @@ -331,7 +331,7 @@ Q_ULLONG pqxxSqlConnection::drv_lastInsertRowID() if (theOid != pqxx::oid_none) { - return (Q_ULLONG)theOid; + return (TQ_ULLONG)theOid; } else { @@ -342,14 +342,14 @@ Q_ULLONG pqxxSqlConnection::drv_lastInsertRowID() } //<queries taken from pqxxMigrate> -bool pqxxSqlConnection::drv_containsTable( const QString &tableName ) +bool pqxxSqlConnection::drv_containsTable( const TQString &tableName ) { bool success; - return resultExists(QString("select 1 from pg_class where relkind='r' and relname LIKE %1") - .arg(driver()->escapeString(tableName)), success) && success; + return resultExists(TQString("select 1 from pg_class where relkind='r' and relname LIKE %1") + .tqarg(driver()->escapeString(tableName)), success) && success; } -bool pqxxSqlConnection::drv_getTablesList( QStringList &list ) +bool pqxxSqlConnection::drv_getTablesList( TQStringList &list ) { KexiDB::Cursor *cursor; m_sql = "select lower(relname) from pg_class where relkind='r'"; @@ -385,7 +385,7 @@ bool pqxxSqlConnection::drv_commitTransaction(TransactionData *tdata) catch (const std::exception &e) { //If an error ocurred then put the error description into _dbError - d->errmsg = QString::fromUtf8( e.what() ); + d->errmsg = TQString::fromUtf8( e.what() ); result = false; } catch (...) { @@ -407,7 +407,7 @@ bool pqxxSqlConnection::drv_rollbackTransaction(TransactionData *tdata) catch (const std::exception &e) { //If an error ocurred then put the error description into _dbError - d->errmsg = QString::fromUtf8( e.what() ); + d->errmsg = TQString::fromUtf8( e.what() ); result = false; } @@ -425,9 +425,9 @@ int pqxxSqlConnection::serverResult() return d->resultCode; } -QString pqxxSqlConnection::serverResultName() +TQString pqxxSqlConnection::serverResultName() { - return QString::null; + return TQString(); } void pqxxSqlConnection::drv_clearServerResult() @@ -435,7 +435,7 @@ void pqxxSqlConnection::drv_clearServerResult() d->resultCode = 0; } -QString pqxxSqlConnection::serverErrorMsg() +TQString pqxxSqlConnection::serverErrorMsg() { return d->errmsg; } diff --git a/kexi/kexidb/drivers/pqxx/pqxxconnection.h b/kexi/kexidb/drivers/pqxx/pqxxconnection.h index 85bed42a..7e7cdf69 100644 --- a/kexi/kexidb/drivers/pqxx/pqxxconnection.h +++ b/kexi/kexidb/drivers/pqxx/pqxxconnection.h @@ -17,10 +17,10 @@ * Boston, MA 02110-1301, USA. */ -#ifndef PQXXCONNECTION_H -#define PQXXCONNECTION_H +#ifndef PTQXXCONNECTION_H +#define PTQXXCONNECTION_H -#include <qstringlist.h> +#include <tqstringlist.h> #include <kexidb/connection.h> #include "pqxxcursor.h" @@ -48,11 +48,12 @@ class pqxxTransactionData : public TransactionData class pqxxSqlConnection : public Connection { Q_OBJECT + TQ_OBJECT public: virtual ~pqxxSqlConnection(); - virtual Cursor* prepareQuery( const QString& statement = QString::null, uint cursor_options = 0 ); + virtual Cursor* prepareQuery( const TQString& statement = TQString(), uint cursor_options = 0 ); virtual Cursor* prepareQuery( QuerySchema& query, uint cursor_options = 0 ); virtual PreparedStatement::Ptr prepareStatement(PreparedStatement::StatementType type, FieldList& fields); @@ -63,19 +64,19 @@ class pqxxSqlConnection : public Connection virtual bool drv_isDatabaseUsed() const; virtual bool drv_connect(KexiDB::ServerVersionInfo& version); virtual bool drv_disconnect(); - virtual bool drv_getDatabasesList( QStringList &list ); - virtual bool drv_createDatabase( const QString &dbName = QString::null ); - virtual bool drv_useDatabase( const QString &dbName = QString::null, bool *cancelled = 0, + virtual bool drv_getDatabasesList( TQStringList &list ); + virtual bool drv_createDatabase( const TQString &dbName = TQString() ); + virtual bool drv_useDatabase( const TQString &dbName = TQString(), bool *cancelled = 0, MessageHandler* msgHandler = 0 ); virtual bool drv_closeDatabase(); - virtual bool drv_dropDatabase( const QString &dbName = QString::null ); - virtual bool drv_executeSQL( const QString& statement ); - virtual Q_ULLONG drv_lastInsertRowID(); + virtual bool drv_dropDatabase( const TQString &dbName = TQString() ); + virtual bool drv_executeSQL( const TQString& statement ); + virtual TQ_ULLONG drv_lastInsertRowID(); //TODO: move this somewhere to low level class (MIGRATION?) - virtual bool drv_getTablesList( QStringList &list ); + virtual bool drv_getTablesList( TQStringList &list ); //TODO: move this somewhere to low level class (MIGRATION?) - virtual bool drv_containsTable( const QString &tableName ); + virtual bool drv_containsTable( const TQString &tableName ); virtual TransactionData* drv_beginTransaction(); virtual bool drv_commitTransaction(TransactionData *); @@ -83,13 +84,13 @@ class pqxxSqlConnection : public Connection //Error reporting virtual int serverResult(); - virtual QString serverResultName(); + virtual TQString serverResultName(); virtual void drv_clearServerResult(); - virtual QString serverErrorMsg(); + virtual TQString serverErrorMsg(); pqxxSqlConnectionInternal *d; private: - QString escapeName(const QString &tn) const; + TQString escapeName(const TQString &tn) const; // pqxx::transaction_base* m_trans; //! temporary solution for executeSQL()... pqxxTransactionData *m_trans; diff --git a/kexi/kexidb/drivers/pqxx/pqxxconnection_p.h b/kexi/kexidb/drivers/pqxx/pqxxconnection_p.h index 0c78e583..2d33e410 100644 --- a/kexi/kexidb/drivers/pqxx/pqxxconnection_p.h +++ b/kexi/kexidb/drivers/pqxx/pqxxconnection_p.h @@ -27,8 +27,8 @@ // Copyright: See COPYING file that comes with this distribution // // -#ifndef PQXXSQLCONNECTIONINTERNAL_H -#define PQXXSQLCONNECTIONINTERNAL_H +#ifndef PTQXXSQLCONNECTIONINTERNAL_H +#define PTQXXSQLCONNECTIONINTERNAL_H #include <kexidb/connection_p.h> #include <pqxx/pqxx> @@ -56,7 +56,7 @@ class pqxxSqlConnectionInternal : public ConnectionInternal KexiDB::ServerVersionInfo *version; //!< this is set in drv_connect(), so we can use it in drv_useDatabase() //!< because pgsql really connects after "USE". - QString errmsg; //!< server-specific message of last operation + TQString errmsg; //!< server-specific message of last operation int resultCode; //!< result code of last operation on server }; } diff --git a/kexi/kexidb/drivers/pqxx/pqxxcursor.cpp b/kexi/kexidb/drivers/pqxx/pqxxcursor.cpp index 0004cf92..afcad047 100644 --- a/kexi/kexidb/drivers/pqxx/pqxxcursor.cpp +++ b/kexi/kexidb/drivers/pqxx/pqxxcursor.cpp @@ -34,17 +34,17 @@ using namespace KexiDB; unsigned int pqxxSqlCursor_trans_num=0; //!< debug helper -static QByteArray pgsqlByteaToByteArray(const pqxx::result::field& r) +static TQByteArray pgsqlByteaToByteArray(const pqxx::result::field& r) { return KexiDB::pgsqlByteaToByteArray(r.c_str(), r.size()); } //================================================================================== //Constructor based on query statement -pqxxSqlCursor::pqxxSqlCursor(KexiDB::Connection* conn, const QString& statement, uint options): +pqxxSqlCursor::pqxxSqlCursor(KexiDB::Connection* conn, const TQString& statement, uint options): Cursor(conn,statement, options) { -// KexiDBDrvDbg << "PQXXSQLCURSOR: constructor for query statement" << endl; +// KexiDBDrvDbg << "PTQXXSQLCURSOR: constructor for query statement" << endl; my_conn = static_cast<pqxxSqlConnection*>(conn)->d->pqxxsql; m_options = Buffered; m_res = 0; @@ -57,7 +57,7 @@ pqxxSqlCursor::pqxxSqlCursor(KexiDB::Connection* conn, const QString& statement, pqxxSqlCursor::pqxxSqlCursor(Connection* conn, QuerySchema& query, uint options ) : Cursor( conn, query, options ) { -// KexiDBDrvDbg << "PQXXSQLCURSOR: constructor for query schema" << endl; +// KexiDBDrvDbg << "PTQXXSQLCURSOR: constructor for query schema" << endl; my_conn = static_cast<pqxxSqlConnection*>(conn)->d->pqxxsql; m_options = Buffered; m_res = 0; @@ -86,7 +86,7 @@ bool pqxxSqlCursor::drv_open() return false; } - QCString cur_name; + TQCString cur_name; //Set up a transaction try { @@ -117,8 +117,8 @@ bool pqxxSqlCursor::drv_open() } catch (const std::exception &e) { - setError(ERR_DB_SPECIFIC, QString::fromUtf8( e.what()) ); - KexiDBDrvWarn << "pqxxSqlCursor::drv_open:exception - " << QString::fromUtf8( e.what() ) << endl; + setError(ERR_DB_SPECIFIC, TQString::fromUtf8( e.what()) ); + KexiDBDrvWarn << "pqxxSqlCursor::drv_open:exception - " << TQString::fromUtf8( e.what() ) << endl; } catch(...) { @@ -193,31 +193,31 @@ void pqxxSqlCursor::drv_getPrevRecord() //================================================================================== //Return the value for a given column for the current record -QVariant pqxxSqlCursor::value(uint pos) +TQVariant pqxxSqlCursor::value(uint pos) { if (pos < m_fieldCount) return pValue(pos); else - return QVariant(); + return TQVariant(); } //================================================================================== //Return the value for a given column for the current record - Private const version -QVariant pqxxSqlCursor::pValue(uint pos)const +TQVariant pqxxSqlCursor::pValue(uint pos)const { if (m_res->size() <= 0) { KexiDBDrvWarn << "pqxxSqlCursor::value - ERROR: result size not greater than 0" << endl; - return QVariant(); + return TQVariant(); } if (pos>=(m_fieldCount+(m_containsROWIDInfo ? 1 : 0))) { // KexiDBDrvWarn << "pqxxSqlCursor::value - ERROR: requested position is greater than the number of fields" << endl; - return QVariant(); + return TQVariant(); } - KexiDB::Field *f = (m_fieldsExpanded && pos<QMIN(m_fieldsExpanded->count(), m_fieldCount)) + KexiDB::Field *f = (m_fieldsExpanded && pos<TQMIN(m_fieldsExpanded->count(), m_fieldCount)) ? m_fieldsExpanded->at(pos)->field : 0; // KexiDBDrvDbg << "pqxxSqlCursor::value(" << pos << ")" << endl; @@ -231,7 +231,7 @@ QVariant pqxxSqlCursor::pValue(uint pos)const } else if (f->isTextType()) { - return QString::fromUtf8((*m_res)[at()][pos].c_str()); //utf8? + return TQString::fromUtf8((*m_res)[at()][pos].c_str()); //utf8? } else if (f->isFPNumericType()) { @@ -249,7 +249,7 @@ QVariant pqxxSqlCursor::pValue(uint pos)const return pgsqlCStrToVariant((*m_res)[at()][pos]); } - return QString::fromUtf8((*m_res)[at()][pos].c_str(), (*m_res)[at()][pos].size()); //utf8? + return TQString::fromUtf8((*m_res)[at()][pos].c_str(), (*m_res)[at()][pos].size()); //utf8? } //================================================================================== @@ -332,7 +332,7 @@ void pqxxSqlCursor::drv_bufferMovePointerPrev() //================================================================================== //Move internal pointer to internal buffer to N //Implementation required but no need in this driver -void pqxxSqlCursor::drv_bufferMovePointerTo(Q_LLONG to) +void pqxxSqlCursor::drv_bufferMovePointerTo(TQ_LLONG to) { Q_UNUSED(to); } diff --git a/kexi/kexidb/drivers/pqxx/pqxxcursor.h b/kexi/kexidb/drivers/pqxx/pqxxcursor.h index d596acca..637a33f3 100644 --- a/kexi/kexidb/drivers/pqxx/pqxxcursor.h +++ b/kexi/kexidb/drivers/pqxx/pqxxcursor.h @@ -17,8 +17,8 @@ * Boston, MA 02110-1301, USA. */ -#ifndef KEXIDB_CURSOR_PQXX_H -#define KEXIDB_CURSOR_PQXX_H +#ifndef KEXIDB_CURSOR_PTQXX_H +#define KEXIDB_CURSOR_PTQXX_H #include <kexidb/cursor.h> #include <kexidb/connection.h> @@ -39,7 +39,7 @@ class pqxxSqlCursor: public Cursor { public: virtual ~pqxxSqlCursor(); - virtual QVariant value(uint i); + virtual TQVariant value(uint i); virtual const char** rowData() const; virtual void storeCurrentRow(RowData &data) const; @@ -47,18 +47,18 @@ public: //TODO virtual int serverResult() const; -//TODO virtual QString serverResultName() const; +//TODO virtual TQString serverResultName() const; -//TODO virtual QString serverErrorMsg() const; +//TODO virtual TQString serverErrorMsg() const; protected: - pqxxSqlCursor(Connection* conn, const QString& statement = QString::null, uint options = NoOptions ); + pqxxSqlCursor(Connection* conn, const TQString& statement = TQString(), uint options = NoOptions ); pqxxSqlCursor(Connection* conn, QuerySchema& query, uint options = NoOptions ); virtual void drv_clearServerResult(); virtual void drv_appendCurrentRecordToBuffer(); virtual void drv_bufferMovePointerNext(); virtual void drv_bufferMovePointerPrev(); - virtual void drv_bufferMovePointerTo(Q_LLONG to); + virtual void drv_bufferMovePointerTo(TQ_LLONG to); virtual bool drv_open(); virtual bool drv_close(); virtual void drv_getNextRecord(); @@ -68,18 +68,18 @@ private: pqxx::result* m_res; // pqxx::nontransaction* m_tran; pqxx::connection* my_conn; - QVariant pValue(uint pos)const; + TQVariant pValue(uint pos)const; bool m_implicityStarted : 1; - //QByteArray processBinaryData(pqxx::binarystring*) const; + //TQByteArray processBinaryData(pqxx::binarystring*) const; friend class pqxxSqlConnection; }; -inline QVariant pgsqlCStrToVariant(const pqxx::result::field& r) +inline TQVariant pgsqlCStrToVariant(const pqxx::result::field& r) { switch(r.type()) { case BOOLOID: - return QString::fromLatin1(r.c_str(), r.size())=="true"; //TODO check formatting + return TQString::tqfromLatin1(r.c_str(), r.size())=="true"; //TODO check formatting case INT2OID: case INT4OID: case INT8OID: @@ -89,19 +89,19 @@ inline QVariant pgsqlCStrToVariant(const pqxx::result::field& r) case NUMERICOID: return r.as(double()); case DATEOID: - return QString::fromUtf8(r.c_str(), r.size()); //TODO check formatting + return TQString::fromUtf8(r.c_str(), r.size()); //TODO check formatting case TIMEOID: - return QString::fromUtf8(r.c_str(), r.size()); //TODO check formatting + return TQString::fromUtf8(r.c_str(), r.size()); //TODO check formatting case TIMESTAMPOID: - return QString::fromUtf8(r.c_str(), r.size()); //TODO check formatting + return TQString::fromUtf8(r.c_str(), r.size()); //TODO check formatting case BYTEAOID: return KexiDB::pgsqlByteaToByteArray(r.c_str(), r.size()); case BPCHAROID: case VARCHAROID: case TEXTOID: - return QString::fromUtf8(r.c_str(), r.size()); //utf8? + return TQString::fromUtf8(r.c_str(), r.size()); //utf8? default: - return QString::fromUtf8(r.c_str(), r.size()); //utf8? + return TQString::fromUtf8(r.c_str(), r.size()); //utf8? } } diff --git a/kexi/kexidb/drivers/pqxx/pqxxdriver.cpp b/kexi/kexidb/drivers/pqxx/pqxxdriver.cpp index d8e6216d..3d9162ca 100644 --- a/kexi/kexidb/drivers/pqxx/pqxxdriver.cpp +++ b/kexi/kexidb/drivers/pqxx/pqxxdriver.cpp @@ -33,8 +33,8 @@ KEXIDB_DRIVER_INFO( pqxxSqlDriver, pqxxsql ) //================================================================================== // -pqxxSqlDriver::pqxxSqlDriver( QObject *parent, const char *name, const QStringList &args ) - : Driver( parent, name, args ) +pqxxSqlDriver::pqxxSqlDriver( TQObject *tqparent, const char *name, const TQStringList &args ) + : Driver( tqparent, name, args ) { d->isFileDriver = false; d->features = SingleTransactions | CursorForward | CursorBackward; @@ -47,7 +47,7 @@ pqxxSqlDriver::pqxxSqlDriver( QObject *parent, const char *name, const QStringLi beh->AUTO_INCREMENT_FIELD_OPTION = ""; beh->AUTO_INCREMENT_PK_FIELD_OPTION = "PRIMARY KEY"; beh->ALWAYS_AVAILABLE_DATABASE_NAME = "template1"; - beh->QUOTATION_MARKS_FOR_IDENTIFIER = '"'; + beh->TQUOTATION_MARKS_FOR_IDENTIFIER = '"'; beh->SQL_KEYWORDS = keywords; initSQLKeywords(233); @@ -72,7 +72,7 @@ pqxxSqlDriver::pqxxSqlDriver( QObject *parent, const char *name, const QStringLi //================================================================================== //Override the default implementation to allow for NUMERIC type natively -QString pqxxSqlDriver::sqlTypeName(int id_t, int p) const +TQString pqxxSqlDriver::sqlTypeName(int id_t, int p) const { if (id_t==Field::Null) return "NULL"; @@ -110,69 +110,69 @@ pqxxSqlDriver::drv_createConnection( ConnectionData &conn_data ) //================================================================================== // -bool pqxxSqlDriver::isSystemObjectName( const QString& n ) const +bool pqxxSqlDriver::isSystemObjectName( const TQString& n ) const { return Driver::isSystemObjectName(n); } //================================================================================== // -bool pqxxSqlDriver::drv_isSystemFieldName( const QString& ) const +bool pqxxSqlDriver::drv_isSystemFieldName( const TQString& ) const { return false; } //================================================================================== // -bool pqxxSqlDriver::isSystemDatabaseName( const QString& n ) const +bool pqxxSqlDriver::isSystemDatabaseName( const TQString& n ) const { return n.lower()=="template1" || n.lower()=="template0"; } //================================================================================== // -QString pqxxSqlDriver::escapeString( const QString& str) const +TQString pqxxSqlDriver::escapeString( const TQString& str) const { - return QString::fromLatin1("'") - + QString::fromAscii( pqxx::sqlesc(std::string(str.utf8())).c_str() ) - + QString::fromLatin1("'"); + return TQString::tqfromLatin1("'") + + TQString::fromAscii( pqxx::sqlesc(std::string(str.utf8())).c_str() ) + + TQString::tqfromLatin1("'"); } //================================================================================== // -QCString pqxxSqlDriver::escapeString( const QCString& str) const +TQCString pqxxSqlDriver::escapeString( const TQCString& str) const { - return QCString("'") - + QCString( pqxx::sqlesc(QString(str).ascii()).c_str() ) - + QCString("'"); + return TQCString("'") + + TQCString( pqxx::sqlesc(TQString(str).ascii()).c_str() ) + + TQCString("'"); } //================================================================================== // -QString pqxxSqlDriver::drv_escapeIdentifier( const QString& str) const { - return QString(str).replace( '"', "\"\"" ); +TQString pqxxSqlDriver::drv_escapeIdentifier( const TQString& str) const { + return TQString(str).tqreplace( '"', "\"\"" ); } //================================================================================== // -QCString pqxxSqlDriver::drv_escapeIdentifier( const QCString& str) const { - return QCString(str).replace( '"', "\"\"" ); +TQCString pqxxSqlDriver::drv_escapeIdentifier( const TQCString& str) const { + return TQCString(str).tqreplace( '"', "\"\"" ); } //================================================================================== // -QString pqxxSqlDriver::escapeBLOB(const QByteArray& array) const +TQString pqxxSqlDriver::escapeBLOB(const TQByteArray& array) const { return KexiDB::escapeBLOB(array, KexiDB::BLOBEscapeOctal); } -QString pqxxSqlDriver::valueToSQL( uint ftype, const QVariant& v ) const +TQString pqxxSqlDriver::valueToSQL( uint ftype, const TQVariant& v ) const { if (ftype==Field::Boolean) { // use SQL compliant TRUE or FALSE as described here // http://www.postgresql.org/docs/8.0/interactive/datatype-boolean.html // 1 or 0 does not work - return v.toInt()==0 ? QString::fromLatin1("FALSE") : QString::fromLatin1("TRUE"); + return v.toInt()==0 ? TQString::tqfromLatin1("FALSE") : TQString::tqfromLatin1("TRUE"); } return Driver::valueToSQL(ftype, v); } diff --git a/kexi/kexidb/drivers/pqxx/pqxxdriver.h b/kexi/kexidb/drivers/pqxx/pqxxdriver.h index bbfdddc3..779c1368 100644 --- a/kexi/kexidb/drivers/pqxx/pqxxdriver.h +++ b/kexi/kexidb/drivers/pqxx/pqxxdriver.h @@ -17,10 +17,10 @@ * Boston, MA 02110-1301, USA. */ -#ifndef KEXIDB_DRIVER_PQXX_H -#define KEXIDB_DRIVER_PQXX_H +#ifndef KEXIDB_DRIVER_PTQXX_H +#define KEXIDB_DRIVER_PTQXX_H -#include <qstringlist.h> +#include <tqstringlist.h> #include <kexidb/driver.h> @@ -34,33 +34,34 @@ class DriverManager; class pqxxSqlDriver : public Driver { Q_OBJECT + TQ_OBJECT KEXIDB_DRIVER public: - pqxxSqlDriver( QObject *parent, const char *name, const QStringList &args = QStringList() ); + pqxxSqlDriver( TQObject *tqparent, const char *name, const TQStringList &args = TQStringList() ); ~pqxxSqlDriver(); - virtual bool isSystemObjectName( const QString& n )const; - virtual bool isSystemDatabaseName( const QString& n )const; + virtual bool isSystemObjectName( const TQString& n )const; + virtual bool isSystemDatabaseName( const TQString& n )const; //! Escape a string for use as a value - virtual QString escapeString( const QString& str) const; - virtual QCString escapeString( const QCString& str) const; - virtual QString sqlTypeName(int id_t, int p=0) const; + virtual TQString escapeString( const TQString& str) const; + virtual TQCString escapeString( const TQCString& str) const; + virtual TQString sqlTypeName(int id_t, int p=0) const; //! Escape BLOB value \a array - virtual QString escapeBLOB(const QByteArray& array) const; + virtual TQString escapeBLOB(const TQByteArray& array) const; /*! Escapes and converts value \a v (for type \a ftype) to string representation required by SQL commands. Reimplemented for boolean type only to use SQL compliant TRUE or FALSE */ - virtual QString valueToSQL( uint ftype, const QVariant& v ) const; + virtual TQString valueToSQL( uint ftype, const TQVariant& v ) const; protected: - virtual QString drv_escapeIdentifier( const QString& str) const; - virtual QCString drv_escapeIdentifier( const QCString& str) const; + virtual TQString drv_escapeIdentifier( const TQString& str) const; + virtual TQCString drv_escapeIdentifier( const TQCString& str) const; virtual Connection *drv_createConnection( ConnectionData &conn_data ); - virtual bool drv_isSystemFieldName( const QString& n )const; + virtual bool drv_isSystemFieldName( const TQString& n )const; private: static const char *keywords[]; diff --git a/kexi/kexidb/drivers/pqxx/pqxxpreparedstatement.h b/kexi/kexidb/drivers/pqxx/pqxxpreparedstatement.h index 232454d3..1421f5a4 100644 --- a/kexi/kexidb/drivers/pqxx/pqxxpreparedstatement.h +++ b/kexi/kexidb/drivers/pqxx/pqxxpreparedstatement.h @@ -22,8 +22,8 @@ // Description: // // -#ifndef PQXXPREPAREDSTATEMENT_H -#define PQXXPREPAREDSTATEMENT_H +#ifndef PTQXXPREPAREDSTATEMENT_H +#define PTQXXPREPAREDSTATEMENT_H #include <kexidb/preparedstatement.h> #include <kexidb/connection_p.h> |