summaryrefslogtreecommitdiffstats
path: root/src/svnqt/cache/sqlite3/qsqlcachedresult.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-05-04 19:54:24 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-05-04 19:54:24 +0000
commitd7633c195a464e4d344ada9eea61afd10110598a (patch)
tree1f2da0b135f3ed84955e340cae823f00c4ce7284 /src/svnqt/cache/sqlite3/qsqlcachedresult.cpp
parent3fa7eb804f67b2789f128075cc2522f398640250 (diff)
downloadtdesvn-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/sqlite3/qsqlcachedresult.cpp')
-rw-r--r--src/svnqt/cache/sqlite3/qsqlcachedresult.cpp76
1 files changed, 38 insertions, 38 deletions
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;
}