summaryrefslogtreecommitdiffstats
path: root/kexi/kexidb/connection.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <[email protected]>2011-12-18 18:12:30 -0600
committerTimothy Pearson <[email protected]>2011-12-18 18:12:30 -0600
commit11191ef0b9908604d1d7aaca382b011ef22c454c (patch)
treed38f0ccd8bfcc9756f5cfc42fb2ad1dad351e6aa /kexi/kexidb/connection.cpp
parentc9cb4f487428aad5d8cda5e3a4b9ad87390d7e54 (diff)
downloadkoffice-11191ef0b9908604d1d7aaca382b011ef22c454c.tar.gz
koffice-11191ef0b9908604d1d7aaca382b011ef22c454c.zip
Rename old tq methods that no longer need a unique name
Diffstat (limited to 'kexi/kexidb/connection.cpp')
-rw-r--r--kexi/kexidb/connection.cpp102
1 files changed, 51 insertions, 51 deletions
diff --git a/kexi/kexidb/connection.cpp b/kexi/kexidb/connection.cpp
index 4af6cae6..34add49a 100644
--- a/kexi/kexidb/connection.cpp
+++ b/kexi/kexidb/connection.cpp
@@ -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::tqfromLatin1("SELECT o_name FROM kexi__objects WHERE o_type=%1").tqarg(objType);
+ sql = TQString::fromLatin1("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::tqfromLatin1("SELECT o_id, o_name FROM kexi__objects WHERE o_type=%1").tqarg(objType));
+ TQString::fromLatin1("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::tqfromLatin1("(%1,%2)").tqarg(field->precision()).tqarg(field->scale());
+ v += TQString::fromLatin1("(%1,%2)").tqarg(field->precision()).tqarg(field->scale());
else
- v += TQString::tqfromLatin1("(%1)").tqarg(field->precision());
+ v += TQString::fromLatin1("(%1)").tqarg(field->precision());
}
else if (field->type()==Field::Text && field->length()>0)
- v += TQString::tqfromLatin1("(%1)").tqarg(field->length());
+ v += TQString::fromLatin1("(%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::tqfromLatin1(" DEFAULT ") + valToSQL;
+ v += TQString::fromLatin1(" 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::tqfromLatin1(", ");
+ sql += TQString::fromLatin1(", ");
if (f->isQueryAsterisk()) {
if (!singleTable && static_cast<QueryAsterisk*>(f)->isSingleTableAsterisk()) //single-table *
sql += escapeIdentifier(f->table()->name(), options.identifierEscaping) +
- TQString::tqfromLatin1(".*");
+ TQString::fromLatin1(".*");
else //all-tables * (or simplified table.* when there's only one table)
- sql += TQString::tqfromLatin1("*");
+ sql += TQString::fromLatin1("*");
}
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::tqfromLatin1(" AS ") + aliasString);
+ sql += (TQString::fromLatin1(" AS ") + aliasString);
//! @todo add option that allows to omit "AS" keyword
}
LookupFieldSchema *lookupFieldSchema = (options.addVisibleLookupColumns && f->table())
@@ -1159,7 +1159,7 @@ TQString Connection::selectStatement( KexiDB::QuerySchema& querySchema,
{
//add LEFT OUTER JOIN
if (!s_additional_joins.isEmpty())
- s_additional_joins += TQString::tqfromLatin1(" ");
+ s_additional_joins += TQString::fromLatin1(" ");
TQString internalUniqueTableAlias( TQString("__kexidb_") + lookupTable->name() + "_"
+ TQString::number(internalUniqueTableAliasNumber++) );
s_additional_joins += TQString("LEFT OUTER JOIN %1 AS %2 ON %3.%4=%5.%6")
@@ -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::tqfromLatin1(", ");
+ s_from_additional += TQString::fromLatin1(", ");
s_from_additional += escapeIdentifier(visibleField->table()->name(), options.identifierEscaping);
*/
}
#endif
if (!s_additional_fields.isEmpty())
- s_additional_fields += TQString::tqfromLatin1(", ");
+ s_additional_fields += TQString::fromLatin1(", ");
// 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,7 +1216,7 @@ TQString Connection::selectStatement( KexiDB::QuerySchema& querySchema,
}
//add LEFT OUTER JOIN
if (!s_additional_joins.isEmpty())
- s_additional_joins += TQString::tqfromLatin1(" ");
+ s_additional_joins += TQString::fromLatin1(" ");
TQString internalUniqueQueryAlias(
kexidb_subquery_prefix + lookupQuery->name() + "_"
+ TQString::number(internalUniqueQueryAliasNumber++) );
@@ -1229,7 +1229,7 @@ TQString Connection::selectStatement( KexiDB::QuerySchema& querySchema,
.tqarg(escapeIdentifier(boundColumnInfo->aliasOrName(), options.identifierEscaping));
if (!s_additional_fields.isEmpty())
- s_additional_fields += TQString::tqfromLatin1(", ");
+ s_additional_fields += TQString::fromLatin1(", ");
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::tqfromLatin1(", ") + s_additional_fields);
+ sql += (TQString::fromLatin1(", ") + s_additional_fields);
if (options.alsoRetrieveROWID) { //append rowid column
TQString s;
if (!sql.isEmpty())
- s = TQString::tqfromLatin1(", ");
+ s = TQString::fromLatin1(", ");
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::tqfromLatin1(" FROM ");
+ sql += TQString::fromLatin1(" 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::tqfromLatin1(", ");
+ s_from += TQString::fromLatin1(", ");
s_from += escapeIdentifier(table->name(), options.identifierEscaping);
TQString aliasString = TQString(querySchema.tableAlias(number));
if (!aliasString.isEmpty())
- s_from += (TQString::tqfromLatin1(" AS ") + aliasString);
+ s_from += (TQString::fromLatin1(" AS ") + aliasString);
}
/*unused if (!s_from_additional.isEmpty()) {//additional tables list needed for lookup fields
if (!s_from.isEmpty())
- s_from += TQString::tqfromLatin1(", ");
+ s_from += TQString::fromLatin1(", ");
s_from += s_from_additional;
}*/
}
@@ -1302,10 +1302,10 @@ TQString Connection::selectStatement( KexiDB::QuerySchema& querySchema,
subqueries_for_lookup_data.current(); ++it, subqueries_for_lookup_data_counter++)
{
if (!s_from.isEmpty())
- s_from += TQString::tqfromLatin1(", ");
- s_from += TQString::tqfromLatin1("(");
+ s_from += TQString::fromLatin1(", ");
+ s_from += TQString::fromLatin1("(");
s_from += selectStatement( *it.current(), params, options );
- s_from += TQString::tqfromLatin1(") AS %1%2")
+ s_from += TQString::fromLatin1(") 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::tqfromLatin1(" ") + s_additional_joins + TQString::tqfromLatin1(" ");
+ sql += TQString::fromLatin1(" ") + s_additional_joins + TQString::fromLatin1(" ");
}
//@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::tqfromLatin1(" AND ");
+ s_where += TQString::fromLatin1(" 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::tqfromLatin1(" AND ");
+ s_where_sub += TQString::fromLatin1(" AND ");
s_where_sub += (
escapeIdentifier(pair->first->table()->name(), options.identifierEscaping) +
- TQString::tqfromLatin1(".") +
+ TQString::fromLatin1(".") +
escapeIdentifier(pair->first->name(), options.identifierEscaping) +
- TQString::tqfromLatin1(" = ") +
+ TQString::fromLatin1(" = ") +
escapeIdentifier(pair->second->table()->name(), options.identifierEscaping) +
- TQString::tqfromLatin1(".") +
+ TQString::fromLatin1(".") +
escapeIdentifier(pair->second->name(), options.identifierEscaping));
}
if (rel->fieldPairs()->count()>1) {
s_where_sub.prepend("(");
- s_where_sub += TQString::tqfromLatin1(")");
+ s_where_sub += TQString::fromLatin1(")");
}
s_where += s_where_sub;
}
@@ -1362,7 +1362,7 @@ TQString Connection::selectStatement( KexiDB::QuerySchema& querySchema,
}
}
if (!s_where.isEmpty())
- sql += TQString::tqfromLatin1(" WHERE ") + s_where;
+ sql += TQString::fromLatin1(" 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::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))
+ 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))
{
// KexiDBDbg << "Connection::lastInsertedAutoIncValue(): row_id<=0 || true!=querySingleRecord()" << endl;
return (TQ_ULLONG)-1; //ULL;
@@ -1838,12 +1838,12 @@ bool Connection::alterTableName(TableSchema& tableSchema, const TQString& newNam
}
// the new table owns the previous table's id:
- if (!executeSQL(TQString::tqfromLatin1("UPDATE kexi__objects SET o_id=%1 WHERE o_id=%2 AND o_type=%3")
+ if (!executeSQL(TQString::fromLatin1("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::tqfromLatin1("UPDATE kexi__fields SET t_id=%1 WHERE t_id=%2")
+ if (!executeSQL(TQString::fromLatin1("UPDATE kexi__fields SET t_id=%1 WHERE t_id=%2")
.tqarg(origID).tqarg(tableSchema.id())))
{
return false;
@@ -1861,7 +1861,7 @@ bool Connection::alterTableName(TableSchema& tableSchema, const TQString& newNam
// Update kexi__objects
//TODO
- if (!executeSQL(TQString::tqfromLatin1("UPDATE kexi__objects SET o_name=%1 WHERE o_id=%2")
+ if (!executeSQL(TQString::fromLatin1("UPDATE kexi__objects SET o_name=%1 WHERE o_id=%2")
.tqarg(m_driver->escapeString(tableSchema.name())).tqarg(tableSchema.id())))
{
alterTableName_ERR;
@@ -1889,7 +1889,7 @@ bool Connection::drv_alterTableName(TableSchema& tableSchema, const TQString& ne
const TQString oldTableName = tableSchema.name();
tableSchema.setName(newName);
- if (!executeSQL(TQString::tqfromLatin1("ALTER TABLE %1 RENAME TO %2")
+ if (!executeSQL(TQString::fromLatin1("ALTER TABLE %1 RENAME TO %2")
.tqarg(escapeIdentifier(oldTableName)).tqarg(escapeIdentifier(newName))))
{
tableSchema.setName(oldTableName); //restore old name
@@ -2300,7 +2300,7 @@ bool Connection::setupObjectSchemaData( const RowData &data, SchemaData &sdata )
tristate Connection::loadObjectSchemaData( int objectID, SchemaData &sdata )
{
RowData data;
- if (true!=querySingleRecord(TQString::tqfromLatin1(
+ if (true!=querySingleRecord(TQString::fromLatin1(
"SELECT o_id, o_type, o_name, o_caption, o_desc FROM kexi__objects WHERE o_id=%1")
.tqarg(objectID), data))
return cancelled;
@@ -2310,7 +2310,7 @@ tristate Connection::loadObjectSchemaData( int objectID, SchemaData &sdata )
tristate Connection::loadObjectSchemaData( int objectType, const TQString& objectName, SchemaData &sdata )
{
RowData data;
- if (true!=querySingleRecord(TQString::tqfromLatin1("SELECT o_id, o_type, o_name, o_caption, o_desc "
+ if (true!=querySingleRecord(TQString::fromLatin1("SELECT o_id, o_type, o_name, o_caption, o_desc "
"FROM kexi__objects WHERE o_type=%1 AND lower(o_name)=%2")
.tqarg(objectType).tqarg(m_driver->valueToSQL(Field::Text, objectName.lower())), data))
return cancelled;
@@ -2324,7 +2324,7 @@ bool Connection::storeObjectSchemaData( SchemaData &sdata, bool newObject )
return false;
if (newObject) {
int existingID;
- if (true == querySingleNumber(TQString::tqfromLatin1(
+ if (true == querySingleNumber(TQString::fromLatin1(
"SELECT o_id FROM kexi__objects WHERE o_type=%1 AND lower(o_name)=%2")
.tqarg(sdata.type()).tqarg(m_driver->valueToSQL(Field::Text, sdata.name().lower())), existingID))
{
@@ -2807,7 +2807,7 @@ KexiDB::TableSchema* Connection::setupTableSchema( const RowData &data )
KexiDB::Cursor *cursor;
if (!(cursor = executeQuery(
- TQString::tqfromLatin1("SELECT t_id, f_type, f_name, f_length, f_precision, f_constraints, "
+ TQString::fromLatin1("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").tqarg(t->m_id) )))
{
@@ -2867,7 +2867,7 @@ TableSchema* Connection::tableSchema( const TQString& tableName )
return t;
//not found: retrieve schema
RowData data;
- if (true!=querySingleRecord(TQString::tqfromLatin1(
+ if (true!=querySingleRecord(TQString::fromLatin1(
"SELECT o_id, o_type, o_name, o_caption, o_desc FROM kexi__objects WHERE lower(o_name)='%1' AND o_type=%2")
.tqarg(m_tableName).tqarg(KexiDB::TableObjectType), data))
return 0;
@@ -2882,7 +2882,7 @@ TableSchema* Connection::tableSchema( int tableId )
return t;
//not found: retrieve schema
RowData data;
- if (true!=querySingleRecord(TQString::tqfromLatin1(
+ if (true!=querySingleRecord(TQString::fromLatin1(
"SELECT o_id, o_type, o_name, o_caption, o_desc FROM kexi__objects WHERE o_id=%1")
.tqarg(tableId), data))
return 0;
@@ -2904,7 +2904,7 @@ bool Connection::storeDataBlock( int objectID, const TQString &dataString, const
{
if (objectID<=0)
return false;
- TQString sql(TQString::tqfromLatin1("SELECT kexi__objectdata.o_id FROM kexi__objectdata WHERE o_id=%1").tqarg(objectID));
+ TQString sql(TQString::fromLatin1("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::tqfromLatin1("INSERT INTO kexi__objectdata (o_id, o_data, o_sub_id) VALUES (")
+ TQString::fromLatin1("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 ) + ")" );
}
@@ -2974,7 +2974,7 @@ QuerySchema* Connection::querySchema( const TQString& queryName )
return q;
//not found: retrieve schema
RowData data;
- if (true!=querySingleRecord(TQString::tqfromLatin1(
+ if (true!=querySingleRecord(TQString::fromLatin1(
"SELECT o_id, o_type, o_name, o_caption, o_desc FROM kexi__objects WHERE lower(o_name)='%1' AND o_type=%2")
.tqarg(m_queryName).tqarg(KexiDB::QueryObjectType), data))
return 0;
@@ -2990,7 +2990,7 @@ QuerySchema* Connection::querySchema( int queryId )
//not found: retrieve schema
clearError();
RowData data;
- if (true!=querySingleRecord(TQString::tqfromLatin1(
+ if (true!=querySingleRecord(TQString::fromLatin1(
"SELECT o_id, o_type, o_name, o_caption, o_desc FROM kexi__objects WHERE o_id=%1").tqarg(queryId), data))
return 0;
@@ -3351,11 +3351,11 @@ bool Connection::insertRow(QuerySchema &query, RowData& data, RowEditBuffer& buf
return false;
}
RowData aif_data;
- TQString getAutoIncForInsertedValue = TQString::tqfromLatin1("SELECT ")
+ TQString getAutoIncForInsertedValue = TQString::fromLatin1("SELECT ")
+ query.autoIncrementSQLFieldsList(m_driver)
- + TQString::tqfromLatin1(" FROM ")
+ + TQString::fromLatin1(" FROM ")
+ escapeIdentifier(id_columnInfo->field->table()->name())
- + TQString::tqfromLatin1(" WHERE ")
+ + TQString::fromLatin1(" WHERE ")
+ escapeIdentifier(id_columnInfo->field->name()) + "="
+ TQString::number(last_id);
if (true!=querySingleRecord(getAutoIncForInsertedValue, aif_data)) {