summaryrefslogtreecommitdiffstats
path: root/kexi/kexidb/drivers/sqlite/sqlitecursor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kexi/kexidb/drivers/sqlite/sqlitecursor.cpp')
-rw-r--r--kexi/kexidb/drivers/sqlite/sqlitecursor.cpp116
1 files changed, 58 insertions, 58 deletions
diff --git a/kexi/kexidb/drivers/sqlite/sqlitecursor.cpp b/kexi/kexidb/drivers/sqlite/sqlitecursor.cpp
index 4b18b437..5239127c 100644
--- a/kexi/kexidb/drivers/sqlite/sqlitecursor.cpp
+++ b/kexi/kexidb/drivers/sqlite/sqlitecursor.cpp
@@ -33,13 +33,13 @@
#include <kdebug.h>
#include <klocale.h>
-#include <qptrvector.h>
-#include <qdatetime.h>
+#include <tqptrvector.h>
+#include <tqdatetime.h>
using namespace KexiDB;
//! safer interpretations of boolean values for SQLite
-static bool sqliteStringToBool(const QString& s)
+static bool sqliteStringToBool(const TQString& s)
{
return s.lower()=="yes" || (s.lower()!="no" && s!="0");
}
@@ -84,7 +84,7 @@ class KexiDB::SQLiteCursorData : public SQLiteConnectionInternal
}
#endif*/
- QCString st;
+ TQCString st;
//for sqlite:
// sqlite_struct *data; //! taken from SQLiteConnection
#ifdef SQLITE2
@@ -95,7 +95,7 @@ class KexiDB::SQLiteCursorData : public SQLiteConnectionInternal
char *utail;
-// QString errmsg; //<! server-specific message of last operation
+// TQString errmsg; //<! server-specific message of last operation
// char *errmsg_p; //<! temporary: server-specific message of last operation
// int res; //<! result code of last operation on server
@@ -112,7 +112,7 @@ class KexiDB::SQLiteCursorData : public SQLiteConnectionInternal
uint cols_pointers_mem_size; //! size of record's array of pointers to values
int records_in_buf; //! number of records currently stored in the buffer
bool buffering_completed; //! true if we have already all records stored in the buffer
- QPtrVector<const char*> records; //buffer data
+ TQPtrVector<const char*> records; //buffer data
bool at_buffer; //! true if we already point to the buffer with curr_coldata
*/
@@ -121,39 +121,39 @@ class KexiDB::SQLiteCursorData : public SQLiteConnectionInternal
const char **prev_colname;*/
uint cols_pointers_mem_size; //! size of record's array of pointers to values
- QPtrVector<const char*> records;//! buffer data
+ TQPtrVector<const char*> records;//! buffer data
//#ifdef SQLITE3
// bool rowDataReadyToFetch : 1;
//#endif
#ifdef SQLITE3
- inline QVariant getValue(Field *f, int i)
+ inline TQVariant getValue(Field *f, int i)
{
int type = sqlite3_column_type(prepared_st_handle, i);
if (type==SQLITE_NULL) {
- return QVariant();
+ return TQVariant();
}
else if (!f || type==SQLITE_TEXT) {
//TODO: support for UTF-16
-#define GET_sqlite3_column_text QString::fromUtf8( (const char*)sqlite3_column_text(prepared_st_handle, i) )
+#define GET_sqlite3_column_text TQString::fromUtf8( (const char*)sqlite3_column_text(prepared_st_handle, i) )
if (!f || f->isTextType())
return GET_sqlite3_column_text;
else {
switch (f->type()) {
case Field::Date:
- return QDate::fromString( GET_sqlite3_column_text, Qt::ISODate );
+ return TQDate::fromString( GET_sqlite3_column_text, Qt::ISODate );
case Field::Time:
- //QDateTime - a hack needed because QVariant(QTime) has broken isNull()
- return KexiUtils::stringToHackedQTime(GET_sqlite3_column_text);
+ //TQDateTime - a hack needed because TQVariant(TQTime) has broken isNull()
+ return KexiUtils::stringToHackedTQTime(GET_sqlite3_column_text);
case Field::DateTime: {
- QString tmp( GET_sqlite3_column_text );
+ TQString tmp( GET_sqlite3_column_text );
tmp[10] = 'T'; //for ISODate compatibility
- return QDateTime::fromString( tmp, Qt::ISODate );
+ return TQDateTime::fromString( tmp, Qt::ISODate );
}
case Field::Boolean:
- return QVariant(sqliteStringToBool(GET_sqlite3_column_text), 1);
+ return TQVariant(sqliteStringToBool(GET_sqlite3_column_text), 1);
default:
- return QVariant(); //TODO
+ return TQVariant(); //TODO
}
}
}
@@ -162,42 +162,42 @@ class KexiDB::SQLiteCursorData : public SQLiteConnectionInternal
case Field::Byte:
case Field::ShortInteger:
case Field::Integer:
- return QVariant( sqlite3_column_int(prepared_st_handle, i) );
+ return TQVariant( sqlite3_column_int(prepared_st_handle, i) );
case Field::BigInteger:
- return QVariant( (Q_LLONG)sqlite3_column_int64(prepared_st_handle, i) );
+ return TQVariant( (TQ_LLONG)sqlite3_column_int64(prepared_st_handle, i) );
case Field::Boolean:
- return QVariant( sqlite3_column_int(prepared_st_handle, i)!=0, 1 );
+ return TQVariant( sqlite3_column_int(prepared_st_handle, i)!=0, 1 );
default:;
}
if (f->isFPNumericType()) //WEIRD, YEAH?
- return QVariant( (double)sqlite3_column_int(prepared_st_handle, i) );
+ return TQVariant( (double)sqlite3_column_int(prepared_st_handle, i) );
else
- return QVariant(); //TODO
+ return TQVariant(); //TODO
}
else if (type==SQLITE_FLOAT) {
if (f && f->isFPNumericType())
- return QVariant( sqlite3_column_double(prepared_st_handle, i) );
+ return TQVariant( sqlite3_column_double(prepared_st_handle, i) );
else if (!f || f->isIntegerType())
- return QVariant( (double)sqlite3_column_double(prepared_st_handle, i) );
+ return TQVariant( (double)sqlite3_column_double(prepared_st_handle, i) );
else
- return QVariant(); //TODO
+ return TQVariant(); //TODO
}
else if (type==SQLITE_BLOB) {
if (f && f->type()==Field::BLOB) {
- QByteArray ba;
+ TQByteArray ba;
//! @todo efficient enough?
ba.duplicate((const char*)sqlite3_column_blob(prepared_st_handle, i),
sqlite3_column_bytes(prepared_st_handle, i));
return ba;
} else
- return QVariant(); //TODO
+ return TQVariant(); //TODO
}
- return QVariant();
+ return TQVariant();
}
#endif //SQLITE3
};
-SQLiteCursor::SQLiteCursor(Connection* conn, const QString& statement, uint options)
+SQLiteCursor::SQLiteCursor(Connection* conn, const TQString& statement, uint options)
: Cursor( conn, statement, options )
, d( new SQLiteCursorData(conn) )
{
@@ -328,7 +328,7 @@ void SQLiteCursor::drv_getNextRecord()
if (m_result == FetchOK && d->curr_coldata) {
for (uint i=0;i<m_fieldCount;i++) {
KexiDBDrvDbg<<"col."<< i<<": "<< d->curr_colname[i]<<" "<< d->curr_colname[m_fieldCount+i]
- << " = " << (d->curr_coldata[i] ? QString::fromLocal8Bit(d->curr_coldata[i]) : "(NULL)") <<endl;
+ << " = " << (d->curr_coldata[i] ? TQString::fromLocal8Bit(d->curr_coldata[i]) : "(NULL)") <<endl;
}
// KexiDBDrvDbg << "SQLiteCursor::drv_getNextRecord(): "<<m_fieldCount<<" col(s) fetched"<<endl;
}*/
@@ -363,7 +363,7 @@ void SQLiteCursor::drv_bufferMovePointerPrev()
//compute a place in the buffer that contain next record's data
//and move internal buffer pointer to that place
-void SQLiteCursor::drv_bufferMovePointerTo(Q_LLONG at)
+void SQLiteCursor::drv_bufferMovePointerTo(TQ_LLONG at)
{
d->curr_coldata = d->records.at(at);
}
@@ -432,17 +432,17 @@ void SQLiteCursor::storeCurrentRow(RowData &data) const
if (!m_fieldsExpanded) {//simple version: without types
for( uint i=0; i<m_fieldCount; i++ ) {
#ifdef SQLITE2
- data[i] = QVariant( *col );
+ data[i] = TQVariant( *col );
col++;
#else //SQLITE3
- data[i] = QString::fromUtf8( (const char*)sqlite3_column_text(d->prepared_st_handle, i) );
+ data[i] = TQString::fromUtf8( (const char*)sqlite3_column_text(d->prepared_st_handle, i) );
#endif
}
return;
}
//const uint fieldsExpandedCount = m_fieldsExpanded->count();
- const uint maxCount = QMIN(m_fieldCount, m_fieldsExpanded->count());
+ const uint maxCount = TQMIN(m_fieldCount, m_fieldsExpanded->count());
// i - visible field's index, j - physical index
for( uint i=0, j=0; i<m_fieldCount; i++, j++ ) {
// while (j < m_detailedVisibility.count() && !m_detailedVisibility[j]) //!m_query->isColumnVisible(j))
@@ -459,42 +459,42 @@ void SQLiteCursor::storeCurrentRow(RowData &data) const
#ifdef SQLITE2
if (!*col)
- data[i] = QVariant();
+ data[i] = TQVariant();
else if (f && f->isTextType())
# ifdef SQLITE_UTF8
- data[i] = QString::fromUtf8( *col );
+ data[i] = TQString::fromUtf8( *col );
# else
- data[i] = QVariant( *col ); //only latin1
+ data[i] = TQVariant( *col ); //only latin1
# endif
else if (f && f->isFPNumericType())
- data[i] = QVariant( QCString(*col).toDouble() );
+ data[i] = TQVariant( TQCString(*col).toDouble() );
else {
switch (f ? f->type() : Field::Integer/*ROWINFO*/) {
//todo: use short, etc.
case Field::Byte:
case Field::ShortInteger:
case Field::Integer:
- data[i] = QVariant( QCString(*col).toInt() );
+ data[i] = TQVariant( TQCString(*col).toInt() );
case Field::BigInteger:
- data[i] = QVariant( QString::fromLatin1(*col).toLongLong() );
+ data[i] = TQVariant( TQString::tqfromLatin1(*col).toLongLong() );
case Field::Boolean:
- data[i] = QVariant( sqliteStringToBool(QString::fromLatin1(*col)), 1 );
+ data[i] = TQVariant( sqliteStringToBool(TQString::tqfromLatin1(*col)), 1 );
break;
case Field::Date:
- data[i] = QDate::fromString( QString::fromLatin1(*col), Qt::ISODate );
+ data[i] = TQDate::fromString( TQString::tqfromLatin1(*col), Qt::ISODate );
break;
case Field::Time:
- //QDateTime - a hack needed because QVariant(QTime) has broken isNull()
- data[i] = KexiUtils::stringToHackedQTime(QString::fromLatin1(*col));
+ //TQDateTime - a hack needed because TQVariant(TQTime) has broken isNull()
+ data[i] = KexiUtils::stringToHackedTQTime(TQString::tqfromLatin1(*col));
break;
case Field::DateTime: {
- QString tmp( QString::fromLatin1(*col) );
+ TQString tmp( TQString::tqfromLatin1(*col) );
tmp[10] = 'T';
- data[i] = QDateTime::fromString( tmp, Qt::ISODate );
+ data[i] = TQDateTime::fromString( tmp, Qt::ISODate );
break;
}
default:
- data[i] = QVariant( *col );
+ data[i] = TQVariant( *col );
}
}
@@ -505,11 +505,11 @@ void SQLiteCursor::storeCurrentRow(RowData &data) const
}
}
-QVariant SQLiteCursor::value(uint i)
+TQVariant SQLiteCursor::value(uint i)
{
// if (i > (m_fieldCount-1+(m_containsROWIDInfo?1:0))) //range checking
if (i > (m_fieldCount-1)) //range checking
- return QVariant();
+ return TQVariant();
//TODO: allow disable range checking! - performance reasons
// const KexiDB::Field *f = m_query ? m_query->field(i) : 0;
KexiDB::Field *f = (m_fieldsExpanded && i<m_fieldsExpanded->count())
@@ -518,13 +518,13 @@ QVariant SQLiteCursor::value(uint i)
//from most to least frequently used types:
//(m_logicalFieldCount introduced) if (i==m_fieldCount || f && f->isIntegerType())
if (!f || f->isIntegerType())
- return QVariant( QCString(d->curr_coldata[i]).toInt() );
+ return TQVariant( TQCString(d->curr_coldata[i]).toInt() );
else if (!f || f->isTextType())
- return QVariant( d->curr_coldata[i] );
+ return TQVariant( d->curr_coldata[i] );
else if (f->isFPNumericType())
- return QVariant( QCString(d->curr_coldata[i]).toDouble() );
+ return TQVariant( TQCString(d->curr_coldata[i]).toDouble() );
- return QVariant( d->curr_coldata[i] ); //default
+ return TQVariant( d->curr_coldata[i] ); //default
#else
return d->getValue(f, i); //, i==m_logicalFieldCount/*ROWID*/);
#endif
@@ -532,7 +532,7 @@ QVariant SQLiteCursor::value(uint i)
/*! Stores string value taken from field number \a i to \a str.
\return false when range checking failed.
-bool SQLiteCursor::storeStringValue(uint i, QString &str)
+bool SQLiteCursor::storeStringValue(uint i, TQString &str)
{
if (i > (m_fieldCount-1)) //range checking
return false;
@@ -545,16 +545,16 @@ int SQLiteCursor::serverResult()
return d->res;
}
-QString SQLiteCursor::serverResultName()
+TQString SQLiteCursor::serverResultName()
{
#ifdef SQLITE2
- return QString::fromLatin1( sqlite_error_string(d->res) );
+ return TQString::tqfromLatin1( sqlite_error_string(d->res) );
#else //SQLITE3
- return QString::fromLatin1( d->result_name );
+ return TQString::tqfromLatin1( d->result_name );
#endif
}
-QString SQLiteCursor::serverErrorMsg()
+TQString SQLiteCursor::serverErrorMsg()
{
return d->errmsg;
}