diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-05-04 19:54:24 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-05-04 19:54:24 +0000 |
commit | d7633c195a464e4d344ada9eea61afd10110598a (patch) | |
tree | 1f2da0b135f3ed84955e340cae823f00c4ce7284 /src/svnqt/cache | |
parent | 3fa7eb804f67b2789f128075cc2522f398640250 (diff) | |
download | tdesvn-d7633c195a464e4d344ada9eea61afd10110598a.tar.gz tdesvn-d7633c195a464e4d344ada9eea61afd10110598a.zip |
Port kdesvn to TQt4
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kdesvn@1230412 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/svnqt/cache')
-rw-r--r-- | src/svnqt/cache/DatabaseException.cpp | 6 | ||||
-rw-r--r-- | src/svnqt/cache/DatabaseException.hpp | 6 | ||||
-rw-r--r-- | src/svnqt/cache/LogCache.cpp | 266 | ||||
-rw-r--r-- | src/svnqt/cache/LogCache.hpp | 16 | ||||
-rw-r--r-- | src/svnqt/cache/ReposLog.cpp | 200 | ||||
-rw-r--r-- | src/svnqt/cache/ReposLog.hpp | 16 | ||||
-rw-r--r-- | src/svnqt/cache/sqlite3/qsql_sqlite3.cpp | 243 | ||||
-rw-r--r-- | src/svnqt/cache/sqlite3/qsql_sqlite3.h | 92 | ||||
-rw-r--r-- | src/svnqt/cache/sqlite3/qsqlcachedresult.cpp | 76 | ||||
-rw-r--r-- | src/svnqt/cache/sqlite3/qsqlcachedresult.h | 38 | ||||
-rw-r--r-- | src/svnqt/cache/test/sqlite.cpp | 36 |
11 files changed, 384 insertions, 611 deletions
diff --git a/src/svnqt/cache/DatabaseException.cpp b/src/svnqt/cache/DatabaseException.cpp index 85812ab..880c041 100644 --- a/src/svnqt/cache/DatabaseException.cpp +++ b/src/svnqt/cache/DatabaseException.cpp @@ -1,12 +1,12 @@ #include "DatabaseException.hpp" /*! - \fn svn::cache::DatabaseException::DatabaseException(const QString&msg,int aNumber)throw() + \fn svn::cache::DatabaseException::DatabaseException(const TQString&msg,int aNumber)throw() */ -svn::cache::DatabaseException::DatabaseException(const QString&msg,int aNumber)throw() +svn::cache::DatabaseException::DatabaseException(const TQString&msg,int aNumber)throw() : Exception(msg),m_number(aNumber) { if (aNumber>-1) { - setMessage(QString("(Code %1) %2").arg(aNumber).arg(msg)); + setMessage(TQString("(Code %1) %2").tqarg(aNumber).tqarg(msg)); } } diff --git a/src/svnqt/cache/DatabaseException.hpp b/src/svnqt/cache/DatabaseException.hpp index 85e5ce4..9e67cb9 100644 --- a/src/svnqt/cache/DatabaseException.hpp +++ b/src/svnqt/cache/DatabaseException.hpp @@ -8,21 +8,21 @@ namespace svn namespace cache { -class SVNQT_EXPORT DatabaseException:public svn::Exception +class SVNTQT_EXPORT DatabaseException:public svn::Exception { private: DatabaseException()throw(); int m_number; public: - DatabaseException(const QString&msg)throw() + DatabaseException(const TQString&msg)throw() : Exception(msg),m_number(-1) {} DatabaseException(const DatabaseException&src)throw() : Exception(src.msg()),m_number(src.number()) {} - DatabaseException(const QString&msg,int aNumber)throw(); + DatabaseException(const TQString&msg,int aNumber)throw(); virtual ~DatabaseException()throw(){} int number() const { diff --git a/src/svnqt/cache/LogCache.cpp b/src/svnqt/cache/LogCache.cpp index 6356c6f..15fe04e 100644 --- a/src/svnqt/cache/LogCache.cpp +++ b/src/svnqt/cache/LogCache.cpp @@ -1,31 +1,23 @@ #include "LogCache.hpp" -#include <qdir.h> -#include <qsql.h> -#include <qsqldatabase.h> -#if QT_VERSION < 0x040000 -#include <qthreadstorage.h> -#else -#include <QMutex> -#include <QThreadStorage> -#include <QSqlError> -#include <QSqlQuery> -#include <QVariant> -#endif -#include <qmap.h> +#include <tqdir.h> +#include <tqsql.h> +#include <tqsqldatabase.h> +#include <tqthreadstorage.h> +#include <tqmap.h> #include "svnqt/path.hpp" #include "svnqt/cache/DatabaseException.hpp" -#ifndef NO_SQLITE3 +#ifndef NO_STQLITE3 #include "sqlite3/qsql_sqlite3.h" #define SQLTYPE "QSQLITE3" #else #define SQLTYPE "QSQLITE" #endif -#define SQLMAIN "logmain-logcache" -#define SQLMAINTABLE "logdb" +#define STQLMAIN "logmain-logcache" +#define STQLMAINTABLE "logdb" namespace svn { namespace cache { @@ -36,39 +28,27 @@ class ThreadDBStore { public: ThreadDBStore(){ -#if QT_VERSION < 0x040000 m_DB=0; -#else - m_DB=QSqlDatabase(); -#endif } ~ThreadDBStore(){ -#if QT_VERSION < 0x040000 m_DB=0; -#else - m_DB=QSqlDatabase(); -#endif - QSqlDatabase::removeDatabase(key); - QMap<QString,QString>::Iterator it; + TQSqlDatabase::removeDatabase(key); + TQMap<TQString,TQString>::Iterator it; for (it=reposCacheNames.begin();it!=reposCacheNames.end();++it) { -#if QT_VERSION < 0x040000 - QSqlDatabase::removeDatabase(it.data()); -#else - QSqlDatabase::removeDatabase(it.value()); -#endif + TQSqlDatabase::removeDatabase(it.data()); } } - QDataBase m_DB; - QString key; - QMap<QString,QString> reposCacheNames; + TQDataBase m_DB; + TQString key; + TQMap<TQString,TQString> reposCacheNames; }; class LogCacheData { protected: - QMutex m_singleDbMutex; + TQMutex m_singleDbMutex; public: LogCacheData(){} @@ -78,97 +58,52 @@ public: } } - bool checkReposDb(QDataBase aDb) + bool checkReposDb(TQDataBase aDb) { -#if QT_VERSION < 0x040000 if (!aDb) { return false; } if (!aDb->open()) { return false; } -#else - if (!aDb.open()) { - return false; - } -#endif - QSqlQuery _q(QString::null, aDb); -#if QT_VERSION < 0x040000 - QStringList list = aDb->tables(); -#else - QStringList list = aDb.tables(); -#endif + TQSqlQuery _q(TQString(), aDb); + TQStringList list = aDb->tables(); -#if QT_VERSION < 0x040000 - if (list.find("logentries")==list.end()) { + if (list.tqfind("logentries")==list.end()) { aDb->transaction(); -#else - if (list.indexOf("logentries")==-1) { - aDb.transaction(); -#endif - _q.exec("CREATE TABLE \"logentries\" (\"revision\" INTEGER UNIQUE,\"date\" INTEGER,\"author\" TEXT, \"message\" TEXT)"); -#if QT_VERSION < 0x040000 + _q.exec("CREATE TABLE \"logentries\" (\"revision\" INTEGER UNITQUE,\"date\" INTEGER,\"author\" TEXT, \"message\" TEXT)"); aDb->commit(); -#else - aDb.commit(); -#endif } -#if QT_VERSION < 0x040000 - if (list.find("changeditems")==list.end()) { + if (list.tqfind("changeditems")==list.end()) { aDb->transaction(); -#else - if (list.indexOf("changeditems")==-1) { - aDb.transaction(); -#endif _q.exec("CREATE TABLE \"changeditems\" (\"revision\" INTEGER,\"changeditem\" TEXT,\"action\" TEXT,\"copyfrom\" TEXT,\"copyfromrev\" INTEGER, PRIMARY KEY(revision,changeditem,action))"); -#if QT_VERSION < 0x040000 aDb->commit(); -#else - aDb.commit(); -#endif } -#if QT_VERSION < 0x040000 list = aDb->tables(); - if (list.find("logentries")==list.end() || list.find("changeditems")==list.end()) { -#else - list = aDb.tables(); - if (list.indexOf("logentries")==-1 || list.indexOf("changeditems")==-1) { -#endif + if (list.tqfind("logentries")==list.end() || list.tqfind("changeditems")==list.end()) { return false; } return true; } - QString createReposDB(const svn::Path&reposroot) { - QMutexLocker locker( &m_singleDbMutex ); + TQString createReposDB(const svn::Path&reposroot) { + TQMutexLocker locker( &m_singleDbMutex ); - QDataBase _mdb = getMainDB(); + TQDataBase _mdb = getMainDB(); - QSqlQuery query1(QString::null,_mdb); - QString q("insert into "+QString(SQLMAINTABLE)+" (reposroot) VALUES('"+reposroot+"')"); -#if QT_VERSION < 0x040000 + TQSqlQuery query1(TQString(),_mdb); + TQString q("insert into "+TQString(STQLMAINTABLE)+" (reposroot) VALUES('"+reposroot+"')"); _mdb->transaction(); -#else - _mdb.transaction(); -#endif query1.exec(q); -#if QT_VERSION < 0x040000 _mdb->commit(); -#else - _mdb.commit(); -#endif - QSqlQuery query(QString::null,_mdb); + TQSqlQuery query(TQString(),_mdb); query.prepare(s_reposSelect); query.bindValue(0,reposroot.native()); query.exec(); - QString db; -#if QT_VERSION < 0x040000 - if (query.lastError().type()==QSqlError::None && query.next()) { -#else - if (query.lastError().type()==QSqlError::NoError && query.next()) { -#endif + TQString db; + if (query.lastError().type()==TQSqlError::None && query.next()) { db = query.value(0).toString(); } else { @@ -176,89 +111,62 @@ public: query.lastQuery().TOUTF8().data()); } if (!db.isEmpty()) { - QString fulldb = m_BasePath+"/"+db+".db"; - QDataBase _db = QSqlDatabase::addDatabase(SQLTYPE,"tmpdb"); -#if QT_VERSION < 0x040000 + TQString fulldb = m_BasePath+"/"+db+".db"; + TQDataBase _db = TQSqlDatabase::addDatabase(SQLTYPE,"tmpdb"); _db->setDatabaseName(fulldb); -#else - _db.setDatabaseName(fulldb); -#endif if (!checkReposDb(_db)) { } - QSqlDatabase::removeDatabase("tmpdb"); + TQSqlDatabase::removeDatabase("tmpdb"); } return db; } - QDataBase getReposDB(const svn::Path&reposroot) { -#if QT_VERSION < 0x040000 + TQDataBase getReposDB(const svn::Path&reposroot) { if (!getMainDB()) { return 0; -#else - if (!getMainDB().isValid()) { - return QDataBase(); -#endif } bool checkDone = false; // make sure path is correct eg. without traling slashes. - QString dbFile; - QSqlQuery c(QString::null,getMainDB()); + TQString dbFile; + TQSqlQuery c(TQString(),getMainDB()); c.prepare(s_reposSelect); c.bindValue(0,reposroot.native()); c.exec(); -#if QT_VERSION < 0x040000 //qDebug("Check for path: "+reposroot.native()); -#endif // only the first one if ( c.next() ) { -#if QT_VERSION < 0x040000 /* qDebug( c.value(0).toString() + ": " + c.value(0).toString() );*/ -#endif dbFile = c.value(0).toString(); } if (dbFile.isEmpty()) { dbFile = createReposDB(reposroot); if (dbFile.isEmpty()) { -#if QT_VERSION < 0x040000 return 0; -#else - return QSqlDatabase(); -#endif } checkDone=true; } - if (m_mainDB.localData()->reposCacheNames.find(dbFile)!=m_mainDB.localData()->reposCacheNames.end()) { - return QSqlDatabase::database(m_mainDB.localData()->reposCacheNames[dbFile]); + if (m_mainDB.localData()->reposCacheNames.tqfind(dbFile)!=m_mainDB.localData()->reposCacheNames.end()) { + return TQSqlDatabase::database(m_mainDB.localData()->reposCacheNames[dbFile]); } int i = 0; - QString _key = dbFile; - while (QSqlDatabase::contains(_key)) { - _key = QString("%1-%2").arg(dbFile).arg(i++); + TQString _key = dbFile; + while (TQSqlDatabase::tqcontains(_key)) { + _key = TQString("%1-%2").tqarg(dbFile).tqarg(i++); } // qDebug("The repository key is now: %s",_key.TOUTF8().data()); - QDataBase _db = QSqlDatabase::addDatabase(SQLTYPE,_key); -#if QT_VERSION < 0x040000 + TQDataBase _db = TQSqlDatabase::addDatabase(SQLTYPE,_key); if (!_db) { return 0; } -#endif - QString fulldb = m_BasePath+"/"+dbFile+".db"; -#if QT_VERSION < 0x040000 + TQString fulldb = m_BasePath+"/"+dbFile+".db"; _db->setDatabaseName(fulldb); -#else - _db.setDatabaseName(fulldb); -#endif // qDebug("try database open %s",fulldb.TOUTF8().data()); if (!checkReposDb(_db)) { qDebug("no DB opened"); -#if QT_VERSION < 0x040000 _db = 0; -#else - _db = QSqlDatabase(); -#endif } else { qDebug("Insert into map"); m_mainDB.localData()->reposCacheNames[dbFile]=_key; @@ -266,27 +174,20 @@ public: return _db; } - QDataBase getMainDB()const + TQDataBase getMainDB()const { if (!m_mainDB.hasLocalData()) { unsigned i=0; - QString _key = SQLMAIN; - while (QSqlDatabase::contains(_key)) { - _key.sprintf("%s-%i",SQLMAIN,i++); + TQString _key = STQLMAIN; + while (TQSqlDatabase::tqcontains(_key)) { + _key.sprintf("%s-%i",STQLMAIN,i++); } qDebug("The key is now: %s",_key.TOUTF8().data()); - QDataBase db = QSqlDatabase::addDatabase(SQLTYPE,_key); -#if QT_VERSION < 0x040000 + TQDataBase db = TQSqlDatabase::addDatabase(SQLTYPE,_key); db->setDatabaseName(m_BasePath+"/maindb.db"); if (!db->open()) { -#else - db.setDatabaseName(m_BasePath+"/maindb.db"); - if (!db.open()) { -#endif -#if QT_VERSION < 0x040000 qWarning("Failed to open main database: " + db->lastError().text()); -#endif } else { m_mainDB.setLocalData(new ThreadDBStore); m_mainDB.localData()->key = _key; @@ -296,41 +197,37 @@ public: if (m_mainDB.hasLocalData()) { return m_mainDB.localData()->m_DB; } else { -#if QT_VERSION < 0x040000 return 0; -#else - return QSqlDatabase(); -#endif } } - QString m_BasePath; + TQString m_BasePath; - mutable QThreadStorage<ThreadDBStore*> m_mainDB; + mutable TQThreadStorage<ThreadDBStore*> m_mainDB; - static const QString s_reposSelect; + static const TQString s_reposSelect; }; -QString LogCache::s_CACHE_FOLDER="logcache"; -const QString LogCacheData::s_reposSelect=QString("SELECT id from ")+QString(SQLMAINTABLE)+QString(" where reposroot=? ORDER by id DESC"); +TQString LogCache::s_CACHE_FOLDER="logcache"; +const TQString LogCacheData::s_reposSelect=TQString("SELECT id from ")+TQString(STQLMAINTABLE)+TQString(" where reposroot=? ORDER by id DESC"); /*! \fn svn::cache::LogCache::LogCache() */ LogCache::LogCache() { - m_BasePath = QDir::HOMEDIR()+"/.svnqt"; + m_BasePath = TQDir::HOMEDIR()+"/.svnqt"; setupCachePath(); } -LogCache::LogCache(const QString&aBasePath) +LogCache::LogCache(const TQString&aBasePath) { if (mSelf) { delete mSelf; } mSelf=this; if (aBasePath.isEmpty()) { - m_BasePath=QDir::HOMEDIR()+"/.svnqt"; + m_BasePath=TQDir::HOMEDIR()+"/.svnqt"; } else { m_BasePath=aBasePath; } @@ -349,7 +246,7 @@ void LogCache::setupCachePath() { m_CacheData = new LogCacheData; m_CacheData->m_BasePath=m_BasePath; - QDir d; + TQDir d; if (!d.exists(m_BasePath)) { d.mkdir(m_BasePath); } @@ -366,35 +263,20 @@ void LogCache::setupCachePath() void LogCache::setupMainDb() { #ifndef NO_SQLITE3 - if (!QSqlDatabase::isDriverAvailable(SQLTYPE)) { - QSqlDatabase::registerSqlDriver(SQLTYPE,new QSqlDriverCreator<QSQLite3Driver>); + if (!TQSqlDatabase::isDriverAvailable(SQLTYPE)) { + TQSqlDatabase::registerSqlDriver(SQLTYPE,new TQSqlDriverCreator<TQSQLite3Driver>); } #endif - QDataBase mainDB = m_CacheData->getMainDB(); -#if QT_VERSION < 0x040000 + TQDataBase mainDB = m_CacheData->getMainDB(); if (!mainDB || !mainDB->open()) { qWarning("Failed to open main database: " + (mainDB?mainDB->lastError().text():"No database object.")); -#else - if (!mainDB.isValid()) { - qWarning("Failed to open main database."); -#endif } else { - QSqlQuery q(QString::null, mainDB); -#if QT_VERSION < 0x040000 + TQSqlQuery q(TQString(), mainDB); mainDB->transaction(); -#else - mainDB.transaction(); -#endif - if (!q.exec("CREATE TABLE IF NOT EXISTS \""+QString(SQLMAINTABLE)+"\" (\"reposroot\" TEXT,\"id\" INTEGER PRIMARY KEY NOT NULL);")) { -#if QT_VERSION < 0x040000 + if (!q.exec("CREATE TABLE IF NOT EXISTS \""+TQString(STQLMAINTABLE)+"\" (\"reposroot\" TEXT,\"id\" INTEGER PRIMARY KEY NOT NULL);")) { qWarning("Failed create main database: " + mainDB->lastError().text()); -#endif } -#if QT_VERSION < 0x040000 mainDB->commit(); -#else - mainDB.commit(); -#endif } } @@ -417,7 +299,7 @@ svn::cache::LogCache* svn::cache::LogCache::self() /*! \fn svn::cache::LogCache::reposDb() */ -QDataBase svn::cache::LogCache::reposDb(const QString&aRepository) +TQDataBase svn::cache::LogCache::reposDb(const TQString&aRepository) { // qDebug("reposDB"); return m_CacheData->getReposDB(aRepository); @@ -427,24 +309,20 @@ QDataBase svn::cache::LogCache::reposDb(const QString&aRepository) /*! \fn svn::cache::LogCache::cachedRepositories()const */ -QStringList svn::cache::LogCache::cachedRepositories()const +TQStringList svn::cache::LogCache::cachedRepositories()const { - static QString s_q(QString("select \"reposroot\" from ")+QString(SQLMAINTABLE)+QString("order by reposroot")); - QDataBase mainDB = m_CacheData->getMainDB(); - QStringList _res; -#if QT_VERSION < 0x040000 + static TQString s_q(TQString("select \"reposroot\" from ")+TQString(STQLMAINTABLE)+TQString("order by reposroot")); + TQDataBase mainDB = m_CacheData->getMainDB(); + TQStringList _res; if (!mainDB || !mainDB->open()) { -#else - if (!mainDB.isValid()) { -#endif qWarning("Failed to open main database."); return _res; } - QSqlQuery cur(QString::null,mainDB); + TQSqlQuery cur(TQString(),mainDB); cur.prepare(s_q); if (!cur.exec()) { qDebug(cur.lastError().text().TOUTF8().data()); - throw svn::cache::DatabaseException(QString("Could not retrieve values: ")+cur.lastError().text()); + throw svn::cache::DatabaseException(TQString("Could not retrieve values: ")+cur.lastError().text()); return _res; } while (cur.next()) { @@ -456,12 +334,8 @@ QStringList svn::cache::LogCache::cachedRepositories()const bool svn::cache::LogCache::valid()const { - QDataBase mainDB = m_CacheData->getMainDB(); -#if QT_VERSION < 0x040000 + TQDataBase mainDB = m_CacheData->getMainDB(); if (!mainDB || !mainDB->open()) { -#else - if (!mainDB.isValid()) { -#endif return false; } return true; diff --git a/src/svnqt/cache/LogCache.hpp b/src/svnqt/cache/LogCache.hpp index 9e76697..e0a7f02 100644 --- a/src/svnqt/cache/LogCache.hpp +++ b/src/svnqt/cache/LogCache.hpp @@ -1,8 +1,8 @@ #ifndef _LOG_CACHE_HPP #define _LOG_CACHE_HPP -#include <qstring.h> -#include <qdir.h> +#include <tqstring.h> +#include <tqdir.h> #include "svnqt/svnqt_defines.hpp" #include "svnqt/shared_pointer.hpp" @@ -12,7 +12,7 @@ namespace svn { class LogCacheData; - class SVNQT_EXPORT LogCache + class SVNTQT_EXPORT LogCache { private: svn::SharedPointer<LogCacheData> m_CacheData; @@ -20,18 +20,18 @@ namespace svn { protected: LogCache(); static LogCache* mSelf; - QString m_BasePath; - static QString s_CACHE_FOLDER; + TQString m_BasePath; + static TQString s_CACHE_FOLDER; void setupCachePath(); void setupMainDb(); public: ///! should used for testing only! - LogCache(const QString&aBasePath); + LogCache(const TQString&aBasePath); virtual ~LogCache(); static LogCache* self(); - QDataBase reposDb(const QString&aRepository); - QStringList cachedRepositories()const; + TQDataBase reposDb(const TQString&aRepository); + TQStringList cachedRepositories()const; bool valid()const; }; diff --git a/src/svnqt/cache/ReposLog.cpp b/src/svnqt/cache/ReposLog.cpp index 89be2d0..54c4622 100644 --- a/src/svnqt/cache/ReposLog.cpp +++ b/src/svnqt/cache/ReposLog.cpp @@ -7,26 +7,14 @@ #include "svnqt/context_listener.hpp" #include "svnqt/cache/DatabaseException.hpp" -#include <qsqldatabase.h> - -#if QT_VERSION < 0x040000 -#else -#include <QSqlError> -#include <QSqlQuery> -#include <QVariant> -#define Q_LLONG qlonglong -#endif +#include <tqsqldatabase.h> /*! - \fn svn::cache::ReposLog::ReposLog(svn::Client*aClient,const QString&) + \fn svn::cache::ReposLog::ReposLog(svn::Client*aClient,const TQString&) */ -svn::cache::ReposLog::ReposLog(svn::Client*aClient,const QString&aRepository) +svn::cache::ReposLog::ReposLog(svn::Client*aClient,const TQString&aRepository) :m_Client(), -#if QT_VERSION < 0x040000 m_Database(0), -#else - m_Database(), -#endif m_ReposRoot(aRepository),m_latestHead(svn::Revision::UNDEFINED) { m_Client=aClient; @@ -45,17 +33,9 @@ svn::Revision svn::cache::ReposLog::latestHeadRev() if (!m_Client||m_ReposRoot.isEmpty()) { return svn::Revision::UNDEFINED; } -#if QT_VERSION < 0x040000 if (!m_Database) { -#else - if (!m_Database.isValid()) { -#endif m_Database = LogCache::self()->reposDb(m_ReposRoot); -#if QT_VERSION < 0x040000 if (!m_Database) { -#else - if (!m_Database.isValid()) { -#endif return svn::Revision::UNDEFINED; } } @@ -78,22 +58,15 @@ svn::Revision svn::cache::ReposLog::latestCachedRev() if (m_ReposRoot.isEmpty()) { return svn::Revision::UNDEFINED; } -#if QT_VERSION < 0x040000 if (!m_Database) { -#else - if (!m_Database.isValid()) { -#endif + m_Database = LogCache::self()->reposDb(m_ReposRoot); -#if QT_VERSION < 0x040000 if (!m_Database) { -#else - if (!m_Database.isValid()) { -#endif return svn::Revision::UNDEFINED; } } - QString q("select revision from 'logentries' order by revision DESC limit 1"); - QSqlQuery _q(QString::null, m_Database); + TQString q("select revision from 'logentries' order by revision DESC limit 1"); + TQSqlQuery _q(TQString(), m_Database); if (!_q.exec(q)) { qDebug(_q.lastError().text().TOUTF8().data()); return svn::Revision::UNDEFINED; @@ -111,17 +84,9 @@ svn::Revision svn::cache::ReposLog::latestCachedRev() bool svn::cache::ReposLog::checkFill(svn::Revision&start,svn::Revision&end,bool checkHead) { -#if QT_VERSION < 0x040000 if (!m_Database) { -#else - if (!m_Database.isValid()) { -#endif m_Database = LogCache::self()->reposDb(m_ReposRoot); -#if QT_VERSION < 0x040000 if (!m_Database) { -#else - if (!m_Database.isValid()) { -#endif return false; } } @@ -173,7 +138,7 @@ bool svn::cache::ReposLog::checkFill(svn::Revision&start,svn::Revision&end,bool if (cp && cp->getListener()) { //cp->getListener()->contextProgress(++icount,_internal.size()); if (cp->getListener()->contextCancel()) { - throw DatabaseException(QString("Could not retrieve values: User cancel.")); + throw DatabaseException(TQString("Could not retrieve values: User cancel.")); } } } @@ -216,24 +181,24 @@ bool svn::cache::ReposLog::simpleLog(LogEntriesMap&target,const svn::Revision&_s if (start==svn::Revision::HEAD) { start=latestCachedRev(); } - static QString sCount("select count(*) from logentries where revision<=? and revision>=?"); - static QString sEntry("select revision,author,date,message from logentries where revision<=? and revision>=?"); - static QString sItems("select changeditem,action,copyfrom,copyfromrev from changeditems where revision=?"); + static TQString sCount("select count(*) from logentries where revision<=? and revision>=?"); + static TQString sEntry("select revision,author,date,message from logentries where revision<=? and revision>=?"); + static TQString sItems("select changeditem,action,copyfrom,copyfromrev from changeditems where revision=?"); - QSqlQuery bcount(QString::null,m_Database); + TQSqlQuery bcount(TQString(),m_Database); bcount.prepare(sCount); - QSqlQuery bcur(QString::null,m_Database); + TQSqlQuery bcur(TQString(),m_Database); bcur.prepare(sEntry); - QSqlQuery cur(QString::null,m_Database); + TQSqlQuery cur(TQString(),m_Database); cur.prepare(sItems); - bcount.bindValue(0,Q_LLONG(end.revnum())); - bcount.bindValue(1,Q_LLONG(start.revnum())); + bcount.bindValue(0,TQ_LLONG(end.revnum())); + bcount.bindValue(1,TQ_LLONG(start.revnum())); if (!bcount.exec()) { qDebug(bcount.lastError().text().TOUTF8().data()); - throw svn::cache::DatabaseException(QString("Could not retrieve count: ")+bcount.lastError().text()); + throw svn::cache::DatabaseException(TQString("Could not retrieve count: ")+bcount.lastError().text()); return false; } bcount.next(); @@ -242,21 +207,21 @@ bool svn::cache::ReposLog::simpleLog(LogEntriesMap&target,const svn::Revision&_s return false; } - bcur.bindValue(0,Q_LLONG(end.revnum())); - bcur.bindValue(1,Q_LLONG(start.revnum())); + bcur.bindValue(0,TQ_LLONG(end.revnum())); + bcur.bindValue(1,TQ_LLONG(start.revnum())); if (!bcur.exec()) { qDebug(bcur.lastError().text().TOUTF8().data()); - throw svn::cache::DatabaseException(QString("Could not retrieve values: ")+bcur.lastError().text()); + throw svn::cache::DatabaseException(TQString("Could not retrieve values: ")+bcur.lastError().text()); return false; } - Q_LLONG revision; + TQ_LLONG revision; while(bcur.next()) { revision = bcur.value(0).toLongLong(); cur.bindValue(0,revision); if (!cur.exec()) { qDebug(cur.lastError().text().TOUTF8().data()); - throw svn::cache::DatabaseException(QString("Could not retrieve values: ")+cur.lastError().text() + throw svn::cache::DatabaseException(TQString("Could not retrieve values: ")+cur.lastError().text() ,cur.lastError().number()); return false; } @@ -266,12 +231,8 @@ bool svn::cache::ReposLog::simpleLog(LogEntriesMap&target,const svn::Revision&_s target[revision].message=bcur.value(3).toString(); while(cur.next()) { LogChangePathEntry lcp; - QString ac = cur.value(1).toString(); -#if QT_VERSION < 0x040000 + TQString ac = cur.value(1).toString(); lcp.action=ac[0].latin1(); -#else - lcp.action=ac[0].toLatin1(); -#endif lcp.copyFromPath=cur.value(2).toString(); lcp.path= cur.value(0).toString(); lcp.copyFromRevision=cur.value(3).toLongLong(); @@ -279,7 +240,7 @@ bool svn::cache::ReposLog::simpleLog(LogEntriesMap&target,const svn::Revision&_s } if (cp && cp->getListener()) { if (cp->getListener()->contextCancel()) { - throw svn::cache::DatabaseException(QString("Could not retrieve values: User cancel.")); + throw svn::cache::DatabaseException(TQString("Could not retrieve values: User cancel.")); return false; } } @@ -296,21 +257,13 @@ svn::Revision svn::cache::ReposLog::date2numberRev(const svn::Revision&aRev,bool if (aRev!=svn::Revision::DATE) { return aRev; } -#if QT_VERSION < 0x040000 if (!m_Database) { -#else - if (!m_Database.isValid()) { -#endif return svn::Revision::UNDEFINED; } - static QString _q("select revision from logentries where date<? order by revision desc"); - QSqlQuery query("select revision,date from logentries order by revision desc limit 1",m_Database); + static TQString _q("select revision from logentries where date<? order by revision desc"); + TQSqlQuery query("select revision,date from logentries order by revision desc limit 1",m_Database); -#if QT_VERSION < 0x040000 - if (query.lastError().type()!=QSqlError::None) { -#else - if (query.lastError().type()!=QSqlError::NoError) { -#endif + if (query.lastError().type()!=TQSqlError::None) { qDebug(query.lastError().text().TOUTF8().data()); } bool must_remote=!noNetwork; @@ -327,13 +280,9 @@ svn::Revision svn::cache::ReposLog::date2numberRev(const svn::Revision&aRev,bool return e[0].revision(); } query.prepare(_q); - query.bindValue(0,Q_LLONG(aRev.date())); + query.bindValue(0,TQ_LLONG(aRev.date())); query.exec(); -#if QT_VERSION < 0x040000 - if (query.lastError().type()!=QSqlError::None) { -#else - if (query.lastError().type()!=QSqlError::NoError) { -#endif + if (query.lastError().type()!=TQSqlError::None) { qDebug(query.lastError().text().TOUTF8().data()); } if (query.next()) { @@ -356,57 +305,40 @@ svn::Revision svn::cache::ReposLog::date2numberRev(const svn::Revision&aRev,bool */ bool svn::cache::ReposLog::_insertLogEntry(const svn::LogEntry&aEntry) { - QSqlRecord *buffer; + TQSqlRecord *buffer; -#if QT_VERSION < 0x040000 m_Database->transaction(); - Q_LLONG j = aEntry.revision; -#else - m_Database.transaction(); - qlonglong j = aEntry.revision; -#endif - static QString qEntry("insert into logentries (revision,date,author,message) values (?,?,?,?)"); - static QString qPathes("insert into changeditems (revision,changeditem,action,copyfrom,copyfromrev) values (?,?,?,?,?)"); - QSqlQuery _q(QString::null,m_Database); + TQ_LLONG j = aEntry.revision; + static TQString qEntry("insert into logentries (revision,date,author,message) values (?,?,?,?)"); + static TQString qPathes("insert into changeditems (revision,changeditem,action,copyfrom,copyfromrev) values (?,?,?,?,?)"); + TQSqlQuery _q(TQString(),m_Database); _q.prepare(qEntry); _q.bindValue(0,j); _q.bindValue(1,aEntry.date); _q.bindValue(2,aEntry.author); _q.bindValue(3,aEntry.message); if (!_q.exec()) { -#if QT_VERSION < 0x040000 m_Database->rollback(); -#else - m_Database.rollback(); -#endif qDebug("Could not insert values: %s",_q.lastError().text().TOUTF8().data()); qDebug(_q.lastQuery().TOUTF8().data()); - throw svn::cache::DatabaseException(QString("Could not insert values: ")+_q.lastError().text(),_q.lastError().number()); + throw svn::cache::DatabaseException(TQString("Could not insert values: ")+_q.lastError().text(),_q.lastError().number()); } _q.prepare(qPathes); svn::LogChangePathEntries::ConstIterator cpit = aEntry.changedPaths.begin(); for (;cpit!=aEntry.changedPaths.end();++cpit){ _q.bindValue(0,j); _q.bindValue(1,(*cpit).path); - _q.bindValue(2,QString(QChar((*cpit).action))); + _q.bindValue(2,TQString(TQChar((*cpit).action))); _q.bindValue(3,(*cpit).copyFromPath); - _q.bindValue(4,Q_LLONG((*cpit).copyFromRevision)); + _q.bindValue(4,TQ_LLONG((*cpit).copyFromRevision)); if (!_q.exec()) { -#if QT_VERSION < 0x040000 m_Database->rollback(); -#else - m_Database.rollback(); -#endif qDebug("Could not insert values: %s",_q.lastError().text().TOUTF8().data()); qDebug(_q.lastQuery().TOUTF8().data()); - throw svn::cache::DatabaseException(QString("Could not insert values: ")+_q.lastError().text(),_q.lastError().number()); + throw svn::cache::DatabaseException(TQString("Could not insert values: ")+_q.lastError().text(),_q.lastError().number()); } } -#if QT_VERSION < 0x040000 m_Database->commit(); -#else - m_Database.commit(); -#endif return true; } @@ -421,44 +353,43 @@ bool svn::cache::ReposLog::insertLogEntry(const svn::LogEntry&aEntry) */ bool svn::cache::ReposLog::log(const svn::Path&what,const svn::Revision&_start, const svn::Revision&_end,const svn::Revision&_peg,svn::LogEntriesMap&target, bool strictNodeHistory,int limit) { - static QString s_q("select logentries.revision,logentries.author,logentries.date,logentries.message from logentries where logentries.revision in (select changeditems.revision from changeditems where (changeditems.changeditem='%1' or changeditems.changeditem GLOB '%2/*') %3 GROUP BY changeditems.revision) ORDER BY logentries.revision DESC"); + static TQString s_q("select logentries.revision,logentries.author,logentries.date,logentries.message from logentries where logentries.revision in (select changeditems.revision from changeditems where (changeditems.changeditem='%1' or changeditems.changeditem GLOB '%2/*') %3 GROUP BY changeditems.revision) ORDER BY logentries.revision DESC"); - static QString s_e("select changeditem,action,copyfrom,copyfromrev from changeditems where changeditems.revision='%1'"); + static TQString s_e("select changeditem,action,copyfrom,copyfromrev from changeditems where changeditems.revision='%1'"); svn::Revision peg = date2numberRev(_peg,true); svn::Revision end = date2numberRev(_end,true); svn::Revision start = date2numberRev(_start,true); - QString query_string = QString(s_q).arg(what.native()).arg(what.native()).arg((peg==svn::Revision::UNDEFINED?"":QString(" AND revision<=%1").arg(peg.revnum()))); + TQString query_string = TQString(s_q).tqarg(what.native()).tqarg(what.native()).tqarg((peg==svn::Revision::UNDEFINED?"":TQString(" AND revision<=%1").tqarg(peg.revnum()))); if (peg==svn::Revision::UNDEFINED) { peg = latestCachedRev(); } if (!itemExists(peg,what)) { - throw svn::cache::DatabaseException(QString("Entry '%1' does not exists at revision %2").arg(what.native()).arg(peg.toString())); + throw svn::cache::DatabaseException(TQString("Entry '%1' does not exists at revision %2").tqarg(what.native()).tqarg(peg.toString())); } if (limit>0) { - query_string+=QString(" LIMIT %1").arg(limit); + query_string+=TQString(" LIMIT %1").tqarg(limit); } - QSqlQuery _q(QString::null,m_Database); - QSqlQuery _q2(QString::null,m_Database); + TQSqlQuery _q(TQString(),m_Database); + TQSqlQuery _q2(TQString(),m_Database); _q.prepare(query_string); if (!_q.exec()) { qDebug("Could not select values: %s",_q.lastError().text().TOUTF8().data()); qDebug(_q.lastQuery().TOUTF8().data()); - throw svn::cache::DatabaseException(QString("Could not select values: ")+_q.lastError().text(),_q.lastError().number()); + throw svn::cache::DatabaseException(TQString("Could not select values: ")+_q.lastError().text(),_q.lastError().number()); } while(_q.next()) { - Q_LLONG revision = _q.value(0).toLongLong(); + TQ_LLONG revision = _q.value(0).toLongLong(); target[revision].revision=revision; target[revision].author=_q.value(1).toString(); target[revision].date=_q.value(2).toLongLong(); target[revision].message=_q.value(3).toString(); - query_string=s_e.arg(revision); + query_string=s_e.tqarg(revision); _q2.prepare(query_string); if (!_q2.exec()) { qDebug("Could not select values: %s",_q2.lastError().text().TOUTF8().data()); } else { while (_q2.next()) { -#if QT_VERSION < 0x040000 target[revision].changedPaths.push_back ( LogChangePathEntry (_q2.value(0).toString(), _q2.value(1).toString()[0], @@ -466,15 +397,6 @@ bool svn::cache::ReposLog::log(const svn::Path&what,const svn::Revision&_start, _q2.value(3).toLongLong() ) ); -#else - target[revision].changedPaths.push_back ( - LogChangePathEntry (_q2.value(0).toString(), - _q2.value(1).toChar().toLatin1(), - _q2.value(2).toString(), - _q2.value(3).toLongLong() - ) - ); -#endif } } @@ -484,50 +406,42 @@ bool svn::cache::ReposLog::log(const svn::Path&what,const svn::Revision&_start, /*! - \fn svn::cache::ReposLog::itemExists(const svn::Revision&,const QString&) + \fn svn::cache::ReposLog::itemExists(const svn::Revision&,const TQString&) */ bool svn::cache::ReposLog::itemExists(const svn::Revision&peg,const svn::Path&path) { - /// @todo this moment I have no idea how to check real with all moves and deletes of parent folders without a hell of sql statements so we make it quite simple: it exists if we found it. + /// @todo this moment I have no idea how to check real with all moves and deletes of tqparent folders without a hell of sql statements so we make it quite simple: it exists if we found it. #if 0 - static QString _s1("select revision from changeditems where changeditem='%1' and action='A' and revision<=%2 order by revision desc limit 1"); - QSqlQuery _q(QString::null,m_Database); - QString query_string=QString(_s1).arg(path.native()).arg(peg.revnum()); + static TQString _s1("select revision from changeditems where changeditem='%1' and action='A' and revision<=%2 order by revision desc limit 1"); + TQSqlQuery _q(TQString(),m_Database); + TQString query_string=TQString(_s1).tqarg(path.native()).tqarg(peg.revnum()); if (!_q.exec(query_string)) { qDebug("Could not select values: %s",_q.lastError().text().TOUTF8().data()); qDebug(_q.lastQuery().TOUTF8().data()); - throw svn::cache::DatabaseException(QString("Could not select values: ")+_q.lastError().text(),_q.lastError().number()); + throw svn::cache::DatabaseException(TQString("Could not select values: ")+_q.lastError().text(),_q.lastError().number()); } qDebug(_q.lastQuery().TOUTF8().data()); svn::Path _p = path; - static QString _s2("select revision from changeditem where changeditem in (%1) and action='D' and revision>%2 and revision<=%3 order by revision desc limit 1"); - QStringList p_list; + static TQString _s2("select revision from changeditem where changeditem in (%1) and action='D' and revision>%2 and revision<=%3 order by revision desc limit 1"); + TQStringList p_list; while (_p.length()>0) { - p_list.append(QString("'%1'").arg(_p.native())); + p_list.append(TQString("'%1'").tqarg(_p.native())); _p.removeLast(); } - query_string=QString(_s2).arg(p_list.join(",")).arg(); + query_string=TQString(_s2).tqarg(p_list.join(",")).tqarg(); #endif return true; } bool svn::cache::ReposLog::isValid()const { -#if QT_VERSION < 0x040000 if (!m_Database) { -#else - if (!m_Database.isValid()) { -#endif m_Database = LogCache::self()->reposDb(m_ReposRoot); -#if QT_VERSION < 0x040000 if (!m_Database) { -#else - if (!m_Database.isValid()) { -#endif return false; } } diff --git a/src/svnqt/cache/ReposLog.hpp b/src/svnqt/cache/ReposLog.hpp index e81a5c9..1d28037 100644 --- a/src/svnqt/cache/ReposLog.hpp +++ b/src/svnqt/cache/ReposLog.hpp @@ -5,8 +5,8 @@ #include "svnqt/svnqttypes.hpp" #include "svnqt/revision.hpp" -#include <qsqldatabase.h> -#include <qstring.h> +#include <tqsqldatabase.h> +#include <tqstring.h> namespace svn { @@ -16,26 +16,26 @@ class Client; namespace cache { -class SVNQT_EXPORT ReposLog +class SVNTQT_EXPORT ReposLog { protected: svn::Client*m_Client; - mutable QDataBase m_Database; - QString m_ReposRoot; + mutable TQDataBase m_Database; + TQString m_ReposRoot; svn::Revision m_latestHead; //! internal insert. bool _insertLogEntry(const svn::LogEntry&); bool checkFill(svn::Revision&_start,svn::Revision&_end,bool checkHead); public: - ReposLog(svn::Client*aClient,const QString&aRepository=QString::null); + ReposLog(svn::Client*aClient,const TQString&aRepository=TQString()); - QString ReposRoot() const + TQString ReposRoot() const { return m_ReposRoot; } - QDataBase Database() const + TQDataBase Database() const { return m_Database; } diff --git a/src/svnqt/cache/sqlite3/qsql_sqlite3.cpp b/src/svnqt/cache/sqlite3/qsql_sqlite3.cpp index 93010c1..a5faff5 100644 --- a/src/svnqt/cache/sqlite3/qsql_sqlite3.cpp +++ b/src/svnqt/cache/sqlite3/qsql_sqlite3.cpp @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Implementation of SQLite driver classes. +** Implementation of STQLite driver classes. ** ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. ** -** This file is part of the sql module of the Qt GUI Toolkit. +** This file is part of the sql module of the TQt GUI Toolkit. ** EDITIONS: FREE, ENTERPRISE ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE @@ -14,105 +14,98 @@ #include "qsql_sqlite3.h" -#include <qdatetime.h> -#include <qvaluevector.h> -#include <qregexp.h> -#include <qfile.h> +#include <tqdatetime.h> +#include <tqvaluevector.h> +#include <tqregexp.h> +#include <tqfile.h> #include <sqlite3.h> -#if (QT_VERSION-0 < 0x030200) -# include <qvector.h> -# if !defined Q_WS_WIN32 +# include <tqptrvector.h> +# if !defined TQ_WS_WIN32 # include <unistd.h> # endif -#else -# include <qptrvector.h> -# if !defined Q_WS_WIN32 -# include <unistd.h> -# endif -#endif typedef struct sqlite3_stmt sqlite3_stmt; -#define QSQLITE3_DRIVER_NAME "QSQLITE3" +#define TQSQLITE3_DRIVER_NAME "TQSQLITE3" -static QVariant::Type qSqliteType(int tp) +static TQVariant::Type qSqliteType(int tp) { switch (tp) { case SQLITE_INTEGER: - return QVariant::Int; + return TQVariant::Int; case SQLITE_FLOAT: - return QVariant::Double; + return TQVariant::Double; case SQLITE_BLOB: - return QVariant::ByteArray; + return TQVariant::ByteArray; case SQLITE_TEXT: default: - return QVariant::String; + return TQVariant::String; } } -static QSqlError qMakeError(sqlite3 *access, const QString &descr, QSqlError::Type type, +static TQSqlError qMakeError(sqlite3 *access, const TQString &descr, TQSqlError::Type type, int errorCode = -1) { - return QSqlError(descr, - QString::fromUtf8(sqlite3_errmsg(access)), + return TQSqlError(descr, + TQString::fromUtf8(sqlite3_errmsg(access)), type, errorCode); } -class QSQLite3DriverPrivate +class TQSQLite3DriverPrivate { public: - QSQLite3DriverPrivate(); + TQSQLite3DriverPrivate(); sqlite3 *access; bool utf8; }; -QSQLite3DriverPrivate::QSQLite3DriverPrivate() : access(0) +TQSQLite3DriverPrivate::TQSQLite3DriverPrivate() : access(0) { utf8 = true; } -class QSQLite3ResultPrivate +class TQSQLite3ResultPrivate { public: - QSQLite3ResultPrivate(QSQLite3Result *res); + TQSQLite3ResultPrivate(TQSQLite3Result *res); void cleanup(); - bool fetchNext(QSqlCachedResult::ValueCache &values, int idx, bool initialFetch); + bool fetchNext(TQSqlCachedResult::ValueCache &values, int idx, bool initialFetch); bool isSelect(); // initializes the recordInfo and the cache void initColumns(); void finalize(); - QSQLite3Result* q; + TQSQLite3Result* q; sqlite3 *access; sqlite3_stmt *stmt; - uint skippedStatus: 1; // the status of the fetchNext() that's skipped + uint skippedtqStatus: 1; // the status of the fetchNext() that's skipped uint skipRow: 1; // skip the next fetchNext()? uint utf8: 1; - QSqlRecord rInf; + TQSqlRecord rInf; }; static const uint initial_cache_size = 128; -QSQLite3ResultPrivate::QSQLite3ResultPrivate(QSQLite3Result* res) : q(res), access(0), - stmt(0), skippedStatus(false), skipRow(false), utf8(false) +TQSQLite3ResultPrivate::TQSQLite3ResultPrivate(TQSQLite3Result* res) : q(res), access(0), + stmt(0), skippedtqStatus(false), skipRow(false), utf8(false) { } -void QSQLite3ResultPrivate::cleanup() +void TQSQLite3ResultPrivate::cleanup() { finalize(); rInf.clear(); - skippedStatus = false; + skippedtqStatus = false; skipRow = false; - q->setAt(QSql::BeforeFirst); + q->setAt(TQSql::BeforeFirst); q->setActive(false); q->cleanup(); } -void QSQLite3ResultPrivate::finalize() +void TQSQLite3ResultPrivate::finalize() { if (!stmt) return; @@ -122,7 +115,7 @@ void QSQLite3ResultPrivate::finalize() } // called on first fetch -void QSQLite3ResultPrivate::initColumns() +void TQSQLite3ResultPrivate::initColumns() { rInf.clear(); @@ -133,15 +126,15 @@ void QSQLite3ResultPrivate::initColumns() q->init(nCols); for (int i = 0; i < nCols; ++i) { - QString colName = QString::fromUtf8(sqlite3_column_name(stmt, i)); + TQString colName = TQString::fromUtf8(sqlite3_column_name(stmt, i)); - int dotIdx = colName.findRev('.'); - rInf.append(QSqlField(colName.mid(dotIdx == -1 ? 0 : dotIdx + 1), + int dotIdx = colName.tqfindRev('.'); + rInf.append(TQSqlField(colName.mid(dotIdx == -1 ? 0 : dotIdx + 1), qSqliteType(sqlite3_column_type(stmt, i)))); } } -bool QSQLite3ResultPrivate::fetchNext(QSqlCachedResult::ValueCache &values, int idx, bool initialFetch) +bool TQSQLite3ResultPrivate::fetchNext(TQSqlCachedResult::ValueCache &values, int idx, bool initialFetch) { int res; unsigned int i; @@ -150,7 +143,7 @@ bool QSQLite3ResultPrivate::fetchNext(QSqlCachedResult::ValueCache &values, int // already fetched Q_ASSERT(!initialFetch); skipRow = false; - return skippedStatus; + return skippedtqStatus; } skipRow = initialFetch; @@ -160,7 +153,7 @@ bool QSQLite3ResultPrivate::fetchNext(QSqlCachedResult::ValueCache &values, int // keep trying while busy, wish I could implement this better. while ((res = sqlite3_step(stmt)) == SQLITE_BUSY) { // sleep instead requesting result again immidiately. -#if defined Q_OS_WIN +#if defined TQ_OS_WIN Sleep(1000); #else sleep(1); @@ -177,35 +170,35 @@ bool QSQLite3ResultPrivate::fetchNext(QSqlCachedResult::ValueCache &values, int return true; for (i = 0; i < rInf.count(); ++i) // todo - handle other types - values[i + idx] = QString::fromUtf8((char *)(sqlite3_column_text(stmt, i))); - // values[i + idx] = utf8 ? QString::fromUtf8(fvals[i]) : QString::fromAscii(fvals[i]); + values[i + idx] = TQString::fromUtf8((char *)(sqlite3_column_text(stmt, i))); + // values[i + idx] = utf8 ? TQString::fromUtf8(fvals[i]) : TQString::fromAscii(fvals[i]); return true; case SQLITE_DONE: if (rInf.isEmpty()) // must be first call. initColumns(); - q->setAt(QSql::AfterLast); + q->setAt(TQSql::AfterLast); return false; case SQLITE_ERROR: case SQLITE_MISUSE: default: // something wrong, don't get col info, but still return false - q->setLastError(qMakeError(access, "Unable to fetch row", QSqlError::Connection, res)); + q->setLastError(qMakeError(access, "Unable to fetch row", TQSqlError::Connection, res)); finalize(); - q->setAt(QSql::AfterLast); + q->setAt(TQSql::AfterLast); return false; } return false; } -QSQLite3Result::QSQLite3Result(const QSQLite3Driver* db) - : QSqlCachedResult(db) +TQSQLite3Result::TQSQLite3Result(const TQSQLite3Driver* db) + : TQSqlCachedResult(db) { - d = new QSQLite3ResultPrivate(this); + d = new TQSQLite3ResultPrivate(this); d->access = db->d->access; } -QSQLite3Result::~QSQLite3Result() +TQSQLite3Result::~TQSQLite3Result() { d->cleanup(); delete d; @@ -214,7 +207,7 @@ QSQLite3Result::~QSQLite3Result() /* Execute \a query. */ -bool QSQLite3Result::reset (const QString &query) +bool TQSQLite3Result::reset (const TQString &query) { // this is where we build a query. if (!driver() || !driver()->isOpen() || driver()->isOpenError()) @@ -224,61 +217,61 @@ bool QSQLite3Result::reset (const QString &query) setSelect(false); - int res = sqlite3_prepare(d->access, query.utf8().data(), (query.length() + 1) * sizeof(QChar), + int res = sqlite3_prepare(d->access, query.utf8().data(), (query.length() + 1) * sizeof(TQChar), &d->stmt, 0); if (res != SQLITE_OK) { - setLastError(qMakeError(d->access, "Unable to execute statement", QSqlError::Statement, res)); + setLastError(qMakeError(d->access, "Unable to execute statement", TQSqlError::Statement, res)); d->finalize(); return false; } - d->skippedStatus = d->fetchNext(cache(), 0, true); + d->skippedtqStatus = d->fetchNext(cache(), 0, true); setSelect(!d->rInf.isEmpty()); setActive(true); return true; } -bool QSQLite3Result::gotoNext(QSqlCachedResult::ValueCache& row, int idx) +bool TQSQLite3Result::gotoNext(TQSqlCachedResult::ValueCache& row, int idx) { return d->fetchNext(row, idx, false); } -int QSQLite3Result::size() +int TQSQLite3Result::size() { return -1; } -int QSQLite3Result::numRowsAffected() +int TQSQLite3Result::numRowsAffected() { return sqlite3_changes(d->access); } ///////////////////////////////////////////////////////// -QSQLite3Driver::QSQLite3Driver(QObject * parent, const char *name) - : QSqlDriver(parent, name) +TQSQLite3Driver::TQSQLite3Driver(TQObject * tqparent, const char *name) + : TQSqlDriver(tqparent, name) { - d = new QSQLite3DriverPrivate(); + d = new TQSQLite3DriverPrivate(); } -QSQLite3Driver::QSQLite3Driver(sqlite3 *connection, QObject *parent, const char *name) - : QSqlDriver(parent, name) +TQSQLite3Driver::TQSQLite3Driver(sqlite3 *connection, TQObject *tqparent, const char *name) + : TQSqlDriver(tqparent, name) { - d = new QSQLite3DriverPrivate(); + d = new TQSQLite3DriverPrivate(); d->access = connection; setOpen(true); setOpenError(false); } -QSQLite3Driver::~QSQLite3Driver() +TQSQLite3Driver::~TQSQLite3Driver() { delete d; } -bool QSQLite3Driver::hasFeature(DriverFeature f) const +bool TQSQLite3Driver::hasFeature(DriverFeature f) const { switch (f) { case Transactions: @@ -292,10 +285,10 @@ bool QSQLite3Driver::hasFeature(DriverFeature f) const } /* - SQLite dbs have no user name, passwords, hosts or ports. + STQLite dbs have no user name, passwords, hosts or ports. just file names. */ -bool QSQLite3Driver::open(const QString & db, const QString &, const QString &, const QString &, int, const QString &) +bool TQSQLite3Driver::open(const TQString & db, const TQString &, const TQString &, const TQString &, int, const TQString &) { if (isOpen()) close(); @@ -303,99 +296,95 @@ bool QSQLite3Driver::open(const QString & db, const QString &, const QString &, if (db.isEmpty()) return false; - if (sqlite3_open(QFile::encodeName(db), &d->access) == SQLITE_OK) { + if (sqlite3_open(TQFile::encodeName(db), &d->access) == SQLITE_OK) { setOpen(true); setOpenError(false); return true; } else { setLastError(qMakeError(d->access, "Error opening database", - QSqlError::Connection)); + TQSqlError::Connection)); setOpenError(true); return false; } } -void QSQLite3Driver::close() +void TQSQLite3Driver::close() { if (isOpen()) { if (sqlite3_close(d->access) != SQLITE_OK) setLastError(qMakeError(d->access, "Error closing database", - QSqlError::Connection)); + TQSqlError::Connection)); d->access = 0; setOpen(false); setOpenError(false); } } -QSqlQuery QSQLite3Driver::createQuery() const +TQSqlQuery TQSQLite3Driver::createQuery() const { - return QSqlQuery(new QSQLite3Result(this)); + return TQSqlQuery(new TQSQLite3Result(this)); } -bool QSQLite3Driver::beginTransaction() +bool TQSQLite3Driver::beginTransaction() { if (!isOpen() || isOpenError()) return false; - QSqlQuery q(createQuery()); + TQSqlQuery q(createQuery()); if (!q.exec("BEGIN")) { - setLastError(QSqlError("Unable to begin transaction", - q.lastError().databaseText(), QSqlError::Transaction)); + setLastError(TQSqlError("Unable to begin transaction", + q.lastError().databaseText(), TQSqlError::Transaction)); return false; } return true; } -bool QSQLite3Driver::commitTransaction() +bool TQSQLite3Driver::commitTransaction() { if (!isOpen() || isOpenError()) return false; - QSqlQuery q(createQuery()); + TQSqlQuery q(createQuery()); if (!q.exec("COMMIT")) { - setLastError(QSqlError("Unable to begin transaction", - q.lastError().databaseText(), QSqlError::Transaction)); + setLastError(TQSqlError("Unable to begin transaction", + q.lastError().databaseText(), TQSqlError::Transaction)); return false; } return true; } -bool QSQLite3Driver::rollbackTransaction() +bool TQSQLite3Driver::rollbackTransaction() { if (!isOpen() || isOpenError()) return false; - QSqlQuery q(createQuery()); + TQSqlQuery q(createQuery()); if (!q.exec("ROLLBACK")) { - setLastError(QSqlError("Unable to begin transaction", - q.lastError().databaseText(), QSqlError::Transaction)); + setLastError(TQSqlError("Unable to begin transaction", + q.lastError().databaseText(), TQSqlError::Transaction)); return false; } return true; } -QStringList QSQLite3Driver::tables(const QString &typeName) const +TQStringList TQSQLite3Driver::tables(const TQString &typeName) const { - QStringList res; + TQStringList res; if (!isOpen()) return res; int type = typeName.toInt(); - QSqlQuery q = createQuery(); + TQSqlQuery q = createQuery(); q.setForwardOnly(TRUE); -#if (QT_VERSION-0 >= 0x030200) - if ((type & (int)QSql::Tables) && (type & (int)QSql::Views)) + if ((type & (int)TQSql::Tables) && (type & (int)TQSql::Views)) q.exec("SELECT name FROM sqlite_master WHERE type='table' OR type='view'"); - else if (typeName.isEmpty() || (type & (int)QSql::Tables)) + else if (typeName.isEmpty() || (type & (int)TQSql::Tables)) q.exec("SELECT name FROM sqlite_master WHERE type='table'"); - else if (type & (int)QSql::Views) + else if (type & (int)TQSql::Views) q.exec("SELECT name FROM sqlite_master WHERE type='view'"); -#else - q.exec("SELECT name FROM sqlite_master WHERE type='table' OR type='view'"); -#endif if (q.isActive()) { @@ -403,28 +392,26 @@ QStringList QSQLite3Driver::tables(const QString &typeName) const res.append(q.value(0).toString()); } -#if (QT_VERSION-0 >= 0x030200) - if (type & (int)QSql::SystemTables) { + if (type & (int)TQSql::SystemTables) { // there are no internal tables beside this one: res.append("sqlite_master"); } -#endif return res; } -QSqlIndex QSQLite3Driver::primaryIndex(const QString &tblname) const +TQSqlIndex TQSQLite3Driver::primaryIndex(const TQString &tblname) const { - QSqlRecordInfo rec(recordInfo(tblname)); // expensive :( + TQSqlRecordInfo rec(recordInfo(tblname)); // expensive :( if (!isOpen()) - return QSqlIndex(); + return TQSqlIndex(); - QSqlQuery q = createQuery(); + TQSqlQuery q = createQuery(); q.setForwardOnly(TRUE); - // finrst find a UNIQUE INDEX + // finrst find a UNITQUE INDEX q.exec("PRAGMA index_list('" + tblname + "');"); - QString indexname; + TQString indexname; while(q.next()) { if (q.value(2).toInt()==1) { indexname = q.value(1).toString(); @@ -432,54 +419,54 @@ QSqlIndex QSQLite3Driver::primaryIndex(const QString &tblname) const } } if (indexname.isEmpty()) - return QSqlIndex(); + return TQSqlIndex(); q.exec("PRAGMA index_info('" + indexname + "');"); - QSqlIndex index(indexname); + TQSqlIndex index(indexname); while(q.next()) { - QString name = q.value(2).toString(); - QSqlVariant::Type type = QSqlVariant::Invalid; - if (rec.contains(name)) - type = rec.find(name).type(); - index.append(QSqlField(name, type)); + TQString name = q.value(2).toString(); + TQSqlVariant::Type type = TQSqlVariant::Invalid; + if (rec.tqcontains(name)) + type = rec.tqfind(name).type(); + index.append(TQSqlField(name, type)); } return index; } -QSqlRecordInfo QSQLite3Driver::recordInfo(const QString &tbl) const +TQSqlRecordInfo TQSQLite3Driver::recordInfo(const TQString &tbl) const { if (!isOpen()) - return QSqlRecordInfo(); + return TQSqlRecordInfo(); - QSqlQuery q = createQuery(); + TQSqlQuery q = createQuery(); q.setForwardOnly(TRUE); q.exec("SELECT * FROM " + tbl + " LIMIT 1"); return recordInfo(q); } -QSqlRecord QSQLite3Driver::record(const QString &tblname) const +TQSqlRecord TQSQLite3Driver::record(const TQString &tblname) const { if (!isOpen()) - return QSqlRecord(); + return TQSqlRecord(); return recordInfo(tblname).toRecord(); } -QSqlRecord QSQLite3Driver::record(const QSqlQuery& query) const +TQSqlRecord TQSQLite3Driver::record(const TQSqlQuery& query) const { if (query.isActive() && query.driver() == this) { - QSQLite3Result* result = (QSQLite3Result*)query.result(); + TQSQLite3Result* result = (TQSQLite3Result*)query.result(); return result->d->rInf; } - return QSqlRecord(); + return TQSqlRecord(); } -QSqlRecordInfo QSQLite3Driver::recordInfo(const QSqlQuery& query) const +TQSqlRecordInfo TQSQLite3Driver::recordInfo(const TQSqlQuery& query) const { if (query.isActive() && query.driver() == this) { - QSQLite3Result* result = (QSQLite3Result*)query.result(); - return QSqlRecordInfo(result->d->rInf); + TQSQLite3Result* result = (TQSQLite3Result*)query.result(); + return TQSqlRecordInfo(result->d->rInf); } - return QSqlRecordInfo(); + return TQSqlRecordInfo(); } diff --git a/src/svnqt/cache/sqlite3/qsql_sqlite3.h b/src/svnqt/cache/sqlite3/qsql_sqlite3.h index f89c038..85cc22f 100644 --- a/src/svnqt/cache/sqlite3/qsql_sqlite3.h +++ b/src/svnqt/cache/sqlite3/qsql_sqlite3.h @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Definition of SQLite driver classes. +** Definition of STQLite driver classes. ** ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. ** -** This file is part of the sql module of the Qt GUI Toolkit. +** This file is part of the sql module of the TQt GUI Toolkit. ** EDITIONS: FREE, ENTERPRISE ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE @@ -12,79 +12,77 @@ ** ****************************************************************************/ -#ifndef QSQL_SQLITE3_H -#define QSQL_SQLITE3_H +#ifndef TQSQL_STQLITE3_H +#define TQSQL_STQLITE3_H -#include <qsqldriver.h> -#include <qsqlresult.h> -#include <qsqlrecord.h> -#include <qsqlindex.h> +#include <tqsqldriver.h> +#include <tqsqlresult.h> +#include <tqsqlrecord.h> +#include <tqsqlindex.h> #include "qsqlcachedresult.h" -#if (QT_VERSION-0 >= 0x030200) -typedef QVariant QSqlVariant; -#endif +typedef TQVariant TQSqlVariant; -#if defined (Q_OS_WIN32) -# include <qt_windows.h> +#if defined (TQ_OS_WIN32) +# include <tqt_windows.h> #endif -class QSQLite3DriverPrivate; -class QSQLite3ResultPrivate; -class QSQLite3Driver; +class TQSQLite3DriverPrivate; +class TQSQLite3ResultPrivate; +class TQSQLite3Driver; struct sqlite3; -class QSQLite3Result : public QSqlCachedResult +class TQSQLite3Result : public TQSqlCachedResult { - friend class QSQLite3Driver; - friend class QSQLite3ResultPrivate; + friend class TQSQLite3Driver; + friend class TQSQLite3ResultPrivate; public: - QSQLite3Result(const QSQLite3Driver* db); - ~QSQLite3Result(); + TQSQLite3Result(const TQSQLite3Driver* db); + ~TQSQLite3Result(); protected: - bool gotoNext(QSqlCachedResult::ValueCache& row, int idx); - bool reset (const QString& query); + bool gotoNext(TQSqlCachedResult::ValueCache& row, int idx); + bool reset (const TQString& query); int size(); int numRowsAffected(); private: - QSQLite3ResultPrivate* d; + TQSQLite3ResultPrivate* d; }; -class QSQLite3Driver : public QSqlDriver +class TQSQLite3Driver : public TQSqlDriver { - friend class QSQLite3Result; + friend class TQSQLite3Result; public: - QSQLite3Driver(QObject *parent = 0, const char *name = 0); - QSQLite3Driver(sqlite3 *connection, QObject *parent = 0, const char *name = 0); - ~QSQLite3Driver(); + TQSQLite3Driver(TQObject *tqparent = 0, const char *name = 0); + TQSQLite3Driver(sqlite3 *connection, TQObject *tqparent = 0, const char *name = 0); + ~TQSQLite3Driver(); bool hasFeature(DriverFeature f) const; - bool open(const QString & db, - const QString & user, - const QString & password, - const QString & host, + bool open(const TQString & db, + const TQString & user, + const TQString & password, + const TQString & host, int port, - const QString & connOpts); - bool open( const QString & db, - const QString & user, - const QString & password, - const QString & host, - int port ) { return open (db, user, password, host, port, QString()); } + const TQString & connOpts); + bool open( const TQString & db, + const TQString & user, + const TQString & password, + const TQString & host, + int port ) { return open (db, user, password, host, port, TQString()); } void close(); - QSqlQuery createQuery() const; + TQSqlQuery createQuery() const; bool beginTransaction(); bool commitTransaction(); bool rollbackTransaction(); - QStringList tables(const QString &user) const; + TQStringList tables(const TQString &user) const; - QSqlRecord record(const QString& tablename) const; - QSqlRecordInfo recordInfo(const QString& tablename) const; - QSqlIndex primaryIndex(const QString &table) const; - QSqlRecord record(const QSqlQuery& query) const; - QSqlRecordInfo recordInfo(const QSqlQuery& query) const; + TQSqlRecord record(const TQString& tablename) const; + TQSqlRecordInfo recordInfo(const TQString& tablename) const; + TQSqlIndex primaryIndex(const TQString &table) const; + TQSqlRecord record(const TQSqlQuery& query) const; + TQSqlRecordInfo recordInfo(const TQSqlQuery& query) const; private: - QSQLite3DriverPrivate* d; + TQSQLite3DriverPrivate* d; }; #endif diff --git a/src/svnqt/cache/sqlite3/qsqlcachedresult.cpp b/src/svnqt/cache/sqlite3/qsqlcachedresult.cpp index 8a23183..708434a 100644 --- a/src/svnqt/cache/sqlite3/qsqlcachedresult.cpp +++ b/src/svnqt/cache/sqlite3/qsqlcachedresult.cpp @@ -2,11 +2,11 @@ ** ** Copyright (C) 1992-2005 Trolltech AS. All rights reserved. ** -** This file is part of the sql module of the Qt Toolkit. +** This file is part of the sql module of the TQt Toolkit. ** ** This file may be distributed under the terms of the Q Public License ** as defined by Trolltech AS of Norway and appearing in the file -** LICENSE.QPL included in the packaging of this file. +** LICENSE.TQPL included in the packaging of this file. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software @@ -14,8 +14,8 @@ ** packaging of this file. ** ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for -** information about Qt Commercial License Agreements. -** See http://www.trolltech.com/qpl/ for QPL licensing information. +** information about TQt Commercial License Agreements. +** See http://www.trolltech.com/qpl/ for TQPL licensing information. ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are @@ -28,16 +28,16 @@ #include "qsqlcachedresult.h" -#include <qvariant.h> -#include <qdatetime.h> -#include <qvaluevector.h> +#include <tqvariant.h> +#include <tqdatetime.h> +#include <tqvaluevector.h> static const uint initial_cache_size = 128; -class QSqlCachedResultPrivate +class TQSqlCachedResultPrivate { public: - QSqlCachedResultPrivate(); + TQSqlCachedResultPrivate(); bool canSeek(int i) const; inline int cacheCount() const; void init(int count, bool fo); @@ -45,18 +45,18 @@ public: int nextIndex(); void revertLast(); - QSqlCachedResult::ValueCache cache; + TQSqlCachedResult::ValueCache cache; int rowCacheEnd; int colCount; bool forwardOnly; }; -QSqlCachedResultPrivate::QSqlCachedResultPrivate(): +TQSqlCachedResultPrivate::TQSqlCachedResultPrivate(): rowCacheEnd(0), colCount(0), forwardOnly(false) { } -void QSqlCachedResultPrivate::cleanup() +void TQSqlCachedResultPrivate::cleanup() { cache.clear(); forwardOnly = false; @@ -64,7 +64,7 @@ void QSqlCachedResultPrivate::cleanup() rowCacheEnd = 0; } -void QSqlCachedResultPrivate::init(int count, bool fo) +void TQSqlCachedResultPrivate::init(int count, bool fo) { Q_ASSERT(count); cleanup(); @@ -78,7 +78,7 @@ void QSqlCachedResultPrivate::init(int count, bool fo) } } -int QSqlCachedResultPrivate::nextIndex() +int TQSqlCachedResultPrivate::nextIndex() { if (forwardOnly) return 0; @@ -96,21 +96,21 @@ int QSqlCachedResultPrivate::nextIndex() return newIdx; } -bool QSqlCachedResultPrivate::canSeek(int i) const +bool TQSqlCachedResultPrivate::canSeek(int i) const { if (forwardOnly || i < 0) return false; return rowCacheEnd >= (i + 1) * colCount; } -void QSqlCachedResultPrivate::revertLast() +void TQSqlCachedResultPrivate::revertLast() { if (forwardOnly) return; rowCacheEnd -= colCount; } -inline int QSqlCachedResultPrivate::cacheCount() const +inline int TQSqlCachedResultPrivate::cacheCount() const { Q_ASSERT(!forwardOnly); Q_ASSERT(colCount); @@ -119,22 +119,22 @@ inline int QSqlCachedResultPrivate::cacheCount() const ////////////// -QSqlCachedResult::QSqlCachedResult(const QSqlDriver * db): QSqlResult (db) +TQSqlCachedResult::TQSqlCachedResult(const TQSqlDriver * db): TQSqlResult (db) { - d = new QSqlCachedResultPrivate(); + d = new TQSqlCachedResultPrivate(); } -QSqlCachedResult::~QSqlCachedResult() +TQSqlCachedResult::~TQSqlCachedResult() { delete d; } -void QSqlCachedResult::init(int colCount) +void TQSqlCachedResult::init(int colCount) { d->init(colCount, isForwardOnly()); } -bool QSqlCachedResult::fetch(int i) +bool TQSqlCachedResult::fetch(int i) { if ((!isActive()) || (i < 0)) return false; @@ -142,7 +142,7 @@ bool QSqlCachedResult::fetch(int i) return true; if (d->forwardOnly) { // speed hack - do not copy values if not needed - if (at() > i || at() == QSql::AfterLast) + if (at() > i || at() == TQSql::AfterLast) return false; while(at() < i - 1) { if (!gotoNext(d->cache, -1)) @@ -167,7 +167,7 @@ bool QSqlCachedResult::fetch(int i) return true; } -bool QSqlCachedResult::fetchNext() +bool TQSqlCachedResult::fetchNext() { if (d->canSeek(at() + 1)) { setAt(at() + 1); @@ -176,14 +176,14 @@ bool QSqlCachedResult::fetchNext() return cacheNext(); } -bool QSqlCachedResult::fetchPrevious() +bool TQSqlCachedResult::fetchPrevious() { return fetch(at() - 1); } -bool QSqlCachedResult::fetchFirst() +bool TQSqlCachedResult::fetchFirst() { - if (d->forwardOnly && at() != QSql::BeforeFirst) { + if (d->forwardOnly && at() != TQSql::BeforeFirst) { return false; } if (d->canSeek(0)) { @@ -193,9 +193,9 @@ bool QSqlCachedResult::fetchFirst() return cacheNext(); } -bool QSqlCachedResult::fetchLast() +bool TQSqlCachedResult::fetchLast() { - if (at() == QSql::AfterLast) { + if (at() == TQSql::AfterLast) { if (d->forwardOnly) return false; else @@ -205,7 +205,7 @@ bool QSqlCachedResult::fetchLast() int i = at(); while (fetchNext()) ++i; /* brute force */ - if (d->forwardOnly && at() == QSql::AfterLast) { + if (d->forwardOnly && at() == TQSql::AfterLast) { setAt(i); return true; } else { @@ -213,16 +213,16 @@ bool QSqlCachedResult::fetchLast() } } -QVariant QSqlCachedResult::data(int i) +TQVariant TQSqlCachedResult::data(int i) { int idx = d->forwardOnly ? i : at() * d->colCount + i; if (i >= d->colCount || i < 0 || at() < 0 || idx >= d->rowCacheEnd) - return QVariant(); + return TQVariant(); return d->cache.at(idx); } -bool QSqlCachedResult::isNull(int i) +bool TQSqlCachedResult::isNull(int i) { int idx = d->forwardOnly ? i : at() * d->colCount + i; if (i > d->colCount || i < 0 || at() < 0 || idx >= d->rowCacheEnd) @@ -231,14 +231,14 @@ bool QSqlCachedResult::isNull(int i) return d->cache.at(idx).isNull(); } -void QSqlCachedResult::cleanup() +void TQSqlCachedResult::cleanup() { - setAt(QSql::BeforeFirst); + setAt(TQSql::BeforeFirst); setActive(false); d->cleanup(); } -bool QSqlCachedResult::cacheNext() +bool TQSqlCachedResult::cacheNext() { if (!gotoNext(d->cache, d->nextIndex())) { d->revertLast(); @@ -248,12 +248,12 @@ bool QSqlCachedResult::cacheNext() return true; } -int QSqlCachedResult::colCount() const +int TQSqlCachedResult::colCount() const { return d->colCount; } -QSqlCachedResult::ValueCache &QSqlCachedResult::cache() +TQSqlCachedResult::ValueCache &TQSqlCachedResult::cache() { return d->cache; } diff --git a/src/svnqt/cache/sqlite3/qsqlcachedresult.h b/src/svnqt/cache/sqlite3/qsqlcachedresult.h index fa8924f..8615428 100644 --- a/src/svnqt/cache/sqlite3/qsqlcachedresult.h +++ b/src/svnqt/cache/sqlite3/qsqlcachedresult.h @@ -2,11 +2,11 @@ ** ** Copyright (C) 1992-2005 Trolltech AS. All rights reserved. ** -** This file is part of the sql module of the Qt Toolkit. +** This file is part of the sql module of the TQt Toolkit. ** ** This file may be distributed under the terms of the Q Public License ** as defined by Trolltech AS of Norway and appearing in the file -** LICENSE.QPL included in the packaging of this file. +** LICENSE.TQPL included in the packaging of this file. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software @@ -14,8 +14,8 @@ ** packaging of this file. ** ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for -** information about Qt Commercial License Agreements. -** See http://www.trolltech.com/qpl/ for QPL licensing information. +** information about TQt Commercial License Agreements. +** See http://www.trolltech.com/qpl/ for TQPL licensing information. ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are @@ -26,43 +26,43 @@ ** ****************************************************************************/ -#ifndef QSQLCACHEDRESULT_P_H -#define QSQLCACHEDRESULT_P_H +#ifndef TQSQLCACHEDRESULT_P_H +#define TQSQLCACHEDRESULT_P_H // // W A R N I N G // ------------- // -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to +// This file is not part of the TQt API. It exists for the convenience +// of other TQt classes. This header file may change from version to // version without notice, or even be removed. // // We mean it. // -#include <qsqlresult.h> +#include <tqsqlresult.h> -class QVariant; -template <typename T> class QValueVector; +class TQVariant; +template <typename T> class TQValueVector; -class QSqlCachedResultPrivate; +class TQSqlCachedResultPrivate; -class QM_EXPORT_SQL QSqlCachedResult: public QSqlResult +class TQM_EXPORT_SQL TQSqlCachedResult: public TQSqlResult { public: - virtual ~QSqlCachedResult(); + virtual ~TQSqlCachedResult(); - typedef QValueVector<QVariant> ValueCache; + typedef TQValueVector<TQVariant> ValueCache; protected: - QSqlCachedResult(const QSqlDriver * db); + TQSqlCachedResult(const TQSqlDriver * db); void init(int colCount); void cleanup(); virtual bool gotoNext(ValueCache &values, int index) = 0; - QVariant data(int i); + TQVariant data(int i); bool isNull(int i); bool fetch(int i); bool fetchNext(); @@ -75,7 +75,7 @@ protected: private: bool cacheNext(); - QSqlCachedResultPrivate *d; + TQSqlCachedResultPrivate *d; }; -#endif // QSQLCACHEDRESULT_P_H +#endif // TQSQLCACHEDRESULT_P_H diff --git a/src/svnqt/cache/test/sqlite.cpp b/src/svnqt/cache/test/sqlite.cpp index 4f14b2d..979ca59 100644 --- a/src/svnqt/cache/test/sqlite.cpp +++ b/src/svnqt/cache/test/sqlite.cpp @@ -1,9 +1,9 @@ -#include <qsql.h> -#include <qsqldatabase.h> -#include <qstringlist.h> +#include <tqsql.h> +#include <tqsqldatabase.h> +#include <tqstringlist.h> #include <iostream> -#include <qapplication.h> -#include <qtextstream.h> +#include <tqapplication.h> +#include <tqtextstream.h> #include "svnqt/client.hpp" #include "svnqt/svnqttypes.hpp" @@ -14,15 +14,15 @@ #include "svnqt/cache/test/testconfig.h" #include "svnqt/cache/DatabaseException.hpp" -#if QT_VERSION < 0x040000 +#if [[[TQT_VERSION IS DEPRECATED]]] < 0x040000 #else -#include <QSqlQuery> -#include <QSqlError> +#include <TQSqlQuery> +#include <TQSqlError> #endif int main(int argc,char**argv) { - QApplication app(argc,argv); + TQApplication app(argc,argv); svn::ContextP m_CurrentContext; svn::Client* m_Svnclient; @@ -31,19 +31,19 @@ int main(int argc,char**argv) m_Svnclient->setContext(m_CurrentContext); - QStringList list; - QStringList::Iterator it; + TQStringList list; + TQStringList::Iterator it; // goes into "self" of logcache new svn::cache::LogCache(TESTDBPATH); - list = QSqlDatabase::drivers(); + list = TQSqlDatabase::drivers(); it = list.begin(); while( it != list.end() ) { std::cout << (*it).TOUTF8().data() << std::endl; ++it; } svn::cache::ReposLog rl(m_Svnclient,"http://www.alwins-world.de/repos/kdesvn"); - QDataBase db = rl.Database(); -#if QT_VERSION < 0x040000 + TQDataBase db = rl.Database(); +#if [[[TQT_VERSION IS DEPRECATED]]] < 0x040000 if (!db) { #else if (!db.isValid()) { @@ -51,7 +51,7 @@ int main(int argc,char**argv) std::cerr << "No database object."<<std::endl; exit(-1); } -#if QT_VERSION < 0x040000 +#if [[[TQT_VERSION IS DEPRECATED]]] < 0x040000 list = db->tables(); #else list = db.tables(); @@ -87,13 +87,13 @@ int main(int argc,char**argv) { std::cerr << cl.msg().TOUTF8().data() << std::endl; } - QSqlQuery q("insert into logentries(revision,date,author,message) values ('100','1122591406','alwin','copy and moving works now in basic form')",db); + TQSqlQuery q("insert into logentries(revision,date,author,message) values ('100','1122591406','alwin','copy and moving works now in basic form')",db); q.exec(); std::cerr << "\n" << q.lastError().text().TOUTF8().data()<<std::endl; -#if QT_VERSION < 0x040000 +#if [[[TQT_VERSION IS DEPRECATED]]] < 0x040000 #else - db=QSqlDatabase(); + db=TQSqlDatabase(); #endif try { rl.log("/trunk/src/svnqt",1,1000,svn::Revision::UNDEFINED,lm,false,-1); |