summaryrefslogtreecommitdiffstats
path: root/kexi/kexidb/connection.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kexi/kexidb/connection.cpp')
-rw-r--r--kexi/kexidb/connection.cpp246
1 files changed, 123 insertions, 123 deletions
diff --git a/kexi/kexidb/connection.cpp b/kexi/kexidb/connection.cpp
index 017e75e4..4af6cae6 100644
--- a/kexi/kexidb/connection.cpp
+++ b/kexi/kexidb/connection.cpp
@@ -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(TQDir::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;
}
@@ -363,7 +363,7 @@ bool Connection::drv_databaseExists( const TQString &dbName, bool ignoreErrors )
if (list.find( 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;
}
@@ -384,19 +384,19 @@ bool Connection::databaseExists( const TQString &dbName, bool ignoreErrors )
if (!file.exists() || ( !file.isFile() && !file.isSymLink()) ) {
if (!ignoreErrors)
setError(ERR_OBJECT_NOT_FOUND, i18n("Database file \"%1\" does not exist.")
- .arg(TQDir::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(TQDir::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(TQDir::convertSeparators(d->conn_data->fileName())) );
+ .tqarg(TQDir::convertSeparators(d->conn_data->fileName())) );
return false;
}
return true;
@@ -424,7 +424,7 @@ bool Connection::databaseExists( const TQString &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; \
} }
@@ -438,12 +438,12 @@ bool Connection::createDatabase( const TQString &dbName )
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()) {
@@ -458,7 +458,7 @@ bool Connection::createDatabase( const TQString &dbName )
//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 TQString &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;
}
}
@@ -566,7 +566,7 @@ bool Connection::useDatabase( const TQString &dbName, bool kexiCompatible, bool
if (!drv_useDatabase( my_dbName, cancelled, msgHandler )) {
if (cancelled && *cancelled)
return false;
- TQString 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
@@ -589,7 +589,7 @@ bool Connection::useDatabase( const TQString &dbName, bool kexiCompatible, bool
d->databaseVersion.major = num;
/* if (true!=querySingleNumber(
"select db_value from kexi__db where db_property=" + m_driver->escapeString(TQString("kexidb_major_ver")), num)) {
- d->errorInvalidDBContents(notfound_str.arg("kexidb_major_ver"));
+ d->errorInvalidDBContents(notfound_str.tqarg("kexidb_major_ver"));
return false;
}*/
num = d->dbProperties->value("kexidb_minor_ver").toInt(&ok);
@@ -598,7 +598,7 @@ bool Connection::useDatabase( const TQString &dbName, bool kexiCompatible, bool
d->databaseVersion.minor = num;
/* if (true!=querySingleNumber(
"select db_value from kexi__db where db_property=" + m_driver->escapeString(TQString("kexidb_minor_ver")), num)) {
- d->errorInvalidDBContents(notfound_str.arg("kexidb_minor_ver"));
+ d->errorInvalidDBContents(notfound_str.tqarg("kexidb_minor_ver"));
return false;
}*/
@@ -607,8 +607,8 @@ bool Connection::useDatabase( const TQString &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( TQString("%1.%2").arg(versionMajor()).arg(versionMinor()) )
- .arg( TQString("%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()) {
@@ -686,7 +686,7 @@ bool Connection::useTemporaryDatabaseIfNeeded(TQString &tmpdbName)
if (!ret) {
setError(errorNum(),
i18n("Error during starting temporary connection using \"%1\" database name.")
- .arg(tmpdbName) );
+ .tqarg(tmpdbName) );
return false;
}
}
@@ -725,7 +725,7 @@ bool Connection::dropDatabase( const TQString &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;
}
@@ -765,7 +765,7 @@ TQStringList Connection::objectNames(int objType, bool* ok)
if (objType==KexiDB::AnyObjectType)
sql = "SELECT o_name FROM kexi__objects";
else
- sql = TQString::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) {
@@ -852,7 +852,7 @@ TQValueList<int> Connection::objectIds(int objType)
return list;
Cursor *c = executeQuery(
- TQString::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())
@@ -903,12 +903,12 @@ TQString Connection::createTableStatement( const KexiDB::TableSchema& tableSchem
if (field->isFPNumericType() && field->precision()>0) {
if (field->scale()>0)
- v += TQString::fromLatin1("(%1,%2)").arg(field->precision()).arg(field->scale());
+ v += TQString::tqfromLatin1("(%1,%2)").tqarg(field->precision()).tqarg(field->scale());
else
- v += TQString::fromLatin1("(%1)").arg(field->precision());
+ v += TQString::tqfromLatin1("(%1)").tqarg(field->precision());
}
else if (field->type()==Field::Text && field->length()>0)
- v += TQString::fromLatin1("(%1)").arg(field->length());
+ v += TQString::tqfromLatin1("(%1)").tqarg(field->length());
if (autoinc)
v += (" " +
@@ -925,7 +925,7 @@ TQString Connection::createTableStatement( const KexiDB::TableSchema& tableSchem
if (field->defaultValue().isValid()) {
TQString valToSQL( m_driver->valueToSQL( field, field->defaultValue() ) );
if (!valToSQL.isEmpty()) //for sanity
- v += TQString::fromLatin1(" DEFAULT ") + valToSQL;
+ v += TQString::tqfromLatin1(" DEFAULT ") + valToSQL;
}
}
sql += v;
@@ -1106,14 +1106,14 @@ TQString Connection::selectStatement( KexiDB::QuerySchema& querySchema,
for (Field::ListIterator it = querySchema.fieldsIterator(); (f = it.current()); ++it, number++) {
if (querySchema.isColumnVisible(number)) {
if (!sql.isEmpty())
- sql += TQString::fromLatin1(", ");
+ sql += TQString::tqfromLatin1(", ");
if (f->isQueryAsterisk()) {
if (!singleTable && static_cast<QueryAsterisk*>(f)->isSingleTableAsterisk()) //single-table *
sql += escapeIdentifier(f->table()->name(), options.identifierEscaping) +
- TQString::fromLatin1(".*");
+ TQString::tqfromLatin1(".*");
else //all-tables * (or simplified table.* when there's only one table)
- sql += TQString::fromLatin1("*");
+ sql += TQString::tqfromLatin1("*");
}
else {
if (f->isExpression()) {
@@ -1137,7 +1137,7 @@ TQString Connection::selectStatement( KexiDB::QuerySchema& querySchema,
}
TQString aliasString = TQString(querySchema.columnAlias(number));
if (!aliasString.isEmpty())
- sql += (TQString::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 @@ TQString Connection::selectStatement( KexiDB::QuerySchema& querySchema,
{
//add LEFT OUTER JOIN
if (!s_additional_joins.isEmpty())
- s_additional_joins += TQString::fromLatin1(" ");
+ 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")
- .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));
+ .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 @@ TQString Connection::selectStatement( KexiDB::QuerySchema& querySchema,
/* not true
//table should be added after FROM
if (!s_from_additional.isEmpty())
- s_from_additional += TQString::fromLatin1(", ");
+ s_from_additional += TQString::tqfromLatin1(", ");
s_from_additional += escapeIdentifier(visibleField->table()->name(), options.identifierEscaping);
*/
}
#endif
if (!s_additional_fields.isEmpty())
- s_additional_fields += TQString::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 ? ?"
@@ -1216,20 +1216,20 @@ TQString Connection::selectStatement( KexiDB::QuerySchema& querySchema,
}
//add LEFT OUTER JOIN
if (!s_additional_joins.isEmpty())
- s_additional_joins += TQString::fromLatin1(" ");
+ s_additional_joins += TQString::tqfromLatin1(" ");
TQString internalUniqueQueryAlias(
kexidb_subquery_prefix + lookupQuery->name() + "_"
+ TQString::number(internalUniqueQueryAliasNumber++) );
s_additional_joins += TQString("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));
+ .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 += TQString::fromLatin1(", ");
+ s_additional_fields += TQString::tqfromLatin1(", ");
const TQValueList<uint> visibleColumns( lookupFieldSchema->visibleColumns() );
TQString expression;
foreach (TQValueList<uint>::ConstIterator, visibleColumnsIt, visibleColumns) {
@@ -1260,12 +1260,12 @@ TQString Connection::selectStatement( KexiDB::QuerySchema& querySchema,
//add lookup fields
if (!s_additional_fields.isEmpty())
- sql += (TQString::fromLatin1(", ") + s_additional_fields);
+ sql += (TQString::tqfromLatin1(", ") + s_additional_fields);
if (options.alsoRetrieveROWID) { //append rowid column
TQString s;
if (!sql.isEmpty())
- s = TQString::fromLatin1(", ");
+ s = TQString::tqfromLatin1(", ");
if (querySchema.masterTable())
s += (escapeIdentifier(querySchema.masterTable()->name())+".");
s += m_driver->beh->ROW_ID_FIELD_NAME;
@@ -1275,7 +1275,7 @@ TQString Connection::selectStatement( KexiDB::QuerySchema& querySchema,
sql.prepend("SELECT ");
TableSchema::List* tables = querySchema.tables();
if ((tables && !tables->isEmpty()) || !subqueries_for_lookup_data.isEmpty()) {
- sql += TQString::fromLatin1(" FROM ");
+ sql += TQString::tqfromLatin1(" FROM ");
TQString s_from;
if (tables) {
TableSchema *table;
@@ -1284,15 +1284,15 @@ TQString Connection::selectStatement( KexiDB::QuerySchema& querySchema,
++it, number++)
{
if (!s_from.isEmpty())
- s_from += TQString::fromLatin1(", ");
+ s_from += TQString::tqfromLatin1(", ");
s_from += escapeIdentifier(table->name(), options.identifierEscaping);
TQString aliasString = TQString(querySchema.tableAlias(number));
if (!aliasString.isEmpty())
- s_from += (TQString::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 += TQString::fromLatin1(", ");
+ s_from += TQString::tqfromLatin1(", ");
s_from += s_from_additional;
}*/
}
@@ -1302,11 +1302,11 @@ TQString Connection::selectStatement( KexiDB::QuerySchema& querySchema,
subqueries_for_lookup_data.current(); ++it, subqueries_for_lookup_data_counter++)
{
if (!s_from.isEmpty())
- s_from += TQString::fromLatin1(", ");
- s_from += TQString::fromLatin1("(");
+ s_from += TQString::tqfromLatin1(", ");
+ s_from += TQString::tqfromLatin1("(");
s_from += selectStatement( *it.current(), params, options );
- s_from += TQString::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;
}
@@ -1315,7 +1315,7 @@ TQString Connection::selectStatement( KexiDB::QuerySchema& querySchema,
//JOINS
if (!s_additional_joins.isEmpty()) {
- sql += TQString::fromLatin1(" ") + s_additional_joins + TQString::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 @@ TQString Connection::selectStatement( KexiDB::QuerySchema& querySchema,
wasWhere = true;
}
else
- s_where += TQString::fromLatin1(" AND ");
+ s_where += TQString::tqfromLatin1(" AND ");
Field::Pair *pair;
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 += TQString::fromLatin1(" AND ");
+ s_where_sub += TQString::tqfromLatin1(" AND ");
s_where_sub += (
escapeIdentifier(pair->first->table()->name(), options.identifierEscaping) +
- TQString::fromLatin1(".") +
+ TQString::tqfromLatin1(".") +
escapeIdentifier(pair->first->name(), options.identifierEscaping) +
- TQString::fromLatin1(" = ") +
+ TQString::tqfromLatin1(" = ") +
escapeIdentifier(pair->second->table()->name(), options.identifierEscaping) +
- TQString::fromLatin1(".") +
+ TQString::tqfromLatin1(".") +
escapeIdentifier(pair->second->name(), options.identifierEscaping));
}
if (rel->fieldPairs()->count()>1) {
s_where_sub.prepend("(");
- s_where_sub += TQString::fromLatin1(")");
+ s_where_sub += TQString::tqfromLatin1(")");
}
s_where += s_where_sub;
}
@@ -1362,7 +1362,7 @@ TQString Connection::selectStatement( KexiDB::QuerySchema& querySchema,
}
}
if (!s_where.isEmpty())
- sql += TQString::fromLatin1(" WHERE ") + s_where;
+ sql += TQString::tqfromLatin1(" WHERE ") + s_where;
//! \todo (js) add other sql parts
//(use wasWhere here)
@@ -1424,8 +1424,8 @@ TQ_ULLONG Connection::lastInsertedAutoIncValue(const TQString& aiFieldName, cons
}
RowData rdata;
if (row_id<=0 || true!=querySingleRecord(
- TQString::fromLatin1("SELECT ") + tableName + TQString::fromLatin1(".") + aiFieldName + TQString::fromLatin1(" FROM ") + tableName
- + TQString::fromLatin1(" WHERE ") + m_driver->beh->ROW_ID_FIELD_NAME + TQString::fromLatin1("=") + TQString::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 (TQ_ULLONG)-1; //ULL;
@@ -1541,7 +1541,7 @@ bool Connection::createTable( KexiDB::TableSchema* tableSchema, bool replaceExis
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;
}
}
@@ -1707,7 +1707,7 @@ tristate Connection::dropTable( KexiDB::TableSchema* tableSchema, bool alsoRemov
|| 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;
}
@@ -1757,7 +1757,7 @@ tristate Connection::dropTable( const TQString& table )
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
@@ -1793,18 +1793,18 @@ bool Connection::alterTableName(TableSchema& tableSchema, const TQString& newNam
{
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 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!
@@ -1816,7 +1816,7 @@ bool Connection::alterTableName(TableSchema& tableSchema, const TQString& newNam
if (!replace && 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;
}
@@ -1838,13 +1838,13 @@ bool Connection::alterTableName(TableSchema& tableSchema, const TQString& newNam
}
// the new table owns the previous table's id:
- if (!executeSQL(TQString::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(TQString::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 TQString& newNam
// Update kexi__objects
//TODO
- if (!executeSQL(TQString::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;
@@ -1889,8 +1889,8 @@ bool Connection::drv_alterTableName(TableSchema& tableSchema, const TQString& ne
const TQString oldTableName = tableSchema.name();
tableSchema.setName(newName);
- if (!executeSQL(TQString::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;
@@ -1938,7 +1938,7 @@ bool Connection::dropQuery( const TQString& query )
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);
@@ -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()) \
@@ -2270,7 +2270,7 @@ bool Connection::setupObjectSchemaData( const RowData &data, SchemaData &sdata )
{
//not found: retrieve schema
/* KexiDB::Cursor *cursor;
- if (!(cursor = executeQuery( TQString("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,9 +2300,9 @@ bool Connection::setupObjectSchemaData( const RowData &data, SchemaData &sdata )
tristate Connection::loadObjectSchemaData( int objectID, SchemaData &sdata )
{
RowData data;
- if (true!=querySingleRecord(TQString::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 );
}
@@ -2310,9 +2310,9 @@ tristate Connection::loadObjectSchemaData( int objectID, SchemaData &sdata )
tristate Connection::loadObjectSchemaData( int objectType, const TQString& objectName, SchemaData &sdata )
{
RowData data;
- if (true!=querySingleRecord(TQString::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(TQString::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
@@ -2366,9 +2366,9 @@ bool Connection::storeObjectSchemaData( SchemaData &sdata, bool newObject )
}
//existing object:
return executeSQL(TQString("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())) );
+ .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 TQString* sql, QuerySchema* query,
@@ -2407,7 +2407,7 @@ 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;
@@ -2695,7 +2695,7 @@ bool Connection::loadExtendedTableSchemaData(TableSchema& tableSchema)
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)
@@ -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(
- TQString::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;
@@ -2867,9 +2867,9 @@ TableSchema* Connection::tableSchema( const TQString& tableName )
return t;
//not found: retrieve schema
RowData data;
- if (true!=querySingleRecord(TQString::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,9 +2882,9 @@ TableSchema* Connection::tableSchema( int tableId )
return t;
//not found: retrieve schema
RowData data;
- if (true!=querySingleRecord(TQString::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);
@@ -2904,7 +2904,7 @@ bool Connection::storeDataBlock( int objectID, const TQString &dataString, const
{
if (objectID<=0)
return false;
- TQString sql(TQString::fromLatin1("SELECT kexi__objectdata.o_id FROM kexi__objectdata WHERE o_id=%1").arg(objectID));
+ 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;
@@ -2917,7 +2917,7 @@ bool Connection::storeDataBlock( int objectID, const TQString &dataString, const
+ " WHERE o_id=" + TQString::number(objectID) + " AND " + sql_sub );
}
return executeSQL(
- TQString::fromLatin1("INSERT INTO kexi__objectdata (o_id, o_data, o_sub_id) VALUES (")
+ 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 ) + ")" );
}
@@ -2943,7 +2943,7 @@ KexiDB::QuerySchema* Connection::setupQuerySchema( const RowData &data )
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 )) {
@@ -2974,9 +2974,9 @@ QuerySchema* Connection::querySchema( const TQString& queryName )
return q;
//not found: retrieve schema
RowData data;
- if (true!=querySingleRecord(TQString::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,8 +2990,8 @@ QuerySchema* Connection::querySchema( int queryId )
//not found: retrieve schema
clearError();
RowData data;
- if (true!=querySingleRecord(TQString::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);
@@ -3207,7 +3207,7 @@ bool Connection::updateRow(QuerySchema &query, RowData& data, RowEditBuffer& buf
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;
}
@@ -3291,7 +3291,7 @@ bool Connection::insertRow(QuerySchema &query, RowData& data, RowEditBuffer& buf
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;
}
}
@@ -3351,11 +3351,11 @@ bool Connection::insertRow(QuerySchema &query, RowData& data, RowEditBuffer& buf
return false;
}
RowData aif_data;
- TQString getAutoIncForInsertedValue = TQString::fromLatin1("SELECT ")
+ TQString getAutoIncForInsertedValue = TQString::tqfromLatin1("SELECT ")
+ query.autoIncrementSQLFieldsList(m_driver)
- + TQString::fromLatin1(" FROM ")
+ + TQString::tqfromLatin1(" FROM ")
+ escapeIdentifier(id_columnInfo->field->table()->name())
- + TQString::fromLatin1(" WHERE ")
+ + TQString::tqfromLatin1(" WHERE ")
+ escapeIdentifier(id_columnInfo->field->name()) + "="
+ TQString::number(last_id);
if (true!=querySingleRecord(getAutoIncForInsertedValue, aif_data)) {
@@ -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;
@@ -3429,7 +3429,7 @@ bool Connection::deleteRow(QuerySchema &query, RowData& data, bool useROWID)
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;
}