summaryrefslogtreecommitdiffstats
path: root/kexi/kexidb/connection.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-25 05:28:35 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-25 05:28:35 +0000
commitf008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch)
tree8e9244c4d4957c36be81e15b566b4aa5ea26c982 /kexi/kexidb/connection.cpp
parent1210f27b660efb7b37ff43ec68763e85a403471f (diff)
downloadkoffice-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/connection.cpp')
-rw-r--r--kexi/kexidb/connection.cpp788
1 files changed, 394 insertions, 394 deletions
diff --git a/kexi/kexidb/connection.cpp b/kexi/kexidb/connection.cpp
index 1a401a8a..830dee29 100644
--- a/kexi/kexidb/connection.cpp
+++ b/kexi/kexidb/connection.cpp
@@ -39,10 +39,10 @@
#include <kexiutils/utils.h>
#include <kexiutils/identifier.h>
-#include <qdir.h>
-#include <qfileinfo.h>
-#include <qguardedptr.h>
-#include <qdom.h>
+#include <tqdir.h>
+#include <tqfileinfo.h>
+#include <tqguardedptr.h>
+#include <tqdom.h>
#include <klocale.h>
#include <kdebug.h>
@@ -112,31 +112,31 @@ class ConnectionPrivate
delete m_parser;
}
- void errorInvalidDBContents(const QString& details) {
+ void errorInvalidDBContents(const TQString& details) {
conn->setError( ERR_INVALID_DATABASE_CONTENTS, i18n("Invalid database contents. ")+details);
}
- QString strItIsASystemObject() const {
+ TQString strItIsASystemObject() const {
return i18n("It is a system object.");
}
inline Parser *parser() { return m_parser ? m_parser : (m_parser = new Parser(conn)); }
Connection* const conn; //!< The \a Connection instance this \a ConnectionPrivate belongs to.
- QGuardedPtr<ConnectionData> conn_data; //!< the \a ConnectionData used within that connection.
+ TQGuardedPtr<ConnectionData> conn_data; //!< the \a ConnectionData used within that connection.
/*! Default transaction handle.
If transactions are supported: Any operation on database (e.g. inserts)
that is started without specifying transaction context, will be performed
in the context of this transaction. */
Transaction default_trans;
- QValueList<Transaction> transactions;
+ TQValueList<Transaction> transactions;
- QPtrDict< QPtrList<Connection::TableSchemaChangeListenerInterface> > tableSchemaChangeListeners;
+ TQPtrDict< TQPtrList<Connection::TableSchemaChangeListenerInterface> > tableSchemaChangeListeners;
- //! Used in Connection::setQuerySchemaObsolete( const QString& queryName )
+ //! Used in Connection::setQuerySchemaObsolete( const TQString& queryName )
//! to collect obsolete queries. THese are deleted on connection deleting.
- QPtrList<QuerySchema> obsoleteQueries;
+ TQPtrList<QuerySchema> obsoleteQueries;
//! server version information for this connection.
@@ -148,19 +148,19 @@ class ConnectionPrivate
Parser *m_parser;
//! Table schemas retrieved on demand with tableSchema()
- QIntDict<TableSchema> tables;
- QDict<TableSchema> tables_byname;
- QIntDict<QuerySchema> queries;
- QDict<QuerySchema> queries_byname;
+ TQIntDict<TableSchema> tables;
+ TQDict<TableSchema> tables_byname;
+ TQIntDict<QuerySchema> queries;
+ TQDict<QuerySchema> queries_byname;
//! used just for removing system TableSchema objects on db close.
- QPtrDict<TableSchema> kexiDBSystemTables;
+ TQPtrDict<TableSchema> kexiDBSystemTables;
//! Database properties
DatabaseProperties* dbProperties;
- QString availableDatabaseName; //!< used by anyAvailableDatabaseName()
- QString usedDatabase; //!< database name that is opened now (the currentDatabase() name)
+ TQString availableDatabaseName; //!< used by anyAvailableDatabaseName()
+ TQString usedDatabase; //!< database name that is opened now (the currentDatabase() name)
//! true if rollbackTransaction() and commitTransaction() shouldn't remove
//! the transaction object from 'transactions' list; used by closeDatabase()
@@ -194,10 +194,10 @@ class ConnectionPrivate
using namespace KexiDB;
//! static: list of internal KexiDB system table names
-QStringList KexiDB_kexiDBSystemTableNames;
+TQStringList KexiDB_kexiDBSystemTableNames;
Connection::Connection( Driver *driver, ConnectionData &conn_data )
- : QObject()
+ : TQObject()
,KexiDB::Object()
,d(new ConnectionPrivate(this, conn_data))
,m_driver(driver)
@@ -254,8 +254,8 @@ bool Connection::connect()
d->serverVersion.clear();
if (!(d->isConnected = drv_connect(d->serverVersion))) {
setError(m_driver->isFileDriver() ?
- i18n("Could not open \"%1\" project file.").arg(QDir::convertSeparators(d->conn_data->fileName()))
- : i18n("Could not connect to \"%1\" database server.").arg(d->conn_data->serverInfoString()) );
+ i18n("Could not open \"%1\" project file.").tqarg(TQDir::convertSeparators(d->conn_data->fileName()))
+ : i18n("Could not connect to \"%1\" database server.").tqarg(d->conn_data->serverInfoString()) );
}
return d->isConnected;
}
@@ -268,7 +268,7 @@ bool Connection::isDatabaseUsed() const
void Connection::clearError()
{
Object::clearError();
- m_sql = QString::null;
+ m_sql = TQString();
}
bool Connection::disconnect()
@@ -311,34 +311,34 @@ bool Connection::checkIsDatabaseUsed()
return false;
}
-QStringList Connection::databaseNames(bool also_system_db)
+TQStringList Connection::databaseNames(bool also_system_db)
{
KexiDBDbg << "Connection::databaseNames("<<also_system_db<<")"<< endl;
if (!checkConnected())
- return QStringList();
+ return TQStringList();
- QString tmpdbName;
+ TQString tmpdbName;
//some engines need to have opened any database before executing "create database"
if (!useTemporaryDatabaseIfNeeded(tmpdbName))
- return QStringList();
+ return TQStringList();
- QStringList list, non_system_list;
+ TQStringList list, non_system_list;
bool ret = drv_getDatabasesList( list );
if (!tmpdbName.isEmpty()) {
//whatever result is - now we have to close temporary opened database:
if (!closeDatabase())
- return QStringList();
+ return TQStringList();
}
if (!ret)
- return QStringList();
+ return TQStringList();
if (also_system_db)
return list;
//filter system databases:
- for (QStringList::ConstIterator it = list.constBegin(); it!=list.constEnd(); ++it) {
+ for (TQStringList::ConstIterator it = list.constBegin(); it!=list.constEnd(); ++it) {
KexiDBDbg << "Connection::databaseNames(): " << *it << endl;
if (!m_driver->isSystemDatabaseName(*it)) {
KexiDBDbg << "add " << *it << endl;
@@ -348,29 +348,29 @@ QStringList Connection::databaseNames(bool also_system_db)
return non_system_list;
}
-bool Connection::drv_getDatabasesList( QStringList &list )
+bool Connection::drv_getDatabasesList( TQStringList &list )
{
list.clear();
return true;
}
-bool Connection::drv_databaseExists( const QString &dbName, bool ignoreErrors )
+bool Connection::drv_databaseExists( const TQString &dbName, bool ignoreErrors )
{
- QStringList list = databaseNames(true);//also system
+ TQStringList list = databaseNames(true);//also system
if (error()) {
return false;
}
- if (list.find( dbName )==list.end()) {
+ if (list.tqfind( dbName )==list.end()) {
if (!ignoreErrors)
- setError(ERR_OBJECT_NOT_FOUND, i18n("The database \"%1\" does not exist.").arg(dbName));
+ setError(ERR_OBJECT_NOT_FOUND, i18n("The database \"%1\" does not exist.").tqarg(dbName));
return false;
}
return true;
}
-bool Connection::databaseExists( const QString &dbName, bool ignoreErrors )
+bool Connection::databaseExists( const TQString &dbName, bool ignoreErrors )
{
// KexiDBDbg << "Connection::databaseExists(" << dbName << "," << ignoreErrors << ")" << endl;
if (!checkConnected())
@@ -380,29 +380,29 @@ bool Connection::databaseExists( const QString &dbName, bool ignoreErrors )
if (m_driver->isFileDriver()) {
//for file-based db: file must exists and be accessible
//js: moved from useDatabase():
- QFileInfo file(d->conn_data->fileName());
+ TQFileInfo file(d->conn_data->fileName());
if (!file.exists() || ( !file.isFile() && !file.isSymLink()) ) {
if (!ignoreErrors)
setError(ERR_OBJECT_NOT_FOUND, i18n("Database file \"%1\" does not exist.")
- .arg(QDir::convertSeparators(d->conn_data->fileName())) );
+ .tqarg(TQDir::convertSeparators(d->conn_data->fileName())) );
return false;
}
if (!file.isReadable()) {
if (!ignoreErrors)
setError(ERR_ACCESS_RIGHTS, i18n("Database file \"%1\" is not readable.")
- .arg(QDir::convertSeparators(d->conn_data->fileName())) );
+ .tqarg(TQDir::convertSeparators(d->conn_data->fileName())) );
return false;
}
if (!file.isWritable()) {
if (!ignoreErrors)
setError(ERR_ACCESS_RIGHTS, i18n("Database file \"%1\" is not writable.")
- .arg(QDir::convertSeparators(d->conn_data->fileName())) );
+ .tqarg(TQDir::convertSeparators(d->conn_data->fileName())) );
return false;
}
return true;
}
- QString tmpdbName;
+ TQString tmpdbName;
//some engines need to have opened any database before executing "create database"
const bool orig_skip_databaseExists_check_in_useDatabase = d->skip_databaseExists_check_in_useDatabase;
d->skip_databaseExists_check_in_useDatabase = true;
@@ -424,7 +424,7 @@ bool Connection::databaseExists( const QString &dbName, bool ignoreErrors )
#define createDatabase_CLOSE \
{ if (!closeDatabase()) { \
- setError(i18n("Database \"%1\" created but could not be closed after creation.").arg(dbName) ); \
+ setError(i18n("Database \"%1\" created but could not be closed after creation.").tqarg(dbName) ); \
return false; \
} }
@@ -432,18 +432,18 @@ bool Connection::databaseExists( const QString &dbName, bool ignoreErrors )
{ createDatabase_CLOSE; return false; }
-bool Connection::createDatabase( const QString &dbName )
+bool Connection::createDatabase( const TQString &dbName )
{
if (!checkConnected())
return false;
if (databaseExists( dbName )) {
- setError(ERR_OBJECT_EXISTS, i18n("Database \"%1\" already exists.").arg(dbName) );
+ setError(ERR_OBJECT_EXISTS, i18n("Database \"%1\" already exists.").tqarg(dbName) );
return false;
}
if (m_driver->isSystemDatabaseName( dbName )) {
setError(ERR_SYSTEM_NAME_RESERVED,
- i18n("Cannot create database \"%1\". This name is reserved for system database.").arg(dbName) );
+ i18n("Cannot create database \"%1\". This name is reserved for system database.").tqarg(dbName) );
return false;
}
if (m_driver->isFileDriver()) {
@@ -451,14 +451,14 @@ bool Connection::createDatabase( const QString &dbName )
d->conn_data->setFileName( dbName );
}
- QString tmpdbName;
+ TQString tmpdbName;
//some engines need to have opened any database before executing "create database"
if (!useTemporaryDatabaseIfNeeded(tmpdbName))
return false;
//low-level create
if (!drv_createDatabase( dbName )) {
- setError(i18n("Error creating database \"%1\" on the server.").arg(dbName) );
+ setError(i18n("Error creating database \"%1\" on the server.").tqarg(dbName) );
closeDatabase();//sanity
return false;
}
@@ -472,7 +472,7 @@ bool Connection::createDatabase( const QString &dbName )
if (!tmpdbName.isEmpty() || !m_driver->d->isDBOpenedAfterCreate) {
//db need to be opened
if (!useDatabase( dbName, false/*not yet kexi compatible!*/ )) {
- setError(i18n("Database \"%1\" created but could not be opened.").arg(dbName) );
+ setError(i18n("Database \"%1\" created but could not be opened.").tqarg(dbName) );
return false;
}
}
@@ -496,7 +496,7 @@ bool Connection::createDatabase( const QString &dbName )
return false;
//-physically create system tables
- for (QPtrDictIterator<TableSchema> it(d->kexiDBSystemTables); it.current(); ++it) {
+ for (TQPtrDictIterator<TableSchema> it(d->kexiDBSystemTables); it.current(); ++it) {
if (!drv_createTable( it.current()->name() ))
createDatabase_ERROR;
}
@@ -510,9 +510,9 @@ bool Connection::createDatabase( const QString &dbName )
FieldList *fl = ts->subList("p_id", "p_name", "p_mime", "p_url");
if (!fl)
createDatabase_ERROR;
- if (!insertRecord(*fl, QVariant(1), QVariant("Tables"), QVariant("kexi/table"), QVariant("http://koffice.org/kexi/")))
+ if (!insertRecord(*fl, TQVariant(1), TQVariant("Tables"), TQVariant("kexi/table"), TQVariant("http://koffice.org/kexi/")))
createDatabase_ERROR;
- if (!insertRecord(*fl, QVariant(2), QVariant("Queries"), QVariant("kexi/query"), QVariant("http://koffice.org/kexi/")))
+ if (!insertRecord(*fl, TQVariant(2), TQVariant("Queries"), TQVariant("kexi/query"), TQVariant("http://koffice.org/kexi/")))
createDatabase_ERROR;
*/
@@ -534,7 +534,7 @@ bool Connection::createDatabase( const QString &dbName )
#undef createDatabase_CLOSE
#undef createDatabase_ERROR
-bool Connection::useDatabase( const QString &dbName, bool kexiCompatible, bool *cancelled, MessageHandler* msgHandler )
+bool Connection::useDatabase( const TQString &dbName, bool kexiCompatible, bool *cancelled, MessageHandler* msgHandler )
{
if (cancelled)
*cancelled = false;
@@ -544,9 +544,9 @@ bool Connection::useDatabase( const QString &dbName, bool kexiCompatible, bool *
if (dbName.isEmpty())
return false;
- QString my_dbName = dbName;
+ TQString my_dbName = dbName;
// if (my_dbName.isEmpty()) {
-// const QStringList& db_lst = databaseNames();
+// const TQStringList& db_lst = databaseNames();
// if (!db_lst.isEmpty())
// my_dbName = db_lst.first();
// }
@@ -566,7 +566,7 @@ bool Connection::useDatabase( const QString &dbName, bool kexiCompatible, bool *
if (!drv_useDatabase( my_dbName, cancelled, msgHandler )) {
if (cancelled && *cancelled)
return false;
- QString msg(i18n("Opening database \"%1\" failed.").arg( my_dbName ));
+ TQString msg(i18n("Opening database \"%1\" failed.").tqarg( my_dbName ));
if (error())
setError( this, msg );
else
@@ -582,14 +582,14 @@ bool Connection::useDatabase( const QString &dbName, bool kexiCompatible, bool *
//-get global database information
int num;
bool ok;
-// static QString notfound_str = i18n("\"%1\" database property not found");
+// static TQString notfound_str = i18n("\"%1\" database property not found");
num = d->dbProperties->value("kexidb_major_ver").toInt(&ok);
if (!ok)
return false;
d->databaseVersion.major = num;
/* if (true!=querySingleNumber(
- "select db_value from kexi__db where db_property=" + m_driver->escapeString(QString("kexidb_major_ver")), num)) {
- d->errorInvalidDBContents(notfound_str.arg("kexidb_major_ver"));
+ "select db_value from kexi__db where db_property=" + m_driver->escapeString(TQString("kexidb_major_ver")), num)) {
+ d->errorInvalidDBContents(notfound_str.tqarg("kexidb_major_ver"));
return false;
}*/
num = d->dbProperties->value("kexidb_minor_ver").toInt(&ok);
@@ -597,8 +597,8 @@ bool Connection::useDatabase( const QString &dbName, bool kexiCompatible, bool *
return false;
d->databaseVersion.minor = num;
/* if (true!=querySingleNumber(
- "select db_value from kexi__db where db_property=" + m_driver->escapeString(QString("kexidb_minor_ver")), num)) {
- d->errorInvalidDBContents(notfound_str.arg("kexidb_minor_ver"));
+ "select db_value from kexi__db where db_property=" + m_driver->escapeString(TQString("kexidb_minor_ver")), num)) {
+ d->errorInvalidDBContents(notfound_str.tqarg("kexidb_minor_ver"));
return false;
}*/
@@ -607,8 +607,8 @@ bool Connection::useDatabase( const QString &dbName, bool kexiCompatible, bool *
if (m_driver->versionMajor()!=KexiDB::versionMajor()) {
setError(ERR_INCOMPAT_DATABASE_VERSION,
i18n("Database version (%1) does not match Kexi application's version (%2)")
- .arg( QString("%1.%2").arg(versionMajor()).arg(versionMinor()) )
- .arg( QString("%1.%2").arg(KexiDB::versionMajor()).arg(KexiDB::versionMinor()) ) );
+ .tqarg( TQString("%1.%2").tqarg(versionMajor()).tqarg(versionMinor()) )
+ .tqarg( TQString("%1.%2").tqarg(KexiDB::versionMajor()).tqarg(KexiDB::versionMinor()) ) );
return false;
}
if (m_driver->versionMinor()!=KexiDB::versionMinor()) {
@@ -633,7 +633,7 @@ bool Connection::closeDatabase()
/*! \todo (js) add CLEVER algorithm here for nested transactions */
if (m_driver->transactionsSupported()) {
//rollback all transactions
- QValueList<Transaction>::ConstIterator it;
+ TQValueList<Transaction>::ConstIterator it;
d->dont_remove_transactions=true; //lock!
for (it=d->transactions.constBegin(); it!= d->transactions.constEnd(); ++it) {
if (!rollbackTransaction(*it)) {//rollback as much as you can, don't stop on prev. errors
@@ -642,7 +642,7 @@ bool Connection::closeDatabase()
else {
KexiDBDbg << "Connection::closeDatabase(): transaction rolled back!" << endl;
KexiDBDbg << "Connection::closeDatabase(): trans.refcount==" <<
- ((*it).m_data ? QString::number((*it).m_data->refcount) : "(null)") << endl;
+ ((*it).m_data ? TQString::number((*it).m_data->refcount) : "(null)") << endl;
}
}
d->dont_remove_transactions=false; //unlock!
@@ -664,14 +664,14 @@ bool Connection::closeDatabase()
return ret;
}
-QString Connection::currentDatabase() const
+TQString Connection::currentDatabase() const
{
return d->usedDatabase;
}
-bool Connection::useTemporaryDatabaseIfNeeded(QString &tmpdbName)
+bool Connection::useTemporaryDatabaseIfNeeded(TQString &tmpdbName)
{
- if (!m_driver->isFileDriver() && m_driver->beh->USING_DATABASE_REQUIRED_TO_CONNECT
+ if (!m_driver->isFileDriver() && m_driver->beh->USING_DATABASE_RETQUIRED_TO_CONNECT
&& !isDatabaseUsed()) {
//we have no db used, but it is required by engine to have used any!
tmpdbName = anyAvailableDatabaseName();
@@ -686,19 +686,19 @@ bool Connection::useTemporaryDatabaseIfNeeded(QString &tmpdbName)
if (!ret) {
setError(errorNum(),
i18n("Error during starting temporary connection using \"%1\" database name.")
- .arg(tmpdbName) );
+ .tqarg(tmpdbName) );
return false;
}
}
return true;
}
-bool Connection::dropDatabase( const QString &dbName )
+bool Connection::dropDatabase( const TQString &dbName )
{
if (!checkConnected())
return false;
- QString dbToDrop;
+ TQString dbToDrop;
if (dbName.isEmpty() && d->usedDatabase.isEmpty()) {
if (!m_driver->isFileDriver()
|| (m_driver->isFileDriver() && d->conn_data->fileName().isEmpty()) ) {
@@ -713,7 +713,7 @@ bool Connection::dropDatabase( const QString &dbName )
dbToDrop = d->usedDatabase;
} else {
if (m_driver->isFileDriver()) //lets get full path
- dbToDrop = QFileInfo(dbName).absFilePath();
+ dbToDrop = TQFileInfo(dbName).absFilePath();
else
dbToDrop = dbName;
}
@@ -725,7 +725,7 @@ bool Connection::dropDatabase( const QString &dbName )
}
if (m_driver->isSystemDatabaseName( dbToDrop )) {
- setError(ERR_SYSTEM_NAME_RESERVED, i18n("Cannot delete system database \"%1\".").arg(dbToDrop) );
+ setError(ERR_SYSTEM_NAME_RESERVED, i18n("Cannot delete system database \"%1\".").tqarg(dbToDrop) );
return false;
}
@@ -735,7 +735,7 @@ bool Connection::dropDatabase( const QString &dbName )
return false;
}
- QString tmpdbName;
+ TQString tmpdbName;
//some engines need to have opened any database before executing "drop database"
if (!useTemporaryDatabaseIfNeeded(tmpdbName))
return false;
@@ -751,9 +751,9 @@ bool Connection::dropDatabase( const QString &dbName )
return ret;
}
-QStringList Connection::objectNames(int objType, bool* ok)
+TQStringList Connection::objectNames(int objType, bool* ok)
{
- QStringList list;
+ TQStringList list;
if (!checkIsDatabaseUsed()) {
if(ok)
@@ -761,11 +761,11 @@ QStringList Connection::objectNames(int objType, bool* ok)
return list;
}
- QString sql;
+ TQString sql;
if (objType==KexiDB::AnyObjectType)
sql = "SELECT o_name FROM kexi__objects";
else
- sql = QString::fromLatin1("SELECT o_name FROM kexi__objects WHERE o_type=%1").arg(objType);
+ sql = TQString::tqfromLatin1("SELECT o_name FROM kexi__objects WHERE o_type=%1").tqarg(objType);
Cursor *c = executeQuery(sql);
if (!c) {
@@ -775,7 +775,7 @@ QStringList Connection::objectNames(int objType, bool* ok)
}
for (c->moveFirst(); !c->eof(); c->moveNext()) {
- QString name = c->value(0).toString();
+ TQString name = c->value(0).toString();
if (KexiUtils::isIdentifier( name )) {
list.append(name);
}
@@ -792,10 +792,10 @@ QStringList Connection::objectNames(int objType, bool* ok)
return list;
}
-QStringList Connection::tableNames(bool also_system_tables)
+TQStringList Connection::tableNames(bool also_system_tables)
{
bool ok = true;
- QStringList list = objectNames(TableObjectType, &ok);
+ TQStringList list = objectNames(TableObjectType, &ok);
if (also_system_tables && ok) {
list += Connection::kexiDBSystemTableNames();
}
@@ -803,7 +803,7 @@ QStringList Connection::tableNames(bool also_system_tables)
}
//! \todo (js): this will depend on KexiDB lib version
-const QStringList& Connection::kexiDBSystemTableNames()
+const TQStringList& Connection::kexiDBSystemTableNames()
{
if (KexiDB_kexiDBSystemTableNames.isEmpty()) {
KexiDB_kexiDBSystemTableNames
@@ -834,30 +834,30 @@ DatabaseProperties& Connection::databaseProperties()
return *d->dbProperties;
}
-QValueList<int> Connection::tableIds()
+TQValueList<int> Connection::tableIds()
{
return objectIds(KexiDB::TableObjectType);
}
-QValueList<int> Connection::queryIds()
+TQValueList<int> Connection::queryIds()
{
return objectIds(KexiDB::QueryObjectType);
}
-QValueList<int> Connection::objectIds(int objType)
+TQValueList<int> Connection::objectIds(int objType)
{
- QValueList<int> list;
+ TQValueList<int> list;
if (!checkIsDatabaseUsed())
return list;
Cursor *c = executeQuery(
- QString::fromLatin1("SELECT o_id, o_name FROM kexi__objects WHERE o_type=%1").arg(objType));
+ TQString::tqfromLatin1("SELECT o_id, o_name FROM kexi__objects WHERE o_type=%1").tqarg(objType));
if (!c)
return list;
for (c->moveFirst(); !c->eof(); c->moveNext())
{
- QString tname = c->value(1).toString(); //kexi__objects.o_name
+ TQString tname = c->value(1).toString(); //kexi__objects.o_name
if (KexiUtils::isIdentifier( tname )) {
list.append(c->value(0).toInt()); //kexi__objects.o_id
}
@@ -868,10 +868,10 @@ QValueList<int> Connection::objectIds(int objType)
return list;
}
-QString Connection::createTableStatement( const KexiDB::TableSchema& tableSchema ) const
+TQString Connection::createTableStatement( const KexiDB::TableSchema& tableSchema ) const
{
// Each SQL identifier needs to be escaped in the generated query.
- QString sql;
+ TQString sql;
sql.reserve(4096);
sql = "CREATE TABLE " + escapeIdentifier(tableSchema.name()) + " (";
bool first=true;
@@ -882,10 +882,10 @@ QString Connection::createTableStatement( const KexiDB::TableSchema& tableSchema
first = false;
else
sql += ", ";
- QString v = escapeIdentifier(field->name()) + " ";
+ TQString v = escapeIdentifier(field->name()) + " ";
const bool autoinc = field->isAutoIncrement();
- const bool pk = field->isPrimaryKey() || (autoinc && m_driver->beh->AUTO_INCREMENT_REQUIRES_PK);
-//TODO: warning: ^^^^^ this allows only one autonumber per table when AUTO_INCREMENT_REQUIRES_PK==true!
+ const bool pk = field->isPrimaryKey() || (autoinc && m_driver->beh->AUTO_INCREMENT_RETQUIRES_PK);
+//TODO: warning: ^^^^^ this allows only one autonumber per table when AUTO_INCREMENT_RETQUIRES_PK==true!
if (autoinc && m_driver->beh->SPECIAL_AUTO_INCREMENT_DEF) {
if (pk)
v += m_driver->beh->AUTO_INCREMENT_TYPE + " " + m_driver->beh->AUTO_INCREMENT_PK_FIELD_OPTION;
@@ -903,12 +903,12 @@ QString Connection::createTableStatement( const KexiDB::TableSchema& tableSchema
if (field->isFPNumericType() && field->precision()>0) {
if (field->scale()>0)
- v += QString::fromLatin1("(%1,%2)").arg(field->precision()).arg(field->scale());
+ v += TQString::tqfromLatin1("(%1,%2)").tqarg(field->precision()).tqarg(field->scale());
else
- v += QString::fromLatin1("(%1)").arg(field->precision());
+ v += TQString::tqfromLatin1("(%1)").tqarg(field->precision());
}
else if (field->type()==Field::Text && field->length()>0)
- v += QString::fromLatin1("(%1)").arg(field->length());
+ v += TQString::tqfromLatin1("(%1)").tqarg(field->length());
if (autoinc)
v += (" " +
@@ -918,14 +918,14 @@ QString Connection::createTableStatement( const KexiDB::TableSchema& tableSchema
if (pk)
v += " PRIMARY KEY";
if (!pk && field->isUniqueKey())
- v += " UNIQUE";
+ v += " UNITQUE";
///@todo IS this ok for all engines?: if (!autoinc && !field->isPrimaryKey() && field->isNotNull())
if (!autoinc && !pk && field->isNotNull())
v += " NOT NULL"; //only add not null option if no autocommit is set
if (field->defaultValue().isValid()) {
- QString valToSQL( m_driver->valueToSQL( field, field->defaultValue() ) );
+ TQString valToSQL( m_driver->valueToSQL( field, field->defaultValue() ) );
if (!valToSQL.isEmpty()) //for sanity
- v += QString::fromLatin1(" DEFAULT ") + valToSQL;
+ v += TQString::tqfromLatin1(" DEFAULT ") + valToSQL;
}
}
sql += v;
@@ -935,20 +935,20 @@ QString Connection::createTableStatement( const KexiDB::TableSchema& tableSchema
}
//yeah, it is very efficient:
-#define C_A(a) , const QVariant& c ## a
+#define C_A(a) , const TQVariant& c ## a
#define V_A0 m_driver->valueToSQL( tableSchema.field(0), c0 )
#define V_A(a) +","+m_driver->valueToSQL( \
tableSchema.field(a) ? tableSchema.field(a)->type() : Field::Text, c ## a )
-// KexiDBDbg << "******** " << QString("INSERT INTO ") +
+// KexiDBDbg << "******** " << TQString("INSERT INTO ") +
// escapeIdentifier(tableSchema.name()) +
// " VALUES (" + vals + ")" <<endl;
#define C_INS_REC(args, vals) \
bool Connection::insertRecord(KexiDB::TableSchema &tableSchema args) {\
return executeSQL( \
- QString("INSERT INTO ") + escapeIdentifier(tableSchema.name()) + " VALUES (" + vals + ")" \
+ TQString("INSERT INTO ") + escapeIdentifier(tableSchema.name()) + " VALUES (" + vals + ")" \
); \
}
@@ -976,11 +976,11 @@ C_INS_REC_ALL
#define C_INS_REC(args, vals) \
bool Connection::insertRecord(FieldList& fields args) \
{ \
- QString value; \
+ TQString value; \
Field::List *flist = fields.fields(); \
vals \
return executeSQL( \
- QString("INSERT INTO ") + \
+ TQString("INSERT INTO ") + \
((fields.fields()->first() && fields.fields()->first()->table()) ? \
escapeIdentifier(fields.fields()->first()->table()->name()) : \
"??") \
@@ -996,19 +996,19 @@ C_INS_REC_ALL
#undef C_INS_REC
#undef C_INS_REC_ALL
-bool Connection::insertRecord(TableSchema &tableSchema, QValueList<QVariant>& values)
+bool Connection::insertRecord(TableSchema &tableSchema, TQValueList<TQVariant>& values)
{
// Each SQL identifier needs to be escaped in the generated query.
Field::List *fields = tableSchema.fields();
Field *f = fields->first();
-// QString s_val;
+// TQString s_val;
// s_val.reserve(4096);
- m_sql = QString::null;
- QValueList<QVariant>::ConstIterator it = values.constBegin();
+ m_sql = TQString();
+ TQValueList<TQVariant>::ConstIterator it = values.constBegin();
// int i=0;
while (f && (it!=values.end())) {
if (m_sql.isEmpty())
- m_sql = QString("INSERT INTO ") +
+ m_sql = TQString("INSERT INTO ") +
escapeIdentifier(tableSchema.name()) +
" VALUES (";
else
@@ -1024,21 +1024,21 @@ bool Connection::insertRecord(TableSchema &tableSchema, QValueList<QVariant>& va
return executeSQL(m_sql);
}
-bool Connection::insertRecord(FieldList& fields, QValueList<QVariant>& values)
+bool Connection::insertRecord(FieldList& fields, TQValueList<TQVariant>& values)
{
// Each SQL identifier needs to be escaped in the generated query.
Field::List *flist = fields.fields();
Field *f = flist->first();
if (!f)
return false;
-// QString s_val;
+// TQString s_val;
// s_val.reserve(4096);
- m_sql = QString::null;
- QValueList<QVariant>::ConstIterator it = values.constBegin();
+ m_sql = TQString();
+ TQValueList<TQVariant>::ConstIterator it = values.constBegin();
// int i=0;
while (f && (it!=values.constEnd())) {
if (m_sql.isEmpty())
- m_sql = QString("INSERT INTO ") +
+ m_sql = TQString("INSERT INTO ") +
escapeIdentifier(flist->first()->table()->name()) + "(" +
fields.sqlFieldsList(m_driver) + ") VALUES (";
else
@@ -1053,11 +1053,11 @@ bool Connection::insertRecord(FieldList& fields, QValueList<QVariant>& values)
return executeSQL(m_sql);
}
-bool Connection::executeSQL( const QString& statement )
+bool Connection::executeSQL( const TQString& statement )
{
m_sql = statement; //remember for error handling
if (!drv_executeSQL( m_sql )) {
- m_errMsg = QString::null; //clear as this could be most probably jsut "Unknown error" string.
+ m_errMsg = TQString(); //clear as this could be most probably jsut "Unknown error" string.
m_errorSql = statement;
setError(this, ERR_SQL_EXECUTION_ERROR, i18n("Error while executing SQL statement."));
return false;
@@ -1065,13 +1065,13 @@ bool Connection::executeSQL( const QString& statement )
return true;
}
-QString Connection::selectStatement( KexiDB::QuerySchema& querySchema,
- const QValueList<QVariant>& params,
+TQString Connection::selectStatement( KexiDB::QuerySchema& querySchema,
+ const TQValueList<TQVariant>& params,
const SelectStatementOptions& options) const
{
//"SELECT FROM ..." is theoretically allowed "
//if (querySchema.fieldCount()<1)
-// return QString::null;
+// return TQString();
// Each SQL identifier needs to be escaped in the generated query.
if (!querySchema.statement().isEmpty())
@@ -1093,27 +1093,27 @@ QString Connection::selectStatement( KexiDB::QuerySchema& querySchema,
}
}
- QString sql; //final sql string
+ TQString sql; //final sql string
sql.reserve(4096);
-//unused QString s_from_additional; //additional tables list needed for lookup fields
- QString s_additional_joins; //additional joins needed for lookup fields
- QString s_additional_fields; //additional fields to append to the fields list
+//unused TQString s_from_additional; //additional tables list needed for lookup fields
+ TQString s_additional_joins; //additional joins needed for lookup fields
+ TQString s_additional_fields; //additional fields to append to the fields list
uint internalUniqueTableAliasNumber = 0; //used to build internalUniqueTableAliases
uint internalUniqueQueryAliasNumber = 0; //used to build internalUniqueQueryAliases
number = 0;
- QPtrList<QuerySchema> subqueries_for_lookup_data; // subqueries will be added to FROM section
- QString kexidb_subquery_prefix("__kexidb_subquery_");
+ TQPtrList<QuerySchema> subqueries_for_lookup_data; // subqueries will be added to FROM section
+ TQString kexidb_subquery_prefix("__kexidb_subquery_");
for (Field::ListIterator it = querySchema.fieldsIterator(); (f = it.current()); ++it, number++) {
if (querySchema.isColumnVisible(number)) {
if (!sql.isEmpty())
- sql += QString::fromLatin1(", ");
+ sql += TQString::tqfromLatin1(", ");
if (f->isQueryAsterisk()) {
if (!singleTable && static_cast<QueryAsterisk*>(f)->isSingleTableAsterisk()) //single-table *
sql += escapeIdentifier(f->table()->name(), options.identifierEscaping) +
- QString::fromLatin1(".*");
+ TQString::tqfromLatin1(".*");
else //all-tables * (or simplified table.* when there's only one table)
- sql += QString::fromLatin1("*");
+ sql += TQString::tqfromLatin1("*");
}
else {
if (f->isExpression()) {
@@ -1121,9 +1121,9 @@ QString Connection::selectStatement( KexiDB::QuerySchema& querySchema,
}
else {
if (!f->table()) //sanity check
- return QString::null;
+ return TQString();
- QString tableName;
+ TQString tableName;
int tablePosition = querySchema.tableBoundToColumn(number);
if (tablePosition>=0)
tableName = querySchema.tableAlias(tablePosition);
@@ -1135,9 +1135,9 @@ QString Connection::selectStatement( KexiDB::QuerySchema& querySchema,
}
sql += escapeIdentifier(f->name(), options.identifierEscaping);
}
- QString aliasString = QString(querySchema.columnAlias(number));
+ TQString aliasString = TQString(querySchema.columnAlias(number));
if (!aliasString.isEmpty())
- sql += (QString::fromLatin1(" AS ") + aliasString);
+ sql += (TQString::tqfromLatin1(" AS ") + aliasString);
//! @todo add option that allows to omit "AS" keyword
}
LookupFieldSchema *lookupFieldSchema = (options.addVisibleLookupColumns && f->table())
@@ -1159,16 +1159,16 @@ QString Connection::selectStatement( KexiDB::QuerySchema& querySchema,
{
//add LEFT OUTER JOIN
if (!s_additional_joins.isEmpty())
- s_additional_joins += QString::fromLatin1(" ");
- QString internalUniqueTableAlias( QString("__kexidb_") + lookupTable->name() + "_"
- + QString::number(internalUniqueTableAliasNumber++) );
- s_additional_joins += QString("LEFT OUTER JOIN %1 AS %2 ON %3.%4=%5.%6")
- .arg(escapeIdentifier(lookupTable->name(), options.identifierEscaping))
- .arg(internalUniqueTableAlias)
- .arg(escapeIdentifier(f->table()->name(), options.identifierEscaping))
- .arg(escapeIdentifier(f->name(), options.identifierEscaping))
- .arg(internalUniqueTableAlias)
- .arg(escapeIdentifier(boundField->name(), options.identifierEscaping));
+ s_additional_joins += TQString::tqfromLatin1(" ");
+ TQString internalUniqueTableAlias( TQString("__kexidb_") + lookupTable->name() + "_"
+ + TQString::number(internalUniqueTableAliasNumber++) );
+ s_additional_joins += TQString("LEFT OUTER JOIN %1 AS %2 ON %3.%4=%5.%6")
+ .tqarg(escapeIdentifier(lookupTable->name(), options.identifierEscaping))
+ .tqarg(internalUniqueTableAlias)
+ .tqarg(escapeIdentifier(f->table()->name(), options.identifierEscaping))
+ .tqarg(escapeIdentifier(f->name(), options.identifierEscaping))
+ .tqarg(internalUniqueTableAlias)
+ .tqarg(escapeIdentifier(boundField->name(), options.identifierEscaping));
//add visibleField to the list of SELECTed fields //if it is not yet present there
//not needed if (!querySchema.findTableField( visibleField->table()->name()+"."+visibleField->name() )) {
@@ -1177,13 +1177,13 @@ QString Connection::selectStatement( KexiDB::QuerySchema& querySchema,
/* not true
//table should be added after FROM
if (!s_from_additional.isEmpty())
- s_from_additional += QString::fromLatin1(", ");
+ s_from_additional += TQString::tqfromLatin1(", ");
s_from_additional += escapeIdentifier(visibleField->table()->name(), options.identifierEscaping);
*/
}
#endif
if (!s_additional_fields.isEmpty())
- s_additional_fields += QString::fromLatin1(", ");
+ s_additional_fields += TQString::tqfromLatin1(", ");
// s_additional_fields += (internalUniqueTableAlias + "." //escapeIdentifier(visibleField->table()->name(), options.identifierEscaping) + "."
// escapeIdentifier(visibleField->name(), options.identifierEscaping));
//! @todo Add lookup schema option for separator other than ' ' or even option for placeholders like "Name ? ?"
@@ -1197,48 +1197,48 @@ QString Connection::selectStatement( KexiDB::QuerySchema& querySchema,
QuerySchema *lookupQuery = querySchema.connection()->querySchema( rowSource.name() );
if (!lookupQuery) {
KexiDBWarn << "Connection::selectStatement(): !lookupQuery" << endl;
- return QString::null;
+ return TQString();
}
const QueryColumnInfo::Vector fieldsExpanded( lookupQuery->fieldsExpanded() );
if ((uint)lookupFieldSchema->boundColumn() >= fieldsExpanded.count()) {
KexiDBWarn << "Connection::selectStatement(): (uint)lookupFieldSchema->boundColumn() >= fieldsExpanded.count()" << endl;
- return QString::null;
+ return TQString();
}
QueryColumnInfo *boundColumnInfo = fieldsExpanded.at( lookupFieldSchema->boundColumn() );
if (!boundColumnInfo) {
KexiDBWarn << "Connection::selectStatement(): !boundColumnInfo" << endl;
- return QString::null;
+ return TQString();
}
Field *boundField = boundColumnInfo->field;
if (!boundField) {
KexiDBWarn << "Connection::selectStatement(): !boundField" << endl;
- return QString::null;
+ return TQString();
}
//add LEFT OUTER JOIN
if (!s_additional_joins.isEmpty())
- s_additional_joins += QString::fromLatin1(" ");
- QString internalUniqueQueryAlias(
+ s_additional_joins += TQString::tqfromLatin1(" ");
+ TQString internalUniqueQueryAlias(
kexidb_subquery_prefix + lookupQuery->name() + "_"
- + QString::number(internalUniqueQueryAliasNumber++) );
- s_additional_joins += QString("LEFT OUTER JOIN (%1) AS %2 ON %3.%4=%5.%6")
- .arg(selectStatement( *lookupQuery, params, options ))
- .arg(internalUniqueQueryAlias)
- .arg(escapeIdentifier(f->table()->name(), options.identifierEscaping))
- .arg(escapeIdentifier(f->name(), options.identifierEscaping))
- .arg(internalUniqueQueryAlias)
- .arg(escapeIdentifier(boundColumnInfo->aliasOrName(), options.identifierEscaping));
+ + TQString::number(internalUniqueQueryAliasNumber++) );
+ s_additional_joins += TQString("LEFT OUTER JOIN (%1) AS %2 ON %3.%4=%5.%6")
+ .tqarg(selectStatement( *lookupQuery, params, options ))
+ .tqarg(internalUniqueQueryAlias)
+ .tqarg(escapeIdentifier(f->table()->name(), options.identifierEscaping))
+ .tqarg(escapeIdentifier(f->name(), options.identifierEscaping))
+ .tqarg(internalUniqueQueryAlias)
+ .tqarg(escapeIdentifier(boundColumnInfo->aliasOrName(), options.identifierEscaping));
if (!s_additional_fields.isEmpty())
- s_additional_fields += QString::fromLatin1(", ");
- const QValueList<uint> visibleColumns( lookupFieldSchema->visibleColumns() );
- QString expression;
- foreach (QValueList<uint>::ConstIterator, visibleColumnsIt, visibleColumns) {
+ s_additional_fields += TQString::tqfromLatin1(", ");
+ const TQValueList<uint> visibleColumns( lookupFieldSchema->visibleColumns() );
+ TQString expression;
+ foreach (TQValueList<uint>::ConstIterator, visibleColumnsIt, visibleColumns) {
//! @todo Add lookup schema option for separator other than ' ' or even option for placeholders like "Name ? ?"
//! @todo Add possibility for joining the values at client side.
if (fieldsExpanded.count() <= (*visibleColumnsIt)) {
KexiDBWarn << "Connection::selectStatement(): fieldsExpanded.count() <= (*visibleColumnsIt) : "
<< fieldsExpanded.count() << " <= " << *visibleColumnsIt << endl;
- return QString::null;
+ return TQString();
}
if (!expression.isEmpty())
expression += " || ' ' || ";
@@ -1252,7 +1252,7 @@ QString Connection::selectStatement( KexiDB::QuerySchema& querySchema,
else {
KexiDBWarn << "Connection::selectStatement(): unsupported row source type "
<< rowSource.typeName() << endl;
- return QString();
+ return TQString();
}
}
}
@@ -1260,12 +1260,12 @@ QString Connection::selectStatement( KexiDB::QuerySchema& querySchema,
//add lookup fields
if (!s_additional_fields.isEmpty())
- sql += (QString::fromLatin1(", ") + s_additional_fields);
+ sql += (TQString::tqfromLatin1(", ") + s_additional_fields);
if (options.alsoRetrieveROWID) { //append rowid column
- QString s;
+ TQString s;
if (!sql.isEmpty())
- s = QString::fromLatin1(", ");
+ s = TQString::tqfromLatin1(", ");
if (querySchema.masterTable())
s += (escapeIdentifier(querySchema.masterTable()->name())+".");
s += m_driver->beh->ROW_ID_FIELD_NAME;
@@ -1275,8 +1275,8 @@ QString Connection::selectStatement( KexiDB::QuerySchema& querySchema,
sql.prepend("SELECT ");
TableSchema::List* tables = querySchema.tables();
if ((tables && !tables->isEmpty()) || !subqueries_for_lookup_data.isEmpty()) {
- sql += QString::fromLatin1(" FROM ");
- QString s_from;
+ sql += TQString::tqfromLatin1(" FROM ");
+ TQString s_from;
if (tables) {
TableSchema *table;
number = 0;
@@ -1284,38 +1284,38 @@ QString Connection::selectStatement( KexiDB::QuerySchema& querySchema,
++it, number++)
{
if (!s_from.isEmpty())
- s_from += QString::fromLatin1(", ");
+ s_from += TQString::tqfromLatin1(", ");
s_from += escapeIdentifier(table->name(), options.identifierEscaping);
- QString aliasString = QString(querySchema.tableAlias(number));
+ TQString aliasString = TQString(querySchema.tableAlias(number));
if (!aliasString.isEmpty())
- s_from += (QString::fromLatin1(" AS ") + aliasString);
+ s_from += (TQString::tqfromLatin1(" AS ") + aliasString);
}
/*unused if (!s_from_additional.isEmpty()) {//additional tables list needed for lookup fields
if (!s_from.isEmpty())
- s_from += QString::fromLatin1(", ");
+ s_from += TQString::tqfromLatin1(", ");
s_from += s_from_additional;
}*/
}
// add subqueries for lookup data
uint subqueries_for_lookup_data_counter = 0;
- for (QPtrListIterator<QuerySchema> it(subqueries_for_lookup_data);
+ for (TQPtrListIterator<QuerySchema> it(subqueries_for_lookup_data);
subqueries_for_lookup_data.current(); ++it, subqueries_for_lookup_data_counter++)
{
if (!s_from.isEmpty())
- s_from += QString::fromLatin1(", ");
- s_from += QString::fromLatin1("(");
+ s_from += TQString::tqfromLatin1(", ");
+ s_from += TQString::tqfromLatin1("(");
s_from += selectStatement( *it.current(), params, options );
- s_from += QString::fromLatin1(") AS %1%2")
- .arg(kexidb_subquery_prefix).arg(subqueries_for_lookup_data_counter);
+ s_from += TQString::tqfromLatin1(") AS %1%2")
+ .tqarg(kexidb_subquery_prefix).tqarg(subqueries_for_lookup_data_counter);
}
sql += s_from;
}
- QString s_where;
+ TQString s_where;
s_where.reserve(4096);
//JOINS
if (!s_additional_joins.isEmpty()) {
- sql += QString::fromLatin1(" ") + s_additional_joins + QString::fromLatin1(" ");
+ sql += TQString::tqfromLatin1(" ") + s_additional_joins + TQString::tqfromLatin1(" ");
}
//@todo: we're using WHERE for joins now; use INNER/LEFT/RIGHT JOIN later
@@ -1328,24 +1328,24 @@ QString Connection::selectStatement( KexiDB::QuerySchema& querySchema,
wasWhere = true;
}
else
- s_where += QString::fromLatin1(" AND ");
+ s_where += TQString::tqfromLatin1(" AND ");
Field::Pair *pair;
- QString s_where_sub;
- for (QPtrListIterator<Field::Pair> p_it(*rel->fieldPairs()); (pair = p_it.current()); ++p_it) {
+ TQString s_where_sub;
+ for (TQPtrListIterator<Field::Pair> p_it(*rel->fieldPairs()); (pair = p_it.current()); ++p_it) {
if (!s_where_sub.isEmpty())
- s_where_sub += QString::fromLatin1(" AND ");
+ s_where_sub += TQString::tqfromLatin1(" AND ");
s_where_sub += (
escapeIdentifier(pair->first->table()->name(), options.identifierEscaping) +
- QString::fromLatin1(".") +
+ TQString::tqfromLatin1(".") +
escapeIdentifier(pair->first->name(), options.identifierEscaping) +
- QString::fromLatin1(" = ") +
+ TQString::tqfromLatin1(" = ") +
escapeIdentifier(pair->second->table()->name(), options.identifierEscaping) +
- QString::fromLatin1(".") +
+ TQString::tqfromLatin1(".") +
escapeIdentifier(pair->second->name(), options.identifierEscaping));
}
if (rel->fieldPairs()->count()>1) {
s_where_sub.prepend("(");
- s_where_sub += QString::fromLatin1(")");
+ s_where_sub += TQString::tqfromLatin1(")");
}
s_where += s_where_sub;
}
@@ -1362,20 +1362,20 @@ QString Connection::selectStatement( KexiDB::QuerySchema& querySchema,
}
}
if (!s_where.isEmpty())
- sql += QString::fromLatin1(" WHERE ") + s_where;
+ sql += TQString::tqfromLatin1(" WHERE ") + s_where;
//! \todo (js) add other sql parts
//(use wasWhere here)
// ORDER BY
- QString orderByString(
+ TQString orderByString(
querySchema.orderByColumnList().toSQLString(!singleTable/*includeTableName*/,
driver(), options.identifierEscaping) );
- const QValueVector<int> pkeyFieldsOrder( querySchema.pkeyFieldsOrder() );
+ const TQValueVector<int> pkeyFieldsOrder( querySchema.pkeyFieldsOrder() );
if (orderByString.isEmpty() && !pkeyFieldsOrder.isEmpty()) {
//add automatic ORDER BY if there is no explicity defined (especially helps when there are complex JOINs)
OrderByColumnList automaticPKOrderBy;
const QueryColumnInfo::Vector fieldsExpanded( querySchema.fieldsExpanded() );
- foreach (QValueVector<int>::ConstIterator, it, pkeyFieldsOrder) {
+ foreach (TQValueVector<int>::ConstIterator, it, pkeyFieldsOrder) {
if ((*it) < 0) // no field mentioned in this query
continue;
if ((*it) >= (int)fieldsExpanded.count()) {
@@ -1396,7 +1396,7 @@ QString Connection::selectStatement( KexiDB::QuerySchema& querySchema,
return sql;
}
-QString Connection::selectStatement( KexiDB::TableSchema& tableSchema,
+TQString Connection::selectStatement( KexiDB::TableSchema& tableSchema,
const SelectStatementOptions& options) const
{
return selectStatement( *tableSchema.query(), options );
@@ -1413,10 +1413,10 @@ Field* Connection::findSystemFieldName(KexiDB::FieldList* fieldlist)
return 0;
}
-Q_ULLONG Connection::lastInsertedAutoIncValue(const QString& aiFieldName, const QString& tableName,
- Q_ULLONG* ROWID)
+TQ_ULLONG Connection::lastInsertedAutoIncValue(const TQString& aiFieldName, const TQString& tableName,
+ TQ_ULLONG* ROWID)
{
- Q_ULLONG row_id = drv_lastInsertRowID();
+ TQ_ULLONG row_id = drv_lastInsertRowID();
if (ROWID)
*ROWID = row_id;
if (m_driver->beh->ROW_ID_FIELD_RETURNS_LAST_AUTOINCREMENTED_VALUE) {
@@ -1424,17 +1424,17 @@ Q_ULLONG Connection::lastInsertedAutoIncValue(const QString& aiFieldName, const
}
RowData rdata;
if (row_id<=0 || true!=querySingleRecord(
- QString::fromLatin1("SELECT ") + tableName + QString::fromLatin1(".") + aiFieldName + QString::fromLatin1(" FROM ") + tableName
- + QString::fromLatin1(" WHERE ") + m_driver->beh->ROW_ID_FIELD_NAME + QString::fromLatin1("=") + QString::number(row_id), rdata))
+ TQString::tqfromLatin1("SELECT ") + tableName + TQString::tqfromLatin1(".") + aiFieldName + TQString::tqfromLatin1(" FROM ") + tableName
+ + TQString::tqfromLatin1(" WHERE ") + m_driver->beh->ROW_ID_FIELD_NAME + TQString::tqfromLatin1("=") + TQString::number(row_id), rdata))
{
// KexiDBDbg << "Connection::lastInsertedAutoIncValue(): row_id<=0 || true!=querySingleRecord()" << endl;
- return (Q_ULLONG)-1; //ULL;
+ return (TQ_ULLONG)-1; //ULL;
}
return rdata[0].toULongLong();
}
-Q_ULLONG Connection::lastInsertedAutoIncValue(const QString& aiFieldName,
- const KexiDB::TableSchema& table, Q_ULLONG* ROWID)
+TQ_ULLONG Connection::lastInsertedAutoIncValue(const TQString& aiFieldName,
+ const KexiDB::TableSchema& table, TQ_ULLONG* ROWID)
{
return lastInsertedAutoIncValue(aiFieldName,table.name(), ROWID);
}
@@ -1460,24 +1460,24 @@ static FieldList* createFieldListForKexi__Fields(TableSchema *kexi__fieldsSchema
}
//! builds a list of values for field's \a f properties. Used by createTable().
-void buildValuesForKexi__Fields(QValueList<QVariant>& vals, Field* f)
+void buildValuesForKexi__Fields(TQValueList<TQVariant>& vals, Field* f)
{
vals.clear();
vals
- << QVariant(f->table()->id())
- << QVariant(f->type())
- << QVariant(f->name())
- << QVariant(f->isFPNumericType() ? f->scale() : f->length())
- << QVariant(f->isFPNumericType() ? f->precision() : 0)
- << QVariant(f->constraints())
- << QVariant(f->options())
- // KexiDB::variantToString() is needed here because the value can be of any QVariant type,
+ << TQVariant(f->table()->id())
+ << TQVariant(f->type())
+ << TQVariant(f->name())
+ << TQVariant(f->isFPNumericType() ? f->scale() : f->length())
+ << TQVariant(f->isFPNumericType() ? f->precision() : 0)
+ << TQVariant(f->constraints())
+ << TQVariant(f->options())
+ // KexiDB::variantToString() is needed here because the value can be of any TQVariant type,
// depending on f->type()
<< (f->defaultValue().isNull()
- ? QVariant() : QVariant(KexiDB::variantToString( f->defaultValue() )))
- << QVariant(f->order())
- << QVariant(f->caption())
- << QVariant(f->description());
+ ? TQVariant() : TQVariant(KexiDB::variantToString( f->defaultValue() )))
+ << TQVariant(f->order())
+ << TQVariant(f->caption())
+ << TQVariant(f->description());
}
bool Connection::storeMainFieldSchema(Field *field)
@@ -1488,21 +1488,21 @@ bool Connection::storeMainFieldSchema(Field *field)
if (!fl)
return false;
- QValueList<QVariant> vals;
+ TQValueList<TQVariant> vals;
buildValuesForKexi__Fields(vals, field);
- QValueList<QVariant>::ConstIterator valsIt = vals.constBegin();
+ TQValueList<TQVariant>::ConstIterator valsIt = vals.constBegin();
Field *f;
bool first = true;
- QString sql = "UPDATE kexi__fields SET ";
+ TQString sql = "UPDATE kexi__fields SET ";
for (Field::ListIterator it( fl->fieldsIterator() ); (f = it.current()); ++it, ++valsIt) {
- sql.append( (first ? QString::null : QString(", ")) +
+ sql.append( (first ? TQString() : TQString(", ")) +
f->name() + "=" + m_driver->valueToSQL( f, *valsIt ) );
if (first)
first = false;
}
delete fl;
- sql.append(QString(" WHERE t_id=") + QString::number( field->table()->id() )
+ sql.append(TQString(" WHERE t_id=") + TQString::number( field->table()->id() )
+ " AND f_name=" + m_driver->valueToSQL( Field::Text, field->name() ) );
return executeSQL( sql );
}
@@ -1535,13 +1535,13 @@ bool Connection::createTable( KexiDB::TableSchema* tableSchema, bool replaceExis
}
const bool internalTable = dynamic_cast<InternalTableSchema*>(tableSchema);
- const QString &tableName = tableSchema->name().lower();
+ const TQString &tableName = tableSchema->name().lower();
if (!internalTable) {
if (m_driver->isSystemObjectName( tableName )) {
clearError();
setError(ERR_SYSTEM_NAME_RESERVED, i18n("System name \"%1\" cannot be used as table name.")
- .arg(tableSchema->name()));
+ .tqarg(tableSchema->name()));
return false;
}
@@ -1550,7 +1550,7 @@ bool Connection::createTable( KexiDB::TableSchema* tableSchema, bool replaceExis
clearError();
setError(ERR_SYSTEM_NAME_RESERVED,
i18n("System name \"%1\" cannot be used as one of fields in \"%2\" table.")
- .arg(sys_field->name()).arg(tableName));
+ .tqarg(sys_field->name()).tqarg(tableName));
return false;
}
}
@@ -1565,7 +1565,7 @@ bool Connection::createTable( KexiDB::TableSchema* tableSchema, bool replaceExis
if (existingTable == tableSchema) {
clearError();
setError(ERR_OBJECT_EXISTS,
- i18n("Could not create the same table \"%1\" twice.").arg(tableSchema->name()) );
+ i18n("Could not create the same table \"%1\" twice.").tqarg(tableSchema->name()) );
return false;
}
//TODO(js): update any structure (e.g. queries) that depend on this table!
@@ -1579,7 +1579,7 @@ bool Connection::createTable( KexiDB::TableSchema* tableSchema, bool replaceExis
else {
if (this->tableSchema( tableSchema->name() ) != 0) {
clearError();
- setError(ERR_OBJECT_EXISTS, i18n("Table \"%1\" already exists.").arg(tableSchema->name()) );
+ setError(ERR_OBJECT_EXISTS, i18n("Table \"%1\" already exists.").tqarg(tableSchema->name()) );
return false;
}
}
@@ -1617,7 +1617,7 @@ bool Connection::createTable( KexiDB::TableSchema* tableSchema, bool replaceExis
// int order = 0;
Field *f;
for (Field::ListIterator it( *tableSchema->fields() ); (f = it.current()); ++it/*, order++*/) {
- QValueList<QVariant> vals;
+ TQValueList<TQVariant> vals;
buildValuesForKexi__Fields(vals, f);
if (!insertRecord(*fl, vals ))
createTable_ERR;
@@ -1676,7 +1676,7 @@ bool Connection::removeObject( uint objId )
return true;
}
-bool Connection::drv_dropTable( const QString& name )
+bool Connection::drv_dropTable( const TQString& name )
{
m_sql = "DROP TABLE " + escapeIdentifier(name);
return executeSQL(m_sql);
@@ -1701,13 +1701,13 @@ tristate Connection::dropTable( KexiDB::TableSchema* tableSchema, bool alsoRemov
if (!tableSchema)
return false;
- QString errmsg(i18n("Table \"%1\" cannot be removed.\n"));
+ TQString errmsg(i18n("Table \"%1\" cannot be removed.\n"));
//be sure that we handle the correct TableSchema object:
if (tableSchema->id() < 0
|| this->tableSchema(tableSchema->name())!=tableSchema
|| this->tableSchema(tableSchema->id())!=tableSchema)
{
- setError(ERR_OBJECT_NOT_FOUND, errmsg.arg(tableSchema->name())
+ setError(ERR_OBJECT_NOT_FOUND, errmsg.tqarg(tableSchema->name())
+i18n("Unexpected name or identifier."));
return false;
}
@@ -1718,7 +1718,7 @@ tristate Connection::dropTable( KexiDB::TableSchema* tableSchema, bool alsoRemov
//sanity checks:
if (m_driver->isSystemObjectName( tableSchema->name() )) {
- setError(ERR_SYSTEM_NAME_RESERVED, errmsg.arg(tableSchema->name()) + d->strItIsASystemObject());
+ setError(ERR_SYSTEM_NAME_RESERVED, errmsg.tqarg(tableSchema->name()) + d->strItIsASystemObject());
return false;
}
@@ -1751,13 +1751,13 @@ tristate Connection::dropTable( KexiDB::TableSchema* tableSchema, bool alsoRemov
return commitAutoCommitTransaction(tg.transaction());
}
-tristate Connection::dropTable( const QString& table )
+tristate Connection::dropTable( const TQString& table )
{
clearError();
TableSchema* ts = tableSchema( table );
if (!ts) {
setError(ERR_OBJECT_NOT_FOUND, i18n("Table \"%1\" does not exist.")
- .arg(table));
+ .tqarg(table));
return false;
}
return dropTable(ts);
@@ -1772,7 +1772,7 @@ tristate Connection::alterTable( TableSchema& tableSchema, TableSchema& newTable
if (&tableSchema == &newTableSchema) {
setError(ERR_OBJECT_THE_SAME, i18n("Could not alter table \"%1\" using the same table.")
- .arg(tableSchema.name()));
+ .tqarg(tableSchema.name()));
return false;
}
//TODO(js): implement real altering
@@ -1784,27 +1784,27 @@ tristate Connection::alterTable( TableSchema& tableSchema, TableSchema& newTable
empty = true;
#endif
if (empty) {
- ok = createTable(&newTableSchema, true/*replace*/);
+ ok = createTable(&newTableSchema, true/*tqreplace*/);
}
return ok;
}
-bool Connection::alterTableName(TableSchema& tableSchema, const QString& newName, bool replace)
+bool Connection::alterTableName(TableSchema& tableSchema, const TQString& newName, bool tqreplace)
{
clearError();
if (&tableSchema!=d->tables[tableSchema.id()]) {
- setError(ERR_OBJECT_NOT_FOUND, i18n("Unknown table \"%1\"").arg(tableSchema.name()));
+ setError(ERR_OBJECT_NOT_FOUND, i18n("Unknown table \"%1\"").tqarg(tableSchema.name()));
return false;
}
if (newName.isEmpty() || !KexiUtils::isIdentifier(newName)) {
- setError(ERR_INVALID_IDENTIFIER, i18n("Invalid table name \"%1\"").arg(newName));
+ setError(ERR_INVALID_IDENTIFIER, i18n("Invalid table name \"%1\"").tqarg(newName));
return false;
}
- const QString oldTableName = tableSchema.name();
- const QString newTableName = newName.lower().stripWhiteSpace();
+ const TQString oldTableName = tableSchema.name();
+ const TQString newTableName = newName.lower().stripWhiteSpace();
if (oldTableName.lower().stripWhiteSpace() == newTableName) {
setError(ERR_OBJECT_THE_SAME, i18n("Could rename table \"%1\" using the same name.")
- .arg(newTableName));
+ .tqarg(newTableName));
return false;
}
//TODO: alter table name for server DB backends!
@@ -1813,10 +1813,10 @@ bool Connection::alterTableName(TableSchema& tableSchema, const QString& newName
TableSchema *tableToReplace = this->tableSchema( newName );
const bool destTableExists = tableToReplace != 0;
const int origID = destTableExists ? tableToReplace->id() : -1; //will be reused in the new table
- if (!replace && destTableExists) {
+ if (!tqreplace && destTableExists) {
setError(ERR_OBJECT_EXISTS,
i18n("Could not rename table \"%1\" to \"%2\". Table \"%3\" already exists.")
- .arg(tableSchema.name()).arg(newName).arg(newName));
+ .tqarg(tableSchema.name()).tqarg(newName).tqarg(newName));
return false;
}
@@ -1830,7 +1830,7 @@ bool Connection::alterTableName(TableSchema& tableSchema, const QString& newName
// drop the table replaced (with schema)
if (destTableExists) {
- if (!replace) {
+ if (!tqreplace) {
return false;
}
if (!dropTable( newName )) {
@@ -1838,13 +1838,13 @@ bool Connection::alterTableName(TableSchema& tableSchema, const QString& newName
}
// the new table owns the previous table's id:
- if (!executeSQL(QString::fromLatin1("UPDATE kexi__objects SET o_id=%1 WHERE o_id=%2 AND o_type=%3")
- .arg(origID).arg(tableSchema.id()).arg((int)TableObjectType)))
+ if (!executeSQL(TQString::tqfromLatin1("UPDATE kexi__objects SET o_id=%1 WHERE o_id=%2 AND o_type=%3")
+ .tqarg(origID).tqarg(tableSchema.id()).tqarg((int)TableObjectType)))
{
return false;
}
- if (!executeSQL(QString::fromLatin1("UPDATE kexi__fields SET t_id=%1 WHERE t_id=%2")
- .arg(origID).arg(tableSchema.id())))
+ if (!executeSQL(TQString::tqfromLatin1("UPDATE kexi__fields SET t_id=%1 WHERE t_id=%2")
+ .tqarg(origID).tqarg(tableSchema.id())))
{
return false;
}
@@ -1861,8 +1861,8 @@ bool Connection::alterTableName(TableSchema& tableSchema, const QString& newName
// Update kexi__objects
//TODO
- if (!executeSQL(QString::fromLatin1("UPDATE kexi__objects SET o_name=%1 WHERE o_id=%2")
- .arg(m_driver->escapeString(tableSchema.name())).arg(tableSchema.id())))
+ if (!executeSQL(TQString::tqfromLatin1("UPDATE kexi__objects SET o_name=%1 WHERE o_id=%2")
+ .tqarg(m_driver->escapeString(tableSchema.name())).tqarg(tableSchema.id())))
{
alterTableName_ERR;
return false;
@@ -1884,13 +1884,13 @@ bool Connection::alterTableName(TableSchema& tableSchema, const QString& newName
return true;
}
-bool Connection::drv_alterTableName(TableSchema& tableSchema, const QString& newName)
+bool Connection::drv_alterTableName(TableSchema& tableSchema, const TQString& newName)
{
- const QString oldTableName = tableSchema.name();
+ const TQString oldTableName = tableSchema.name();
tableSchema.setName(newName);
- if (!executeSQL(QString::fromLatin1("ALTER TABLE %1 RENAME TO %2")
- .arg(escapeIdentifier(oldTableName)).arg(escapeIdentifier(newName))))
+ if (!executeSQL(TQString::tqfromLatin1("ALTER TABLE %1 RENAME TO %2")
+ .tqarg(escapeIdentifier(oldTableName)).tqarg(escapeIdentifier(newName))))
{
tableSchema.setName(oldTableName); //restore old name
return false;
@@ -1932,13 +1932,13 @@ bool Connection::dropQuery( KexiDB::QuerySchema* querySchema )
return commitAutoCommitTransaction(tg.transaction());
}
-bool Connection::dropQuery( const QString& query )
+bool Connection::dropQuery( const TQString& query )
{
clearError();
QuerySchema* qs = querySchema( query );
if (!qs) {
setError(ERR_OBJECT_NOT_FOUND, i18n("Query \"%1\" does not exist.")
- .arg(query));
+ .tqarg(query));
return false;
}
return dropQuery(qs);
@@ -1951,7 +1951,7 @@ bool Connection::drv_createTable( const KexiDB::TableSchema& tableSchema )
return executeSQL(m_sql);
}
-bool Connection::drv_createTable( const QString& tableSchemaName )
+bool Connection::drv_createTable( const TQString& tableSchemaName )
{
TableSchema *ts = d->tables_byname[tableSchemaName];
if (!ts)
@@ -2014,7 +2014,7 @@ bool Connection::rollbackAutoCommitTransaction(const Transaction& trans)
#define SET_ERR_TRANS_NOT_SUPP \
{ setError(ERR_UNSUPPORTED_DRV_FEATURE, \
- i18n("Transactions are not supported for \"%1\" driver.").arg(m_driver->name() )); }
+ i18n("Transactions are not supported for \"%1\" driver.").tqarg(m_driver->name() )); }
#define SET_BEGIN_TR_ERROR \
{ if (!error()) \
@@ -2157,7 +2157,7 @@ void Connection::setDefaultTransaction(const Transaction& trans)
d->default_trans = trans;
}
-const QValueList<Transaction>& Connection::transactions()
+const TQValueList<Transaction>& Connection::transactions()
{
return d->transactions;
}
@@ -2179,7 +2179,7 @@ bool Connection::setAutoCommit(bool on)
TransactionData* Connection::drv_beginTransaction()
{
- QString old_sql = m_sql; //don't
+ TQString old_sql = m_sql; //don't
if (!executeSQL( "BEGIN" ))
return 0;
return new TransactionData(this);
@@ -2200,7 +2200,7 @@ bool Connection::drv_setAutoCommit(bool /*on*/)
return true;
}
-Cursor* Connection::executeQuery( const QString& statement, uint cursor_options )
+Cursor* Connection::executeQuery( const TQString& statement, uint cursor_options )
{
if (statement.isEmpty())
return 0;
@@ -2215,7 +2215,7 @@ Cursor* Connection::executeQuery( const QString& statement, uint cursor_options
return c;
}
-Cursor* Connection::executeQuery( QuerySchema& query, const QValueList<QVariant>& params,
+Cursor* Connection::executeQuery( QuerySchema& query, const TQValueList<TQVariant>& params,
uint cursor_options )
{
Cursor *c = prepareQuery( query, params, cursor_options );
@@ -2231,7 +2231,7 @@ Cursor* Connection::executeQuery( QuerySchema& query, const QValueList<QVariant>
Cursor* Connection::executeQuery( QuerySchema& query, uint cursor_options )
{
- return executeQuery(query, QValueList<QVariant>(), cursor_options);
+ return executeQuery(query, TQValueList<TQVariant>(), cursor_options);
}
Cursor* Connection::executeQuery( TableSchema& table, uint cursor_options )
@@ -2244,7 +2244,7 @@ Cursor* Connection::prepareQuery( TableSchema& table, uint cursor_options )
return prepareQuery( *table.query(), cursor_options );
}
-Cursor* Connection::prepareQuery( QuerySchema& query, const QValueList<QVariant>& params,
+Cursor* Connection::prepareQuery( QuerySchema& query, const TQValueList<TQVariant>& params,
uint cursor_options )
{
Cursor* cursor = prepareQuery(query, cursor_options);
@@ -2270,7 +2270,7 @@ bool Connection::setupObjectSchemaData( const RowData &data, SchemaData &sdata )
{
//not found: retrieve schema
/* KexiDB::Cursor *cursor;
- if (!(cursor = executeQuery( QString("select * from kexi__objects where o_id='%1'").arg(objId) )))
+ if (!(cursor = executeQuery( TQString("select * from kexi__objects where o_id='%1'").tqarg(objId) )))
return false;
if (!cursor->moveFirst()) {
deleteCursor(cursor);
@@ -2287,7 +2287,7 @@ bool Connection::setupObjectSchemaData( const RowData &data, SchemaData &sdata )
}
sdata.m_name = data[2].toString();
if (!KexiUtils::isIdentifier( sdata.m_name )) {
- setError(ERR_INVALID_IDENTIFIER, i18n("Invalid object name \"%1\"").arg(sdata.m_name));
+ setError(ERR_INVALID_IDENTIFIER, i18n("Invalid object name \"%1\"").tqarg(sdata.m_name));
return false;
}
sdata.m_caption = data[3].toString();
@@ -2300,19 +2300,19 @@ bool Connection::setupObjectSchemaData( const RowData &data, SchemaData &sdata )
tristate Connection::loadObjectSchemaData( int objectID, SchemaData &sdata )
{
RowData data;
- if (true!=querySingleRecord(QString::fromLatin1(
+ if (true!=querySingleRecord(TQString::tqfromLatin1(
"SELECT o_id, o_type, o_name, o_caption, o_desc FROM kexi__objects WHERE o_id=%1")
- .arg(objectID), data))
+ .tqarg(objectID), data))
return cancelled;
return setupObjectSchemaData( data, sdata );
}
-tristate Connection::loadObjectSchemaData( int objectType, const QString& objectName, SchemaData &sdata )
+tristate Connection::loadObjectSchemaData( int objectType, const TQString& objectName, SchemaData &sdata )
{
RowData data;
- if (true!=querySingleRecord(QString::fromLatin1("SELECT o_id, o_type, o_name, o_caption, o_desc "
+ if (true!=querySingleRecord(TQString::tqfromLatin1("SELECT o_id, o_type, o_name, o_caption, o_desc "
"FROM kexi__objects WHERE o_type=%1 AND lower(o_name)=%2")
- .arg(objectType).arg(m_driver->valueToSQL(Field::Text, objectName.lower())), data))
+ .tqarg(objectType).tqarg(m_driver->valueToSQL(Field::Text, objectName.lower())), data))
return cancelled;
return setupObjectSchemaData( data, sdata );
}
@@ -2324,9 +2324,9 @@ bool Connection::storeObjectSchemaData( SchemaData &sdata, bool newObject )
return false;
if (newObject) {
int existingID;
- if (true == querySingleNumber(QString::fromLatin1(
+ if (true == querySingleNumber(TQString::tqfromLatin1(
"SELECT o_id FROM kexi__objects WHERE o_type=%1 AND lower(o_name)=%2")
- .arg(sdata.type()).arg(m_driver->valueToSQL(Field::Text, sdata.name().lower())), existingID))
+ .tqarg(sdata.type()).tqarg(m_driver->valueToSQL(Field::Text, sdata.name().lower())), existingID))
{
//we already have stored a schema data with the same name and type:
//just update it's properties as it would be existing object
@@ -2340,8 +2340,8 @@ bool Connection::storeObjectSchemaData( SchemaData &sdata, bool newObject )
if (sdata.id()<=0) {//get new ID
fl = ts->subList("o_type", "o_name", "o_caption", "o_desc");
ok = fl!=0;
- if (ok && !insertRecord(*fl, QVariant(sdata.type()), QVariant(sdata.name()),
- QVariant(sdata.caption()), QVariant(sdata.description()) ))
+ if (ok && !insertRecord(*fl, TQVariant(sdata.type()), TQVariant(sdata.name()),
+ TQVariant(sdata.caption()), TQVariant(sdata.description()) ))
ok = false;
delete fl;
if (!ok)
@@ -2357,21 +2357,21 @@ bool Connection::storeObjectSchemaData( SchemaData &sdata, bool newObject )
} else {
fl = ts->subList("o_id", "o_type", "o_name", "o_caption", "o_desc");
ok = fl!=0;
- if (ok && !insertRecord(*fl, QVariant(sdata.id()), QVariant(sdata.type()), QVariant(sdata.name()),
- QVariant(sdata.caption()), QVariant(sdata.description()) ))
+ if (ok && !insertRecord(*fl, TQVariant(sdata.id()), TQVariant(sdata.type()), TQVariant(sdata.name()),
+ TQVariant(sdata.caption()), TQVariant(sdata.description()) ))
ok = false;
delete fl;
return ok;
}
}
//existing object:
- return executeSQL(QString("UPDATE kexi__objects SET o_type=%2, o_caption=%3, o_desc=%4 WHERE o_id=%1")
- .arg(sdata.id()).arg(sdata.type())
- .arg(m_driver->valueToSQL(KexiDB::Field::Text, sdata.caption()))
- .arg(m_driver->valueToSQL(KexiDB::Field::Text, sdata.description())) );
+ return executeSQL(TQString("UPDATE kexi__objects SET o_type=%2, o_caption=%3, o_desc=%4 WHERE o_id=%1")
+ .tqarg(sdata.id()).tqarg(sdata.type())
+ .tqarg(m_driver->valueToSQL(KexiDB::Field::Text, sdata.caption()))
+ .tqarg(m_driver->valueToSQL(KexiDB::Field::Text, sdata.description())) );
}
-tristate Connection::querySingleRecordInternal(RowData &data, const QString* sql, QuerySchema* query,
+tristate Connection::querySingleRecordInternal(RowData &data, const TQString* sql, QuerySchema* query,
bool addLimitTo1)
{
Q_ASSERT(sql || query);
@@ -2394,7 +2394,7 @@ tristate Connection::querySingleRecordInternal(RowData &data, const QString* sql
return deleteCursor(cursor);
}
-tristate Connection::querySingleRecord(const QString& sql, RowData &data, bool addLimitTo1)
+tristate Connection::querySingleRecord(const TQString& sql, RowData &data, bool addLimitTo1)
{
return querySingleRecordInternal(data, &sql, 0, addLimitTo1);
}
@@ -2407,13 +2407,13 @@ tristate Connection::querySingleRecord(QuerySchema& query, RowData &data, bool a
bool Connection::checkIfColumnExists(Cursor *cursor, uint column)
{
if (column >= cursor->fieldCount()) {
- setError(ERR_CURSOR_RECORD_FETCHING, i18n("Column %1 does not exist for the query.").arg(column));
+ setError(ERR_CURSOR_RECORD_FETCHING, i18n("Column %1 does not exist for the query.").tqarg(column));
return false;
}
return true;
}
-tristate Connection::querySingleString(const QString& sql, QString &value, uint column, bool addLimitTo1)
+tristate Connection::querySingleString(const TQString& sql, TQString &value, uint column, bool addLimitTo1)
{
KexiDB::Cursor *cursor;
m_sql = addLimitTo1 ? (sql + " LIMIT 1") : sql; // is this safe?;
@@ -2435,9 +2435,9 @@ tristate Connection::querySingleString(const QString& sql, QString &value, uint
return deleteCursor(cursor);
}
-tristate Connection::querySingleNumber(const QString& sql, int &number, uint column, bool addLimitTo1)
+tristate Connection::querySingleNumber(const TQString& sql, int &number, uint column, bool addLimitTo1)
{
- static QString str;
+ static TQString str;
static bool ok;
const tristate result = querySingleString(sql, str, column, addLimitTo1);
if (result!=true)
@@ -2446,7 +2446,7 @@ tristate Connection::querySingleNumber(const QString& sql, int &number, uint col
return ok;
}
-bool Connection::queryStringList(const QString& sql, QStringList& list, uint column)
+bool Connection::queryStringList(const TQString& sql, TQStringList& list, uint column)
{
KexiDB::Cursor *cursor;
clearError();
@@ -2477,14 +2477,14 @@ bool Connection::queryStringList(const QString& sql, QStringList& list, uint col
return deleteCursor(cursor);
}
-bool Connection::resultExists(const QString& sql, bool &success, bool addLimitTo1)
+bool Connection::resultExists(const TQString& sql, bool &success, bool addLimitTo1)
{
KexiDB::Cursor *cursor;
//optimization
- if (m_driver->beh->SELECT_1_SUBQUERY_SUPPORTED) {
+ if (m_driver->beh->SELECT_1_SUBTQUERY_SUPPORTED) {
//this is at least for sqlite
if (addLimitTo1 && sql.left(6).upper() == "SELECT")
- m_sql = QString("SELECT 1 FROM (") + sql + ") LIMIT 1"; // is this safe?;
+ m_sql = TQString("SELECT 1 FROM (") + sql + ") LIMIT 1"; // is this safe?;
else
m_sql = sql;
}
@@ -2517,7 +2517,7 @@ bool Connection::isEmpty( TableSchema& table, bool &success )
//! Used by addFieldPropertyToExtendedTableSchemaData()
static void createExtendedTableSchemaMainElementIfNeeded(
- QDomDocument& doc, QDomElement& extendedTableSchemaMainEl,
+ TQDomDocument& doc, TQDomElement& extendedTableSchemaMainEl,
bool& extendedTableSchemaStringIsEmpty)
{
if (!extendedTableSchemaStringIsEmpty)
@@ -2525,13 +2525,13 @@ static void createExtendedTableSchemaMainElementIfNeeded(
//init document
extendedTableSchemaMainEl = doc.createElement("EXTENDED_TABLE_SCHEMA");
doc.appendChild( extendedTableSchemaMainEl );
- extendedTableSchemaMainEl.setAttribute("version", QString::number(KEXIDB_EXTENDED_TABLE_SCHEMA_VERSION));
+ extendedTableSchemaMainEl.setAttribute("version", TQString::number(KEXIDB_EXTENDED_TABLE_SCHEMA_VERSION));
extendedTableSchemaStringIsEmpty = false;
}
//! Used by addFieldPropertyToExtendedTableSchemaData()
-static void createExtendedTableSchemaFieldElementIfNeeded(QDomDocument& doc,
- QDomElement& extendedTableSchemaMainEl, const QString& fieldName, QDomElement& extendedTableSchemaFieldEl,
+static void createExtendedTableSchemaFieldElementIfNeeded(TQDomDocument& doc,
+ TQDomElement& extendedTableSchemaMainEl, const TQString& fieldName, TQDomElement& extendedTableSchemaFieldEl,
bool append = true)
{
if (!extendedTableSchemaFieldEl.isNull())
@@ -2549,9 +2549,9 @@ static void createExtendedTableSchemaFieldElementIfNeeded(QDomDocument& doc,
If extendedTableSchemaFieldEl is null, creates <field> element (with optional
"custom" attribute is \a custom is false). */
static void addFieldPropertyToExtendedTableSchemaData(
- Field *f, const char* propertyName, const QVariant& propertyValue,
- QDomDocument& doc, QDomElement& extendedTableSchemaMainEl,
- QDomElement& extendedTableSchemaFieldEl,
+ Field *f, const char* propertyName, const TQVariant& propertyValue,
+ TQDomDocument& doc, TQDomElement& extendedTableSchemaMainEl,
+ TQDomElement& extendedTableSchemaFieldEl,
bool& extendedTableSchemaStringIsEmpty,
bool custom = false )
{
@@ -2561,31 +2561,31 @@ static void addFieldPropertyToExtendedTableSchemaData(
doc, extendedTableSchemaMainEl, f->name(), extendedTableSchemaFieldEl);
//create <property>
- QDomElement extendedTableSchemaFieldPropertyEl = doc.createElement("property");
+ TQDomElement extendedTableSchemaFieldPropertyEl = doc.createElement("property");
extendedTableSchemaFieldEl.appendChild( extendedTableSchemaFieldPropertyEl );
if (custom)
extendedTableSchemaFieldPropertyEl.setAttribute("custom", "true");
extendedTableSchemaFieldPropertyEl.setAttribute("name", propertyName);
- QDomElement extendedTableSchemaFieldPropertyValueEl;
+ TQDomElement extendedTableSchemaFieldPropertyValueEl;
switch (propertyValue.type()) {
- case QVariant::String:
+ case TQVariant::String:
extendedTableSchemaFieldPropertyValueEl = doc.createElement("string");
break;
- case QVariant::CString:
+ case TQVariant::CString:
extendedTableSchemaFieldPropertyValueEl = doc.createElement("cstring");
break;
- case QVariant::Int:
- case QVariant::Double:
- case QVariant::UInt:
- case QVariant::LongLong:
- case QVariant::ULongLong:
+ case TQVariant::Int:
+ case TQVariant::Double:
+ case TQVariant::UInt:
+ case TQVariant::LongLong:
+ case TQVariant::ULongLong:
extendedTableSchemaFieldPropertyValueEl = doc.createElement("number");
break;
- case QVariant::Bool:
+ case TQVariant::Bool:
extendedTableSchemaFieldPropertyValueEl = doc.createElement("bool");
break;
default:
-//! @todo add more QVariant types
+//! @todo add more TQVariant types
KexiDBFatal << "addFieldPropertyToExtendedTableSchemaData(): impl. error" << endl;
}
extendedTableSchemaFieldPropertyEl.appendChild( extendedTableSchemaFieldPropertyValueEl );
@@ -2596,14 +2596,14 @@ static void addFieldPropertyToExtendedTableSchemaData(
bool Connection::storeExtendedTableSchemaData(TableSchema& tableSchema)
{
//! @todo future: save in older versions if neeed
- QDomDocument doc("EXTENDED_TABLE_SCHEMA");
- QDomElement extendedTableSchemaMainEl;
+ TQDomDocument doc("EXTENDED_TABLE_SCHEMA");
+ TQDomElement extendedTableSchemaMainEl;
bool extendedTableSchemaStringIsEmpty = true;
//for each field:
Field *f;
for (Field::ListIterator it( *tableSchema.fields() ); (f = it.current()); ++it) {
- QDomElement extendedTableSchemaFieldEl;
+ TQDomElement extendedTableSchemaFieldEl;
if (f->visibleDecimalPlaces()>=0/*nondefault*/ && KexiDB::supportsVisibleDecimalPlacesProperty(f->type())) {
addFieldPropertyToExtendedTableSchemaData(
f, "visibleDecimalPlaces", f->visibleDecimalPlaces(), doc,
@@ -2639,14 +2639,14 @@ bool Connection::storeExtendedTableSchemaData(TableSchema& tableSchema)
// Store extended schema information (see ExtendedTableSchemaInformation in Kexi Wiki)
if (extendedTableSchemaStringIsEmpty) {
#ifdef KEXI_DEBUG_GUI
- KexiUtils::addAlterTableActionDebug(QString("** Extended table schema REMOVED."));
+ KexiUtils::addAlterTableActionDebug(TQString("** Extended table schema REMOVED."));
#endif
if (!removeDataBlock( tableSchema.id(), "extended_schema"))
return false;
}
else {
#ifdef KEXI_DEBUG_GUI
- KexiUtils::addAlterTableActionDebug(QString("** Extended table schema set to:\n")+doc.toString(4));
+ KexiUtils::addAlterTableActionDebug(TQString("** Extended table schema set to:\n")+doc.toString(4));
#endif
if (!storeDataBlock( tableSchema.id(), doc.toString(1), "extended_schema" ))
return false;
@@ -2668,7 +2668,7 @@ bool Connection::loadExtendedTableSchemaData(TableSchema& tableSchema)
return false; }
// Load extended schema information, if present (see ExtendedTableSchemaInformation in Kexi Wiki)
- QString extendedTableSchemaString;
+ TQString extendedTableSchemaString;
tristate res = loadDataBlock( tableSchema.id(), extendedTableSchemaString, "extended_schema" );
if (!res)
loadExtendedTableSchemaData_ERR;
@@ -2690,37 +2690,37 @@ bool Connection::loadExtendedTableSchemaData(TableSchema& tableSchema)
if (extendedTableSchemaString.isEmpty())
return true;
- QDomDocument doc;
- QString errorMsg;
+ TQDomDocument doc;
+ TQString errorMsg;
int errorLine, errorColumn;
if (!doc.setContent( extendedTableSchemaString, &errorMsg, &errorLine, &errorColumn ))
loadExtendedTableSchemaData_ERR2( i18n("Error in XML data: \"%1\" in line %2, column %3.\nXML data: ")
- .arg(errorMsg).arg(errorLine).arg(errorColumn) + extendedTableSchemaString.left(1024));
+ .tqarg(errorMsg).tqarg(errorLine).tqarg(errorColumn) + extendedTableSchemaString.left(1024));
//! @todo look at the current format version (KEXIDB_EXTENDED_TABLE_SCHEMA_VERSION)
if (doc.doctype().name()!="EXTENDED_TABLE_SCHEMA")
loadExtendedTableSchemaData_ERR3( extendedTableSchemaString );
- QDomElement docEl = doc.documentElement();
+ TQDomElement docEl = doc.documentElement();
if (docEl.tagName()!="EXTENDED_TABLE_SCHEMA")
loadExtendedTableSchemaData_ERR3( extendedTableSchemaString );
- for (QDomNode n = docEl.firstChild(); !n.isNull(); n = n.nextSibling()) {
- QDomElement fieldEl = n.toElement();
+ for (TQDomNode n = docEl.firstChild(); !n.isNull(); n = n.nextSibling()) {
+ TQDomElement fieldEl = n.toElement();
if (fieldEl.tagName()=="field") {
Field *f = tableSchema.field( fieldEl.attribute("name") );
if (f) {
//set properties of the field:
//! @todo more properties
- for (QDomNode propNode = fieldEl.firstChild();
+ for (TQDomNode propNode = fieldEl.firstChild();
!propNode.isNull(); propNode = propNode.nextSibling())
{
- QDomElement propEl = propNode.toElement();
+ TQDomElement propEl = propNode.toElement();
bool ok;
int intValue;
if (propEl.tagName()=="property") {
- QCString propertyName = propEl.attribute("name").latin1();
+ TQCString propertyName = propEl.attribute("name").latin1();
if (propEl.attribute("custom")=="true") {
//custom property
f->setCustomProperty(propertyName,
@@ -2762,7 +2762,7 @@ KexiDB::Field* Connection::setupField( const RowData &data )
if (!ok)
return 0;
Field::Type f_type = (Field::Type)f_int_type;
- int f_len = QMAX( 0, data.at(3).toInt(&ok) );
+ int f_len = TQMAX( 0, data.at(3).toInt(&ok) );
if (!ok)
return 0;
int f_prec = data.at(4).toInt(&ok);
@@ -2777,7 +2777,7 @@ KexiDB::Field* Connection::setupField( const RowData &data )
if (!KexiUtils::isIdentifier( data.at(2).toString() )) {
setError(ERR_INVALID_IDENTIFIER, i18n("Invalid object name \"%1\"")
- .arg( data.at(2).toString() ));
+ .tqarg( data.at(2).toString() ));
ok = false;
return 0;
}
@@ -2807,9 +2807,9 @@ KexiDB::TableSchema* Connection::setupTableSchema( const RowData &data )
KexiDB::Cursor *cursor;
if (!(cursor = executeQuery(
- QString::fromLatin1("SELECT t_id, f_type, f_name, f_length, f_precision, f_constraints, "
+ TQString::tqfromLatin1("SELECT t_id, f_type, f_name, f_length, f_precision, f_constraints, "
"f_options, f_default, f_order, f_caption, f_help"
- " FROM kexi__fields WHERE t_id=%1 ORDER BY f_order").arg(t->m_id) )))
+ " FROM kexi__fields WHERE t_id=%1 ORDER BY f_order").tqarg(t->m_id) )))
{
delete t;
return 0;
@@ -2859,17 +2859,17 @@ KexiDB::TableSchema* Connection::setupTableSchema( const RowData &data )
return t;
}
-TableSchema* Connection::tableSchema( const QString& tableName )
+TableSchema* Connection::tableSchema( const TQString& tableName )
{
- QString m_tableName = tableName.lower();
+ TQString m_tableName = tableName.lower();
TableSchema *t = d->tables_byname[m_tableName];
if (t)
return t;
//not found: retrieve schema
RowData data;
- if (true!=querySingleRecord(QString::fromLatin1(
+ if (true!=querySingleRecord(TQString::tqfromLatin1(
"SELECT o_id, o_type, o_name, o_caption, o_desc FROM kexi__objects WHERE lower(o_name)='%1' AND o_type=%2")
- .arg(m_tableName).arg(KexiDB::TableObjectType), data))
+ .tqarg(m_tableName).tqarg(KexiDB::TableObjectType), data))
return 0;
return setupTableSchema(data);
@@ -2882,30 +2882,30 @@ TableSchema* Connection::tableSchema( int tableId )
return t;
//not found: retrieve schema
RowData data;
- if (true!=querySingleRecord(QString::fromLatin1(
+ if (true!=querySingleRecord(TQString::tqfromLatin1(
"SELECT o_id, o_type, o_name, o_caption, o_desc FROM kexi__objects WHERE o_id=%1")
- .arg(tableId), data))
+ .tqarg(tableId), data))
return 0;
return setupTableSchema(data);
}
-tristate Connection::loadDataBlock( int objectID, QString &dataString, const QString& dataID )
+tristate Connection::loadDataBlock( int objectID, TQString &dataString, const TQString& dataID )
{
if (objectID<=0)
return false;
return querySingleString(
- QString("SELECT o_data FROM kexi__objectdata WHERE o_id=") + QString::number(objectID)
+ TQString("SELECT o_data FROM kexi__objectdata WHERE o_id=") + TQString::number(objectID)
+ " AND " + KexiDB::sqlWhere(m_driver, KexiDB::Field::Text, "o_sub_id", dataID),
dataString );
}
-bool Connection::storeDataBlock( int objectID, const QString &dataString, const QString& dataID )
+bool Connection::storeDataBlock( int objectID, const TQString &dataString, const TQString& dataID )
{
if (objectID<=0)
return false;
- QString sql(QString::fromLatin1("SELECT kexi__objectdata.o_id FROM kexi__objectdata WHERE o_id=%1").arg(objectID));
- QString sql_sub( KexiDB::sqlWhere(m_driver, KexiDB::Field::Text, "o_sub_id", dataID) );
+ TQString sql(TQString::tqfromLatin1("SELECT kexi__objectdata.o_id FROM kexi__objectdata WHERE o_id=%1").tqarg(objectID));
+ TQString sql_sub( KexiDB::sqlWhere(m_driver, KexiDB::Field::Text, "o_sub_id", dataID) );
bool ok, exists;
exists = resultExists(sql + " and " + sql_sub, ok);
@@ -2914,20 +2914,20 @@ bool Connection::storeDataBlock( int objectID, const QString &dataString, const
if (exists) {
return executeSQL( "UPDATE kexi__objectdata SET o_data="
+ m_driver->valueToSQL( KexiDB::Field::LongText, dataString )
- + " WHERE o_id=" + QString::number(objectID) + " AND " + sql_sub );
+ + " WHERE o_id=" + TQString::number(objectID) + " AND " + sql_sub );
}
return executeSQL(
- QString::fromLatin1("INSERT INTO kexi__objectdata (o_id, o_data, o_sub_id) VALUES (")
- + QString::number(objectID) +"," + m_driver->valueToSQL( KexiDB::Field::LongText, dataString )
+ TQString::tqfromLatin1("INSERT INTO kexi__objectdata (o_id, o_data, o_sub_id) VALUES (")
+ + TQString::number(objectID) +"," + m_driver->valueToSQL( KexiDB::Field::LongText, dataString )
+ "," + m_driver->valueToSQL( KexiDB::Field::Text, dataID ) + ")" );
}
-bool Connection::removeDataBlock( int objectID, const QString& dataID)
+bool Connection::removeDataBlock( int objectID, const TQString& dataID)
{
if (objectID<=0)
return false;
if (dataID.isEmpty())
- return KexiDB::deleteRow(*this, "kexi__objectdata", "o_id", QString::number(objectID));
+ return KexiDB::deleteRow(*this, "kexi__objectdata", "o_id", TQString::number(objectID));
else
return KexiDB::deleteRow(*this, "kexi__objectdata",
"o_id", KexiDB::Field::Integer, objectID, "o_sub_id", KexiDB::Field::Text, dataID);
@@ -2939,11 +2939,11 @@ KexiDB::QuerySchema* Connection::setupQuerySchema( const RowData &data )
const int objID = data[0].toInt(&ok);
if (!ok)
return false;
- QString sqlText;
+ TQString sqlText;
if (!loadDataBlock( objID, sqlText, "sql" )) {
setError(ERR_OBJECT_NOT_FOUND,
i18n("Could not find definition for query \"%1\". Removing this query is recommended.")
- .arg(data[2].toString()));
+ .tqarg(data[2].toString()));
return 0;
}
d->parser()->parse( sqlText );
@@ -2953,8 +2953,8 @@ KexiDB::QuerySchema* Connection::setupQuerySchema( const RowData &data )
setError(ERR_SQL_PARSE_ERROR,
i18n("<p>Could not load definition for query \"%1\". "
"SQL statement for this query is invalid:<br><tt>%2</tt></p>\n"
- "<p>You can open this query in Text View and correct it.</p>").arg(data[2].toString())
- .arg(d->parser()->statement()));
+ "<p>You can open this query in Text View and correct it.</p>").tqarg(data[2].toString())
+ .tqarg(d->parser()->statement()));
return 0;
}
if (!setupObjectSchemaData( data, *query )) {
@@ -2966,17 +2966,17 @@ KexiDB::QuerySchema* Connection::setupQuerySchema( const RowData &data )
return query;
}
-QuerySchema* Connection::querySchema( const QString& queryName )
+QuerySchema* Connection::querySchema( const TQString& queryName )
{
- QString m_queryName = queryName.lower();
+ TQString m_queryName = queryName.lower();
QuerySchema *q = d->queries_byname[m_queryName];
if (q)
return q;
//not found: retrieve schema
RowData data;
- if (true!=querySingleRecord(QString::fromLatin1(
+ if (true!=querySingleRecord(TQString::tqfromLatin1(
"SELECT o_id, o_type, o_name, o_caption, o_desc FROM kexi__objects WHERE lower(o_name)='%1' AND o_type=%2")
- .arg(m_queryName).arg(KexiDB::QueryObjectType), data))
+ .tqarg(m_queryName).tqarg(KexiDB::QueryObjectType), data))
return 0;
return setupQuerySchema(data);
@@ -2990,14 +2990,14 @@ QuerySchema* Connection::querySchema( int queryId )
//not found: retrieve schema
clearError();
RowData data;
- if (true!=querySingleRecord(QString::fromLatin1(
- "SELECT o_id, o_type, o_name, o_caption, o_desc FROM kexi__objects WHERE o_id=%1").arg(queryId), data))
+ if (true!=querySingleRecord(TQString::tqfromLatin1(
+ "SELECT o_id, o_type, o_name, o_caption, o_desc FROM kexi__objects WHERE o_id=%1").tqarg(queryId), data))
return 0;
return setupQuerySchema(data);
}
-bool Connection::setQuerySchemaObsolete( const QString& queryName )
+bool Connection::setQuerySchemaObsolete( const TQString& queryName )
{
QuerySchema* oldQuery = querySchema( queryName );
if (!oldQuery)
@@ -3008,14 +3008,14 @@ bool Connection::setQuerySchemaObsolete( const QString& queryName )
return true;
}
-TableSchema* Connection::newKexiDBSystemTableSchema(const QString& tsname)
+TableSchema* Connection::newKexiDBSystemTableSchema(const TQString& tsname)
{
TableSchema *ts = new TableSchema(tsname.lower());
insertInternalTableSchema( ts );
return ts;
}
-bool Connection::isInternalTableSchema(const QString& tableName)
+bool Connection::isInternalTableSchema(const TQString& tableName)
{
return (d->kexiDBSystemTables[ d->tables_byname[tableName] ])
// these are here for compatiblility because we're no longer instantiate
@@ -3119,7 +3119,7 @@ void Connection::removeMe(TableSchema *ts)
}
}
-QString Connection::anyAvailableDatabaseName()
+TQString Connection::anyAvailableDatabaseName()
{
if (!d->availableDatabaseName.isEmpty()) {
return d->availableDatabaseName;
@@ -3127,19 +3127,19 @@ QString Connection::anyAvailableDatabaseName()
return m_driver->beh->ALWAYS_AVAILABLE_DATABASE_NAME;
}
-void Connection::setAvailableDatabaseName(const QString& dbName)
+void Connection::setAvailableDatabaseName(const TQString& dbName)
{
d->availableDatabaseName = dbName;
}
//! @internal used in updateRow(), insertRow(),
inline void updateRowDataWithNewValues(QuerySchema &query, RowData& data, KexiDB::RowEditBuffer::DBMap& b,
- QMap<QueryColumnInfo*,int>& columnsOrderExpanded)
+ TQMap<QueryColumnInfo*,int>& columnsOrderExpanded)
{
columnsOrderExpanded = query.columnsOrder(QuerySchema::ExpandedList);
- QMap<QueryColumnInfo*,int>::ConstIterator columnsOrderExpandedIt;
+ TQMap<QueryColumnInfo*,int>::ConstIterator columnsOrderExpandedIt;
for (KexiDB::RowEditBuffer::DBMap::ConstIterator it=b.constBegin();it!=b.constEnd();++it) {
- columnsOrderExpandedIt = columnsOrderExpanded.find( it.key() );
+ columnsOrderExpandedIt = columnsOrderExpanded.tqfind( it.key() );
if (columnsOrderExpandedIt == columnsOrderExpanded.constEnd()) {
KexiDBWarn << "(Connection) updateRowDataWithNewValues(): \"now also assign new value in memory\" step "
"- could not find item '" << it.key()->aliasOrName() << "'" << endl;
@@ -3178,7 +3178,7 @@ bool Connection::updateRow(QuerySchema &query, RowData& data, RowEditBuffer& buf
}
//update the record:
m_sql = "UPDATE " + escapeIdentifier(mt->name()) + " SET ";
- QString sqlset, sqlwhere;
+ TQString sqlset, sqlwhere;
sqlset.reserve(1024);
sqlwhere.reserve(1024);
KexiDB::RowEditBuffer::DBMap b = buf.dbBuffer();
@@ -3191,7 +3191,7 @@ bool Connection::updateRow(QuerySchema &query, RowData& data, RowEditBuffer& buf
m_driver->valueToSQL(it.key()->field,it.data()));
}
if (pkey) {
- const QValueVector<int> pkeyFieldsOrder( query.pkeyFieldsOrder() );
+ const TQValueVector<int> pkeyFieldsOrder( query.pkeyFieldsOrder() );
KexiDBDbg << pkey->fieldCount() << " ? " << query.pkeyFieldsCount() << endl;
if (pkey->fieldCount() != query.pkeyFieldsCount()) { //sanity check
KexiDBWarn << " -- NO ENTIRE MASTER TABLE's PKEY SPECIFIED!" << endl;
@@ -3204,10 +3204,10 @@ bool Connection::updateRow(QuerySchema &query, RowData& data, RowEditBuffer& buf
for (Field::ListIterator it = pkey->fieldsIterator(); it.current(); i++, ++it) {
if (!sqlwhere.isEmpty())
sqlwhere+=" AND ";
- QVariant val = data[ pkeyFieldsOrder[i] ];
+ TQVariant val = data[ pkeyFieldsOrder[i] ];
if (val.isNull() || !val.isValid()) {
setError(ERR_UPDATE_NULL_PKEY_FIELD,
- i18n("Primary key's field \"%1\" cannot be empty.").arg(it.current()->name()));
+ i18n("Primary key's field \"%1\" cannot be empty.").tqarg(it.current()->name()));
//js todo: pass the field's name somewhere!
return false;
}
@@ -3228,7 +3228,7 @@ bool Connection::updateRow(QuerySchema &query, RowData& data, RowEditBuffer& buf
return false;
}
//success: now also assign new values in memory:
- QMap<QueryColumnInfo*,int> columnsOrderExpanded;
+ TQMap<QueryColumnInfo*,int> columnsOrderExpanded;
updateRowDataWithNewValues(query, data, b, columnsOrderExpanded);
return true;
}
@@ -3254,7 +3254,7 @@ bool Connection::insertRow(QuerySchema &query, RowData& data, RowEditBuffer& buf
if (!getROWID && !pkey)
KexiDBWarn << " -- WARNING: NO MASTER TABLE's PKEY" << endl;
- QString sqlcols, sqlvals;
+ TQString sqlcols, sqlvals;
sqlcols.reserve(1024);
sqlvals.reserve(1024);
@@ -3268,7 +3268,7 @@ bool Connection::insertRow(QuerySchema &query, RowData& data, RowEditBuffer& buf
QueryColumnInfo *ci = fieldsExpanded.at(i);
if (ci->field && KexiDB::isDefaultValueAllowed(ci->field)
&& !ci->field->defaultValue().isNull()
- && !b.contains( ci ))
+ && !b.tqcontains( ci ))
{
KexiDBDbg << "Connection::insertRow(): adding default value '" << ci->field->defaultValue().toString()
<< "' for column '" << ci->field->name() << "'" << endl;
@@ -3279,19 +3279,19 @@ bool Connection::insertRow(QuerySchema &query, RowData& data, RowEditBuffer& buf
if (b.isEmpty()) {
// empty row inserting requested:
if (!getROWID && !pkey) {
- KexiDBWarn << "MASTER TABLE's PKEY REQUIRED FOR INSERTING EMPTY ROWS: INSERT CANCELLED" << endl;
+ KexiDBWarn << "MASTER TABLE's PKEY RETQUIRED FOR INSERTING EMPTY ROWS: INSERT CANCELLED" << endl;
setError(ERR_INSERT_NO_MASTER_TABLES_PKEY,
i18n("Could not insert row because master table has no primary key defined."));
return false;
}
if (pkey) {
- const QValueVector<int> pkeyFieldsOrder( query.pkeyFieldsOrder() );
+ const TQValueVector<int> pkeyFieldsOrder( query.pkeyFieldsOrder() );
// KexiDBDbg << pkey->fieldCount() << " ? " << query.pkeyFieldsCount() << endl;
if (pkey->fieldCount() != query.pkeyFieldsCount()) { //sanity check
KexiDBWarn << "NO ENTIRE MASTER TABLE's PKEY SPECIFIED!" << endl;
setError(ERR_INSERT_NO_ENTIRE_MASTER_TABLES_PKEY,
i18n("Could not insert row because it does not contain entire master table's primary key.")
- .arg(query.name()));
+ .tqarg(query.name()));
return false;
}
}
@@ -3308,7 +3308,7 @@ bool Connection::insertRow(QuerySchema &query, RowData& data, RowEditBuffer& buf
}
}
sqlcols += escapeIdentifier(anyField->name());
- sqlvals += m_driver->valueToSQL(anyField,QVariant()/*NULL*/);
+ sqlvals += m_driver->valueToSQL(anyField,TQVariant()/*NULL*/);
}
else {
// non-empty row inserting requested:
@@ -3333,31 +3333,31 @@ bool Connection::insertRow(QuerySchema &query, RowData& data, RowEditBuffer& buf
return false;
}
//success: now also assign a new value in memory:
- QMap<QueryColumnInfo*,int> columnsOrderExpanded;
+ TQMap<QueryColumnInfo*,int> columnsOrderExpanded;
updateRowDataWithNewValues(query, data, b, columnsOrderExpanded);
//fetch autoincremented values
QueryColumnInfo::List *aif_list = query.autoIncrementFields();
- Q_ULLONG ROWID = 0;
+ TQ_ULLONG ROWID = 0;
if (pkey && !aif_list->isEmpty()) {
//! @todo now only if PKEY is present, this should also work when there's no PKEY
QueryColumnInfo *id_columnInfo = aif_list->first();
//! @todo safe to cast it?
- Q_ULLONG last_id = lastInsertedAutoIncValue(
+ TQ_ULLONG last_id = lastInsertedAutoIncValue(
id_columnInfo->field->name(), id_columnInfo->field->table()->name(), &ROWID);
- if (last_id==(Q_ULLONG)-1 || last_id<=0) {
+ if (last_id==(TQ_ULLONG)-1 || last_id<=0) {
//! @todo show error
//! @todo remove just inserted row. How? Using ROLLBACK?
return false;
}
RowData aif_data;
- QString getAutoIncForInsertedValue = QString::fromLatin1("SELECT ")
+ TQString getAutoIncForInsertedValue = TQString::tqfromLatin1("SELECT ")
+ query.autoIncrementSQLFieldsList(m_driver)
- + QString::fromLatin1(" FROM ")
+ + TQString::tqfromLatin1(" FROM ")
+ escapeIdentifier(id_columnInfo->field->table()->name())
- + QString::fromLatin1(" WHERE ")
+ + TQString::tqfromLatin1(" WHERE ")
+ escapeIdentifier(id_columnInfo->field->name()) + "="
- + QString::number(last_id);
+ + TQString::number(last_id);
if (true!=querySingleRecord(getAutoIncForInsertedValue, aif_data)) {
//! @todo show error
return false;
@@ -3395,7 +3395,7 @@ bool Connection::deleteRow(QuerySchema &query, RowData& data, bool useROWID)
KexiDBWarn << " -- NO MASTER TABLE!" << endl;
setError(ERR_DELETE_NO_MASTER_TABLE,
i18n("Could not delete row because there is no master table defined.")
- .arg(query.name()));
+ .tqarg(query.name()));
return false;
}
IndexSchema *pkey = (mt->primaryKey() && !mt->primaryKey()->fields()->isEmpty()) ? mt->primaryKey() : 0;
@@ -3410,11 +3410,11 @@ bool Connection::deleteRow(QuerySchema &query, RowData& data, bool useROWID)
//update the record:
m_sql = "DELETE FROM " + escapeIdentifier(mt->name()) + " WHERE ";
- QString sqlwhere;
+ TQString sqlwhere;
sqlwhere.reserve(1024);
if (pkey) {
- const QValueVector<int> pkeyFieldsOrder( query.pkeyFieldsOrder() );
+ const TQValueVector<int> pkeyFieldsOrder( query.pkeyFieldsOrder() );
KexiDBDbg << pkey->fieldCount() << " ? " << query.pkeyFieldsCount() << endl;
if (pkey->fieldCount() != query.pkeyFieldsCount()) { //sanity check
KexiDBWarn << " -- NO ENTIRE MASTER TABLE's PKEY SPECIFIED!" << endl;
@@ -3426,10 +3426,10 @@ bool Connection::deleteRow(QuerySchema &query, RowData& data, bool useROWID)
for (Field::ListIterator it = pkey->fieldsIterator(); it.current(); i++, ++it) {
if (!sqlwhere.isEmpty())
sqlwhere+=" AND ";
- QVariant val = data[ pkeyFieldsOrder[i] ];
+ TQVariant val = data[ pkeyFieldsOrder[i] ];
if (val.isNull() || !val.isValid()) {
setError(ERR_DELETE_NULL_PKEY_FIELD, i18n("Primary key's field \"%1\" cannot be empty.")
- .arg(it.current()->name()));
+ .tqarg(it.current()->name()));
//js todo: pass the field's name somewhere!
return false;
}
@@ -3477,20 +3477,20 @@ bool Connection::deleteAllRows(QuerySchema &query)
void Connection::registerForTableSchemaChanges(TableSchemaChangeListenerInterface& listener,
TableSchema &schema)
{
- QPtrList<TableSchemaChangeListenerInterface>* listeners = d->tableSchemaChangeListeners[&schema];
+ TQPtrList<TableSchemaChangeListenerInterface>* listeners = d->tableSchemaChangeListeners[&schema];
if (!listeners) {
- listeners = new QPtrList<TableSchemaChangeListenerInterface>();
+ listeners = new TQPtrList<TableSchemaChangeListenerInterface>();
d->tableSchemaChangeListeners.insert(&schema, listeners);
}
//TODO: inefficient
- if (listeners->findRef( &listener )==-1)
+ if (listeners->tqfindRef( &listener )==-1)
listeners->append( &listener );
}
void Connection::unregisterForTableSchemaChanges(TableSchemaChangeListenerInterface& listener,
TableSchema &schema)
{
- QPtrList<TableSchemaChangeListenerInterface>* listeners = d->tableSchemaChangeListeners[&schema];
+ TQPtrList<TableSchemaChangeListenerInterface>* listeners = d->tableSchemaChangeListeners[&schema];
if (!listeners)
return;
//TODO: inefficient
@@ -3499,15 +3499,15 @@ void Connection::unregisterForTableSchemaChanges(TableSchemaChangeListenerInterf
void Connection::unregisterForTablesSchemaChanges(TableSchemaChangeListenerInterface& listener)
{
- for (QPtrDictIterator< QPtrList<TableSchemaChangeListenerInterface> > it(d->tableSchemaChangeListeners);
+ for (TQPtrDictIterator< TQPtrList<TableSchemaChangeListenerInterface> > it(d->tableSchemaChangeListeners);
it.current(); ++it)
{
- if (-1!=it.current()->find(&listener))
+ if (-1!=it.current()->tqfind(&listener))
it.current()->take();
}
}
-QPtrList<Connection::TableSchemaChangeListenerInterface>*
+TQPtrList<Connection::TableSchemaChangeListenerInterface>*
Connection::tableSchemaChangeListeners(TableSchema& tableSchema) const
{
KexiDBDbg << d->tableSchemaChangeListeners.count() << endl;
@@ -3516,13 +3516,13 @@ Connection::tableSchemaChangeListeners(TableSchema& tableSchema) const
tristate Connection::closeAllTableSchemaChangeListeners(TableSchema& tableSchema)
{
- QPtrList<Connection::TableSchemaChangeListenerInterface> *listeners = d->tableSchemaChangeListeners[&tableSchema];
+ TQPtrList<Connection::TableSchemaChangeListenerInterface> *listeners = d->tableSchemaChangeListeners[&tableSchema];
if (!listeners)
return true;
- QPtrListIterator<KexiDB::Connection::TableSchemaChangeListenerInterface> tmpListeners(*listeners); //safer copy
+ TQPtrListIterator<KexiDB::Connection::TableSchemaChangeListenerInterface> tmpListeners(*listeners); //safer copy
tristate res = true;
//try to close every window
- for (QPtrListIterator<KexiDB::Connection::TableSchemaChangeListenerInterface> it(tmpListeners);
+ for (TQPtrListIterator<KexiDB::Connection::TableSchemaChangeListenerInterface> it(tmpListeners);
it.current() && res==true; ++it)
{
res = it.current()->closeListener();