summaryrefslogtreecommitdiffstats
path: root/kexi/kexidb/drivers/sqlite/sqliteconnection.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kexi/kexidb/drivers/sqlite/sqliteconnection.cpp')
-rw-r--r--kexi/kexidb/drivers/sqlite/sqliteconnection.cpp76
1 files changed, 38 insertions, 38 deletions
diff --git a/kexi/kexidb/drivers/sqlite/sqliteconnection.cpp b/kexi/kexidb/drivers/sqlite/sqliteconnection.cpp
index 6de41c59..27f190b8 100644
--- a/kexi/kexidb/drivers/sqlite/sqliteconnection.cpp
+++ b/kexi/kexidb/drivers/sqlite/sqliteconnection.cpp
@@ -33,9 +33,9 @@
#include <kexidb/error.h>
#include <kexiutils/utils.h>
-#include <qfile.h>
-#include <qdir.h>
-#include <qregexp.h>
+#include <tqfile.h>
+#include <tqdir.h>
+#include <tqregexp.h>
#include <kgenericfactory.h>
#include <kdebug.h>
@@ -103,8 +103,8 @@ SQLiteConnection::~SQLiteConnection()
bool SQLiteConnection::drv_connect(KexiDB::ServerVersionInfo& version)
{
KexiDBDrvDbg << "SQLiteConnection::connect()" << endl;
- version.string = QString(SQLITE_VERSION); //defined in sqlite3.h
- QRegExp re("(\\d+)\\.(\\d+)\\.(\\d+)");
+ version.string = TQString(SQLITE_VERSION); //defined in sqlite3.h
+ TQRegExp re("(\\d+)\\.(\\d+)\\.(\\d+)");
if (re.exactMatch(version.string)) {
version.major = re.cap(1).toUInt();
version.minor = re.cap(2).toUInt();
@@ -119,21 +119,21 @@ bool SQLiteConnection::drv_disconnect()
return true;
}
-bool SQLiteConnection::drv_getDatabasesList( QStringList &list )
+bool SQLiteConnection::drv_getDatabasesList( TQStringList &list )
{
//this is one-db-per-file database
list.append( data()->fileName() ); //more consistent than dbFileName() ?
return true;
}
-bool SQLiteConnection::drv_containsTable( const QString &tableName )
+bool SQLiteConnection::drv_containsTable( const TQString &tableName )
{
bool success;
- return resultExists(QString("select name from sqlite_master where type='table' and name LIKE %1")
- .arg(driver()->escapeString(tableName)), success) && success;
+ return resultExists(TQString("select name from sqlite_master where type='table' and name LIKE %1")
+ .tqarg(driver()->escapeString(tableName)), success) && success;
}
-bool SQLiteConnection::drv_getTablesList( QStringList &list )
+bool SQLiteConnection::drv_getTablesList( TQStringList &list )
{
KexiDB::Cursor *cursor;
m_sql = "select lower(name) from sqlite_master where type='table'";
@@ -154,19 +154,19 @@ bool SQLiteConnection::drv_getTablesList( QStringList &list )
return deleteCursor(cursor);
}
-bool SQLiteConnection::drv_createDatabase( const QString &dbName )
+bool SQLiteConnection::drv_createDatabase( const TQString &dbName )
{
// SQLite creates a new db is it does not exist
return drv_useDatabase(dbName);
#if 0
- d->data = sqlite_open( QFile::encodeName( data()->fileName() ), 0/*mode: unused*/,
+ d->data = sqlite_open( TQFile::encodeName( data()->fileName() ), 0/*mode: unused*/,
&d->errmsg_p );
d->storeResult();
return d->data != 0;
#endif
}
-bool SQLiteConnection::drv_useDatabase( const QString &dbName, bool *cancelled,
+bool SQLiteConnection::drv_useDatabase( const TQString &dbName, bool *cancelled,
MessageHandler* msgHandler )
{
Q_UNUSED(dbName);
@@ -174,7 +174,7 @@ bool SQLiteConnection::drv_useDatabase( const QString &dbName, bool *cancelled,
#ifdef SQLITE2
Q_UNUSED(cancelled);
Q_UNUSED(msgHandler);
- d->data = sqlite_open( QFile::encodeName( data()->fileName() ), 0/*mode: unused*/,
+ d->data = sqlite_open( TQFile::encodeName( data()->fileName() ), 0/*mode: unused*/,
&d->errmsg_p );
d->storeResult();
return d->data != 0;
@@ -187,8 +187,8 @@ bool SQLiteConnection::drv_useDatabase( const QString &dbName, bool *cancelled,
const bool wasReadOnly = Connection::isReadOnly();
d->res = sqlite3_open(
- //QFile::encodeName( data()->fileName() ),
- data()->fileName().utf8(), /* unicode expected since SQLite 3.1 */
+ //TQFile::encodeName( data()->fileName() ),
+ data()->fileName().utf8(), /* tqunicode expected since SQLite 3.1 */
&d->data,
exclusiveFlag,
allowReadonly /* If 1 and locking fails, try opening in read-only mode */
@@ -200,7 +200,7 @@ bool SQLiteConnection::drv_useDatabase( const QString &dbName, bool *cancelled,
if (KMessageBox::Continue !=
askQuestion(
i18n("Do you want to open file \"%1\" as read-only?")
- .arg(QDir::convertSeparators(data()->fileName()))
+ .tqarg(TQDir::convertSeparators(data()->fileName()))
+ "\n\n"
+ i18n("The file is probably already open on this or another computer.") + " "
+ i18n("Could not gain exclusive access for writing the file."),
@@ -258,21 +258,21 @@ bool SQLiteConnection::drv_closeDatabase()
#endif
}
-bool SQLiteConnection::drv_dropDatabase( const QString &dbName )
+bool SQLiteConnection::drv_dropDatabase( const TQString &dbName )
{
Q_UNUSED(dbName); // Each database is one single SQLite file.
- const QString filename = data()->fileName();
- if (QFile(filename).exists() && !QDir().remove(filename)) {
+ const TQString filename = data()->fileName();
+ if (TQFile(filename).exists() && !TQDir().remove(filename)) {
setError(ERR_ACCESS_RIGHTS, i18n("Could not remove file \"%1\".")
- .arg(QDir::convertSeparators(filename)) + " "
+ .tqarg(TQDir::convertSeparators(filename)) + " "
+ i18n("Check the file's permissions and whether it is already opened and locked by another application."));
return false;
}
return true;
}
-//CursorData* SQLiteConnection::drv_createCursor( const QString& statement )
-Cursor* SQLiteConnection::prepareQuery( const QString& statement, uint cursor_options )
+//CursorData* SQLiteConnection::drv_createCursor( const TQString& statement )
+Cursor* SQLiteConnection::prepareQuery( const TQString& statement, uint cursor_options )
{
return new SQLiteCursor( this, statement, cursor_options );
}
@@ -282,10 +282,10 @@ Cursor* SQLiteConnection::prepareQuery( QuerySchema& query, uint cursor_options
return new SQLiteCursor( this, query, cursor_options );
}
-bool SQLiteConnection::drv_executeSQL( const QString& statement )
+bool SQLiteConnection::drv_executeSQL( const TQString& statement )
{
// KexiDBDrvDbg << "SQLiteConnection::drv_executeSQL(" << statement << ")" <<endl;
-// QCString st(statement.length()*2);
+// TQCString st(statement.length()*2);
// st = escapeString( statement.local8Bit() ); //?
#ifdef SQLITE_UTF8
d->temp_st = statement.utf8();
@@ -294,7 +294,7 @@ bool SQLiteConnection::drv_executeSQL( const QString& statement )
#endif
#ifdef KEXI_DEBUG_GUI
- KexiUtils::addKexiDBDebug(QString("ExecuteSQL (SQLite): ")+statement);
+ KexiUtils::addKexiDBDebug(TQString("ExecuteSQL (SQLite): ")+statement);
#endif
d->res = sqlite_exec(
@@ -310,9 +310,9 @@ bool SQLiteConnection::drv_executeSQL( const QString& statement )
return d->res==SQLITE_OK;
}
-Q_ULLONG SQLiteConnection::drv_lastInsertRowID()
+TQ_ULLONG SQLiteConnection::drv_lastInsertRowID()
{
- return (Q_ULLONG)sqlite_last_insert_rowid(d->data);
+ return (TQ_ULLONG)sqlite_last_insert_rowid(d->data);
}
int SQLiteConnection::serverResult()
@@ -320,13 +320,13 @@ int SQLiteConnection::serverResult()
return d->res==0 ? Connection::serverResult() : d->res;
}
-QString SQLiteConnection::serverResultName()
+TQString SQLiteConnection::serverResultName()
{
- QString r =
+ TQString r =
#ifdef SQLITE2
- QString::fromLatin1( sqlite_error_string(d->res) );
+ TQString::tqfromLatin1( sqlite_error_string(d->res) );
#else //SQLITE3
- QString::null; //fromLatin1( d->result_name );
+ TQString(); //tqfromLatin1( d->result_name );
#endif
return r.isEmpty() ? Connection::serverResultName() : r;
}
@@ -343,7 +343,7 @@ void SQLiteConnection::drv_clearServerResult()
#endif
}
-QString SQLiteConnection::serverErrorMsg()
+TQString SQLiteConnection::serverErrorMsg()
{
return d->errmsg.isEmpty() ? Connection::serverErrorMsg() : d->errmsg;
}
@@ -366,14 +366,14 @@ bool SQLiteConnection::isReadOnly() const
}
#ifdef SQLITE2
-bool SQLiteConnection::drv_alterTableName(TableSchema& tableSchema, const QString& newName, bool replace)
+bool SQLiteConnection::drv_alterTableName(TableSchema& tableSchema, const TQString& newName, bool tqreplace)
{
- const QString oldTableName = tableSchema.name();
+ const TQString oldTableName = tableSchema.name();
const bool destTableExists = this->tableSchema( newName ) != 0;
//1. drop the table
if (destTableExists) {
- if (!replace)
+ if (!tqreplace)
return false;
if (!drv_dropTable( newName ))
return false;
@@ -395,8 +395,8 @@ bool SQLiteConnection::drv_alterTableName(TableSchema& tableSchema, const QStrin
//TODO indices, etc.???
// 3. copy all rows to the new table
- if (!executeSQL(QString::fromLatin1("INSERT INTO %1 SELECT * FROM %2")
- .arg(escapeIdentifier(tableSchema.name())).arg(escapeIdentifier(oldTableName))))
+ if (!executeSQL(TQString::tqfromLatin1("INSERT INTO %1 SELECT * FROM %2")
+ .tqarg(escapeIdentifier(tableSchema.name())).tqarg(escapeIdentifier(oldTableName))))
{
drv_alterTableName_ERR;
return false;