summaryrefslogtreecommitdiffstats
path: root/kexi/kexidb/queryschema.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kexi/kexidb/queryschema.cpp')
-rw-r--r--kexi/kexidb/queryschema.cpp362
1 files changed, 181 insertions, 181 deletions
diff --git a/kexi/kexidb/queryschema.cpp b/kexi/kexidb/queryschema.cpp
index 4da4d2b8..4fae1cf1 100644
--- a/kexi/kexidb/queryschema.cpp
+++ b/kexi/kexidb/queryschema.cpp
@@ -27,18 +27,18 @@
#include <assert.h>
-#include <qvaluelist.h>
-#include <qasciidict.h>
-#include <qptrdict.h>
-#include <qintdict.h>
-#include <qbitarray.h>
+#include <tqvaluelist.h>
+#include <tqasciidict.h>
+#include <tqptrdict.h>
+#include <tqintdict.h>
+#include <tqbitarray.h>
#include <kdebug.h>
#include <klocale.h>
using namespace KexiDB;
-QueryColumnInfo::QueryColumnInfo(Field *f, const QCString& _alias, bool _visible,
+QueryColumnInfo::QueryColumnInfo(Field *f, const TQCString& _alias, bool _visible,
QueryColumnInfo *foreignColumn)
: field(f), alias(_alias), visible(_visible), m_indexForVisibleLookupValue(-1)
, m_foreignColumn(foreignColumn)
@@ -49,11 +49,11 @@ QueryColumnInfo::~QueryColumnInfo()
{
}
-QString QueryColumnInfo::debugString() const
+TQString QueryColumnInfo::debugString() const
{
return field->name() +
- ( alias.isEmpty() ? QString::null
- : (QString::fromLatin1(" AS ") + QString(alias)) );
+ ( alias.isEmpty() ? TQString()
+ : (TQString::tqfromLatin1(" AS ") + TQString(alias)) );
}
//=======================================
@@ -109,14 +109,14 @@ class QuerySchemaPrivate
if (copy->autoincFields)
autoincFields = new QueryColumnInfo::List(*copy->autoincFields);
if (copy->columnsOrder)
- columnsOrder = new QMap<QueryColumnInfo*,int>(*copy->columnsOrder);
+ columnsOrder = new TQMap<QueryColumnInfo*,int>(*copy->columnsOrder);
if (copy->columnsOrderWithoutAsterisks)
- columnsOrderWithoutAsterisks = new QMap<QueryColumnInfo*,int>(
+ columnsOrderWithoutAsterisks = new TQMap<QueryColumnInfo*,int>(
*copy->columnsOrderWithoutAsterisks);
if (copy->columnsOrderExpanded)
- columnsOrderExpanded = new QMap<QueryColumnInfo*,int>(*copy->columnsOrderExpanded);
+ columnsOrderExpanded = new TQMap<QueryColumnInfo*,int>(*copy->columnsOrderExpanded);
if (copy->pkeyFieldsOrder)
- pkeyFieldsOrder = new QValueVector<int>(*copy->pkeyFieldsOrder);
+ pkeyFieldsOrder = new TQValueVector<int>(*copy->pkeyFieldsOrder);
if (copy->whereExpr)
whereExpr = copy->whereExpr->copy();
if (copy->fakeRowIDCol)
@@ -156,7 +156,7 @@ class QuerySchemaPrivate
delete pkeyFieldsOrder;
pkeyFieldsOrder=0;
visibility.fill(false);
- tablesBoundToColumns = QValueVector<int>(64,-1);
+ tablesBoundToColumns = TQValueVector<int>(64,-1);
tablePositionsForAliases.clear();
columnPositionsForAliases.clear();
}
@@ -177,7 +177,7 @@ class QuerySchemaPrivate
columnsOrderExpanded = 0;
delete autoincFields;
autoincFields = 0;
- autoIncrementSQLFieldsList = QString::null;
+ autoIncrementSQLFieldsList = TQString();
columnInfosByNameExpanded.clear();
columnInfosByName.clear();
delete ownedVisibleColumns;
@@ -185,16 +185,16 @@ class QuerySchemaPrivate
}
}
- void setColumnAliasInternal(uint position, const QCString& alias)
+ void setColumnAliasInternal(uint position, const TQCString& alias)
{
- columnAliases.replace(position, new QCString(alias));
- columnPositionsForAliases.replace(alias, new int(position));
- maxIndexWithAlias = QMAX( maxIndexWithAlias, (int)position );
+ columnAliases.tqreplace(position, new TQCString(alias));
+ columnPositionsForAliases.tqreplace(alias, new int(position));
+ maxIndexWithAlias = TQMAX( maxIndexWithAlias, (int)position );
}
- void setColumnAlias(uint position, const QCString& alias)
+ void setColumnAlias(uint position, const TQCString& alias)
{
- QCString *oldAlias = columnAliases.take(position);
+ TQCString *oldAlias = columnAliases.take(position);
if (oldAlias) {
tablePositionsForAliases.remove(*oldAlias);
delete oldAlias;
@@ -213,7 +213,7 @@ class QuerySchemaPrivate
return !columnAliases.isEmpty();
}
- QCString* columnAlias(uint position)
+ TQCString* columnAlias(uint position)
{
tryRegenerateExprAliases();
return columnAliases[position];
@@ -241,14 +241,14 @@ class QuerySchemaPrivate
Field *f;
uint p=0;
uint colNum=0; //used to generate a name
- QCString columnAlias;
+ TQCString columnAlias;
for (Field::ListIterator it(query->fieldsIterator()); (f = it.current()); ++it, p++) {
if (f->isExpression() && !columnAliases[p]) {
//missing
- for (;;) { //find 1st unused
+ for (;;) { //tqfind 1st unused
colNum++;
columnAlias = (i18n("short for 'expression' word (only latin letters, please)", "expr")
- + QString::number(colNum)).latin1();
+ + TQString::number(colNum)).latin1();
if (!tablePositionsForAliases[columnAlias])
break;
}
@@ -259,11 +259,11 @@ class QuerySchemaPrivate
}
/*! Used to mapping columns to its aliases for this query */
- QIntDict<QCString> columnAliases;
+ TQIntDict<TQCString> columnAliases;
public:
/*! Used to mapping tables to its aliases for this query */
- QIntDict<QCString> tableAliases;
+ TQIntDict<TQCString> tableAliases;
/*! Helper used with aliases */
int maxIndexWithAlias;
@@ -272,7 +272,7 @@ class QuerySchemaPrivate
int maxIndexWithTableAlias;
/*! Used to store visibility flag for every field */
- QBitArray visibility;
+ TQBitArray visibility;
/*! List of asterisks defined for this query */
Field::List asterisks;
@@ -299,30 +299,30 @@ class QuerySchemaPrivate
QueryColumnInfo::List *autoincFields;
/*! A cache for autoIncrementSQLFieldsList(). */
- QString autoIncrementSQLFieldsList;
- QGuardedPtr<Driver> lastUsedDriverForAutoIncrementSQLFieldsList;
+ TQString autoIncrementSQLFieldsList;
+ TQGuardedPtr<Driver> lastUsedDriverForAutoIncrementSQLFieldsList;
/*! A map for fast lookup of query columns' order (unexpanded version). */
- QMap<QueryColumnInfo*,int> *columnsOrder;
+ TQMap<QueryColumnInfo*,int> *columnsOrder;
/*! A map for fast lookup of query columns' order (unexpanded version without asterisks). */
- QMap<QueryColumnInfo*,int> *columnsOrderWithoutAsterisks;
+ TQMap<QueryColumnInfo*,int> *columnsOrderWithoutAsterisks;
/*! A map for fast lookup of query columns' order.
This is exactly opposite information compared to vector returned
by fieldsExpanded() */
- QMap<QueryColumnInfo*,int> *columnsOrderExpanded;
+ TQMap<QueryColumnInfo*,int> *columnsOrderExpanded;
-// QValueList<bool> detailedVisibility;
+// TQValueList<bool> detailedVisibility;
/*! order of PKEY fields (e.g. for updateRow() ) */
- QValueVector<int> *pkeyFieldsOrder;
+ TQValueVector<int> *pkeyFieldsOrder;
/*! number of PKEY fields within the query */
uint pkeyFieldsCount;
/*! forced (predefined) statement */
- QString statement;
+ TQString statement;
/*! Relationships defined for this query. */
Relationship::List relations;
@@ -342,20 +342,20 @@ class QuerySchemaPrivate
- second coulmn is not specially bound (othertable.x isn't ambiguous)
- third column is bound to table 1 "t2"
*/
- QValueVector<int> tablesBoundToColumns;
+ TQValueVector<int> tablesBoundToColumns;
/*! Collects table positions for aliases: used in tablePositionForAlias(). */
- QAsciiDict<int> tablePositionsForAliases;
+ TQAsciiDict<int> tablePositionsForAliases;
/*! Collects column positions for aliases: used in columnPositionForAlias(). */
- QAsciiDict<int> columnPositionsForAliases;
+ TQAsciiDict<int> columnPositionsForAliases;
/*! WHERE expression */
BaseExpr *whereExpr;
- QDict<QueryColumnInfo> columnInfosByNameExpanded;
+ TQDict<QueryColumnInfo> columnInfosByNameExpanded;
- QDict<QueryColumnInfo> columnInfosByName; //!< Same as columnInfosByNameExpanded but asterisks are skipped
+ TQDict<QueryColumnInfo> columnInfosByName; //!< Same as columnInfosByNameExpanded but asterisks are skipped
//! field schemas created for multiple joined columns like a||' '||b||' '||c
Field::List *ownedVisibleColumns;
@@ -396,27 +396,27 @@ OrderByColumn::~OrderByColumn()
{
}
-QString OrderByColumn::debugString() const
+TQString OrderByColumn::debugString() const
{
- QString orderString( m_ascending ? "ascending" : "descending" );
+ TQString orderString( m_ascending ? "ascending" : "descending" );
if (m_column) {
if (m_pos>-1)
- return QString("COLUMN_AT_POSITION_%1(%2, %3)")
- .arg(m_pos+1).arg(m_column->debugString()).arg(orderString);
+ return TQString("COLUMN_AT_POSITION_%1(%2, %3)")
+ .tqarg(m_pos+1).tqarg(m_column->debugString()).tqarg(orderString);
else
- return QString("COLUMN(%1, %2)").arg(m_column->debugString()).arg(orderString);
+ return TQString("COLUMN(%1, %2)").tqarg(m_column->debugString()).tqarg(orderString);
}
- return m_field ? QString("FIELD(%1, %2)").arg(m_field->debugString()).arg(orderString)
- : QString("NONE");
+ return m_field ? TQString("FIELD(%1, %2)").tqarg(m_field->debugString()).tqarg(orderString)
+ : TQString("NONE");
}
-QString OrderByColumn::toSQLString(bool includeTableName, Driver *drv, int identifierEscaping) const
+TQString OrderByColumn::toSQLString(bool includeTableName, Driver *drv, int identifierEscaping) const
{
- const QString orderString( m_ascending ? "" : " DESC" );
- QString fieldName, tableName;
+ const TQString orderString( m_ascending ? "" : " DESC" );
+ TQString fieldName, tableName;
if (m_column) {
if (m_pos>-1)
- return QString::number(m_pos+1) + orderString;
+ return TQString::number(m_pos+1) + orderString;
else {
if (includeTableName && m_column->alias.isEmpty()) {
tableName = m_column->field->table()->name();
@@ -451,11 +451,11 @@ OrderByColumnList::OrderByColumnList()
}
bool OrderByColumnList::appendFields(QuerySchema& querySchema,
- const QString& field1, bool ascending1,
- const QString& field2, bool ascending2,
- const QString& field3, bool ascending3,
- const QString& field4, bool ascending4,
- const QString& field5, bool ascending5)
+ const TQString& field1, bool ascending1,
+ const TQString& field2, bool ascending2,
+ const TQString& field3, bool ascending3,
+ const TQString& field4, bool ascending4,
+ const TQString& field5, bool ascending5)
{
uint numAdded = 0;
#define ADD_COL(fieldName, ascending) \
@@ -504,7 +504,7 @@ void OrderByColumnList::appendField(Field& field, bool ascending)
}
bool OrderByColumnList::appendField(QuerySchema& querySchema,
- const QString& fieldName, bool ascending)
+ const TQString& fieldName, bool ascending)
{
QueryColumnInfo *columnInfo = querySchema.columnInfo( fieldName );
if (columnInfo) {
@@ -517,7 +517,7 @@ bool OrderByColumnList::appendField(QuerySchema& querySchema,
return true;
}
KexiDBWarn << "OrderByColumnList::addColumn(QuerySchema& querySchema, "
- "const QString& column, bool ascending): no such field \"" << fieldName << "\"" << endl;
+ "const TQString& column, bool ascending): no such field \"" << fieldName << "\"" << endl;
return false;
}
@@ -526,11 +526,11 @@ void OrderByColumnList::appendColumn(const OrderByColumn& column)
append( column );
}
-QString OrderByColumnList::debugString() const
+TQString OrderByColumnList::debugString() const
{
if (isEmpty())
return "NONE";
- QString dbg;
+ TQString dbg;
for (OrderByColumn::ListConstIterator it=constBegin(); it!=constEnd(); ++it) {
if (!dbg.isEmpty())
dbg += "\n";
@@ -539,9 +539,9 @@ QString OrderByColumnList::debugString() const
return dbg;
}
-QString OrderByColumnList::toSQLString(bool includeTableNames, Driver *drv, int identifierEscaping) const
+TQString OrderByColumnList::toSQLString(bool includeTableNames, Driver *drv, int identifierEscaping) const
{
- QString string;
+ TQString string;
for (OrderByColumn::ListConstIterator it=constBegin(); it!=constEnd(); ++it) {
if (!string.isEmpty())
string += ", ";
@@ -569,7 +569,7 @@ QuerySchema::QuerySchema(TableSchema& tableSchema)
init();
/* if (!d->masterTable) {
KexiDBWarn << "QuerySchema(TableSchema*): !d->masterTable" << endl;
- m_name = QString::null;
+ m_name = TQString();
return;
}*/
addTable(d->masterTable);
@@ -663,12 +663,12 @@ FieldList& QuerySchema::insertField(uint position, Field *field,
d->asterisks.append(field);
//if this is single-table asterisk,
//add a table to list if doesn't exist there:
- if (field->table() && (d->tables.findRef(field->table())==-1))
+ if (field->table() && (d->tables.tqfindRef(field->table())==-1))
d->tables.append(field->table());
}
else if (field->table()) {
//add a table to list if doesn't exist there:
- if (d->tables.findRef(field->table())==-1)
+ if (d->tables.tqfindRef(field->table())==-1)
d->tables.append(field->table());
}
// //visible by default
@@ -697,9 +697,9 @@ FieldList& QuerySchema::insertField(uint position, Field *field,
else
KexiDBDbg << " name=" << d->tables.at(bindToTable)->name()
<< " alias=" << tableAlias(bindToTable) << endl;
- QString s;
+ TQString s;
for (uint i=0; i<fieldCount();i++)
- s+= (QString::number(d->tablesBoundToColumns[i]) + " ");
+ s+= (TQString::number(d->tablesBoundToColumns[i]) + " ");
KexiDBDbg << "tablesBoundToColumns == [" << s << "]" <<endl;
if (field->isExpression())
@@ -763,7 +763,7 @@ FieldList& QuerySchema::addAsterisk(QueryAsterisk *asterisk, bool visible)
return *this;
//make unique name
asterisk->m_name = (asterisk->table() ? asterisk->table()->name() + ".*" : "*")
- + QString::number(asterisks()->count());
+ + TQString::number(asterisks()->count());
return addField(asterisk, visible);
}
@@ -773,19 +773,19 @@ Connection* QuerySchema::connection() const
return mt ? mt->connection() : 0;
}
-QString QuerySchema::debugString()
+TQString QuerySchema::debugString()
{
- QString dbg;
+ TQString dbg;
dbg.reserve(1024);
//fields
TableSchema *mt = masterTable();
- dbg = QString("QUERY ") + schemaDataDebugString() + "\n"
+ dbg = TQString("TQUERY ") + schemaDataDebugString() + "\n"
+ "-masterTable=" + (mt ? mt->name() :"<NULL>")
+ "\n-COLUMNS:\n"
+ ((fieldCount()>0) ? FieldList::debugString() : "<NONE>") + "\n"
+ "-FIELDS EXPANDED ";
- QString dbg1;
+ TQString dbg1;
uint fieldsExpandedCount = 0;
if (fieldCount()>0) {
QueryColumnInfo::Vector fe( fieldsExpanded() );
@@ -801,7 +801,7 @@ QString QuerySchema::debugString()
else {
dbg1 = "<NONE>\n";
}
- dbg1.prepend( QString("(%1):\n").arg(fieldsExpandedCount) );
+ dbg1.prepend( TQString("(%1):\n").tqarg(fieldsExpandedCount) );
dbg += dbg1;
//it's safer to delete fieldsExpanded for now
@@ -809,15 +809,15 @@ QString QuerySchema::debugString()
//causes a crash d->clearCachedData();
//bindings
- QString dbg2;
+ TQString dbg2;
dbg2.reserve(512);
for (uint i = 0; i<fieldCount(); i++) {
int tablePos = tableBoundToColumn(i);
if (tablePos>=0) {
- QCString tAlias = tableAlias(tablePos);
+ TQCString tAlias = tableAlias(tablePos);
if (!tAlias.isEmpty()) {
- dbg2 += (QString::fromLatin1(" field \"") + FieldList::field(i)->name()
- + "\" uses alias \"" + QString(tAlias) + "\" of table \""
+ dbg2 += (TQString::tqfromLatin1(" field \"") + FieldList::field(i)->name()
+ + "\" uses alias \"" + TQString(tAlias) + "\" of table \""
+ d->tables.at(tablePos)->name() + "\"\n");
}
}
@@ -829,50 +829,50 @@ QString QuerySchema::debugString()
//tables
TableSchema *table;
- QString table_names;
+ TQString table_names;
table_names.reserve(512);
for ( table = d->tables.first(); table; table = d->tables.next() ) {
if (!table_names.isEmpty())
table_names += ", ";
- table_names += (QString("'") + table->name() + "'");
+ table_names += (TQString("'") + table->name() + "'");
}
if (d->tables.isEmpty())
table_names = "<NONE>";
- dbg += (QString("-TABLES:\n") + table_names);
- QString aliases;
+ dbg += (TQString("-TABLES:\n") + table_names);
+ TQString aliases;
if (!d->hasColumnAliases())
aliases = "<NONE>\n";
else {
Field::ListIterator it( m_fields );
for (int i=0; it.current(); ++it, i++) {
- QCString *alias = d->columnAlias(i);
+ TQCString *alias = d->columnAlias(i);
if (alias)
- aliases += (QString("field #%1: ").arg(i)
+ aliases += (TQString("field #%1: ").tqarg(i)
+ (it.current()->name().isEmpty() ? "<noname>" : it.current()->name())
+ " -> " + (const char*)*alias + "\n");
}
}
//aliases
- dbg += QString("\n-COLUMN ALIASES:\n" + aliases);
+ dbg += TQString("\n-COLUMN ALIASES:\n" + aliases);
if (d->tableAliases.isEmpty())
aliases = "<NONE>";
else {
aliases = "";
TableSchema::ListIterator t_it(d->tables);
for (int i=0; t_it.current(); ++t_it, i++) {
- QCString *alias = d->tableAliases[i];
+ TQCString *alias = d->tableAliases[i];
if (alias)
- aliases += (QString("table #%1: ").arg(i)
+ aliases += (TQString("table #%1: ").tqarg(i)
+ (t_it.current()->name().isEmpty() ? "<noname>" : t_it.current()->name())
+ " -> " + (const char*)*alias + "\n");
}
}
- dbg += QString("-TABLE ALIASES:\n" + aliases);
- QString where = d->whereExpr ? d->whereExpr->debugString() : QString::null;
+ dbg += TQString("-TABLE ALIASES:\n" + aliases);
+ TQString where = d->whereExpr ? d->whereExpr->debugString() : TQString();
if (!where.isEmpty())
- dbg += (QString("\n-WHERE EXPRESSION:\n") + where);
+ dbg += (TQString("\n-WHERE EXPRESSION:\n") + where);
if (!orderByColumnList().isEmpty())
- dbg += (QString("\n-ORDER BY (%1):\n").arg(orderByColumnList().count())
+ dbg += (TQString("\n-ORDER BY (%1):\n").tqarg(orderByColumnList().count())
+ orderByColumnList().debugString());
return dbg;
}
@@ -886,7 +886,7 @@ TableSchema* QuerySchema::masterTable() const
//try to find master table if there's only one table (with possible aliasses)
int num = 0;
- QString tableNameLower;
+ TQString tableNameLower;
for (TableSchema::ListIterator it(d->tables); it.current(); ++it, num++) {
if (!tableNameLower.isEmpty() && it.current()->name().lower()!=tableNameLower) {
//two or more different tables
@@ -908,7 +908,7 @@ TableSchema::List* QuerySchema::tables() const
return &d->tables;
}
-void QuerySchema::addTable(TableSchema *table, const QCString& alias)
+void QuerySchema::addTable(TableSchema *table, const TQCString& alias)
{
KexiDBDbg << "QuerySchema::addTable() " << (void *)table
<< " alias=" << alias << endl;
@@ -918,13 +918,13 @@ void QuerySchema::addTable(TableSchema *table, const QCString& alias)
//only append table if:
//-it has alias
//-it has no alias but there is no such table on the list
- if (alias.isEmpty() && d->tables.findRef(table)!=-1) {
- const QString& tableNameLower = table->name().lower();
- const QString& aliasLower = QString(alias.lower());
+ if (alias.isEmpty() && d->tables.tqfindRef(table)!=-1) {
+ const TQString& tableNameLower = table->name().lower();
+ const TQString& aliasLower = TQString(alias.lower());
int num = 0;
for (TableSchema::ListIterator it(d->tables); it.current(); ++it, num++) {
if (it.current()->name().lower()==tableNameLower) {
- const QString& tAlias = tableAlias(num);
+ const TQString& tAlias = tableAlias(num);
if (tAlias == aliasLower) {
KexiDBWarn << "QuerySchema::addTable(): table with \""
<< tAlias << "\" alias already added!" << endl;
@@ -950,7 +950,7 @@ void QuerySchema::removeTable(TableSchema *table)
//todo: remove fields!
}
-TableSchema* QuerySchema::table(const QString& tableName) const
+TableSchema* QuerySchema::table(const TQString& tableName) const
{
//TODO: maybe use tables_byname?
for (TableSchema::ListIterator it(d->tables); it.current(); ++it) {
@@ -960,14 +960,14 @@ TableSchema* QuerySchema::table(const QString& tableName) const
return 0;
}
-bool QuerySchema::contains(TableSchema *table) const
+bool QuerySchema::tqcontains(TableSchema *table) const
{
- return d->tables.findRef(table)!=-1;
+ return d->tables.tqfindRef(table)!=-1;
}
-Field* QuerySchema::findTableField(const QString &tableOrTableAndFieldName) const
+Field* QuerySchema::findTableField(const TQString &tableOrTableAndFieldName) const
{
- QString tableName, fieldName;
+ TQString tableName, fieldName;
if (!KexiDB::splitToTableAndFieldParts(tableOrTableAndFieldName,
tableName, fieldName, KexiDB::SetFieldNameIfNoTableName)) {
return 0;
@@ -985,10 +985,10 @@ Field* QuerySchema::findTableField(const QString &tableOrTableAndFieldName) cons
return tableSchema->field(fieldName);
}
-QCString QuerySchema::columnAlias(uint position) const
+TQCString QuerySchema::columnAlias(uint position) const
{
- QCString *a = d->columnAlias(position);
- return a ? *a : QCString();
+ TQCString *a = d->columnAlias(position);
+ return a ? *a : TQCString();
}
bool QuerySchema::hasColumnAlias(uint position) const
@@ -996,14 +996,14 @@ bool QuerySchema::hasColumnAlias(uint position) const
return d->columnAlias(position)!=0;
}
-void QuerySchema::setColumnAlias(uint position, const QCString& alias)
+void QuerySchema::setColumnAlias(uint position, const TQCString& alias)
{
if (position >= m_fields.count()) {
KexiDBWarn << "QuerySchema::setColumnAlias(): position (" << position
<< ") out of range!" << endl;
return;
}
- QCString fixedAlias = alias.stripWhiteSpace();
+ TQCString fixedAlias = alias.stripWhiteSpace();
Field *f = FieldList::field(position);
if (f->captionOrName().isEmpty() && fixedAlias.isEmpty()) {
KexiDBWarn << "QuerySchema::setColumnAlias(): position (" << position
@@ -1013,13 +1013,13 @@ void QuerySchema::setColumnAlias(uint position, const QCString& alias)
d->setColumnAlias(position, fixedAlias);
}
-QCString QuerySchema::tableAlias(uint position) const
+TQCString QuerySchema::tableAlias(uint position) const
{
- QCString *a = d->tableAliases[position];
- return a ? *a : QCString();
+ TQCString *a = d->tableAliases[position];
+ return a ? *a : TQCString();
}
-int QuerySchema::tablePositionForAlias(const QCString& name) const
+int QuerySchema::tablePositionForAlias(const TQCString& name) const
{
int *num = d->tablePositionsForAliases[name];
if (!num)
@@ -1027,7 +1027,7 @@ int QuerySchema::tablePositionForAlias(const QCString& name) const
return *num;
}
-int QuerySchema::tablePosition(const QString& tableName) const
+int QuerySchema::tablePosition(const TQString& tableName) const
{
int num = 0;
for (TableSchema::ListIterator it(d->tables); it.current(); ++it, num++) {
@@ -1037,11 +1037,11 @@ int QuerySchema::tablePosition(const QString& tableName) const
return -1;
}
-QValueList<int> QuerySchema::tablePositions(const QString& tableName) const
+TQValueList<int> QuerySchema::tablePositions(const TQString& tableName) const
{
int num = 0;
- QValueList<int> result;
- const QString& tableNameLower = tableName.lower();
+ TQValueList<int> result;
+ const TQString& tableNameLower = tableName.lower();
for (TableSchema::ListIterator it(d->tables); it.current(); ++it, num++) {
if (it.current()->name().lower()==tableNameLower) {
result += num;
@@ -1055,7 +1055,7 @@ bool QuerySchema::hasTableAlias(uint position) const
return d->tableAliases[position]!=0;
}
-int QuerySchema::columnPositionForAlias(const QCString& name) const
+int QuerySchema::columnPositionForAlias(const TQCString& name) const
{
int *num = d->columnPositionsForAliases[name];
if (!num)
@@ -1063,16 +1063,16 @@ int QuerySchema::columnPositionForAlias(const QCString& name) const
return *num;
}
-void QuerySchema::setTableAlias(uint position, const QCString& alias)
+void QuerySchema::setTableAlias(uint position, const TQCString& alias)
{
if (position >= d->tables.count()) {
KexiDBWarn << "QuerySchema::setTableAlias(): position (" << position
<< ") out of range!" << endl;
return;
}
- QCString fixedAlias = alias.stripWhiteSpace();
+ TQCString fixedAlias = alias.stripWhiteSpace();
if (fixedAlias.isEmpty()) {
- QCString *oldAlias = d->tableAliases.take(position);
+ TQCString *oldAlias = d->tableAliases.take(position);
if (oldAlias) {
d->tablePositionsForAliases.remove(*oldAlias);
delete oldAlias;
@@ -1080,9 +1080,9 @@ void QuerySchema::setTableAlias(uint position, const QCString& alias)
// d->maxIndexWithTableAlias = -1;
}
else {
- d->tableAliases.replace(position, new QCString(fixedAlias));
- d->tablePositionsForAliases.replace(fixedAlias, new int(position));
-// d->maxIndexWithTableAlias = QMAX( d->maxIndexWithTableAlias, (int)index );
+ d->tableAliases.tqreplace(position, new TQCString(fixedAlias));
+ d->tablePositionsForAliases.tqreplace(fixedAlias, new int(position));
+// d->maxIndexWithTableAlias = TQMAX( d->maxIndexWithTableAlias, (int)index );
}
}
@@ -1096,23 +1096,23 @@ Field::List* QuerySchema::asterisks() const
return &d->asterisks;
}
-QString QuerySchema::statement() const
+TQString QuerySchema::statement() const
{
return d->statement;
}
-void QuerySchema::setStatement(const QString &s)
+void QuerySchema::setStatement(const TQString &s)
{
d->statement = s;
}
-Field* QuerySchema::field(const QString& identifier, bool expanded)
+Field* QuerySchema::field(const TQString& identifier, bool expanded)
{
QueryColumnInfo *ci = columnInfo(identifier, expanded);
return ci ? ci->field : 0;
}
-QueryColumnInfo* QuerySchema::columnInfo(const QString& identifier, bool expanded)
+QueryColumnInfo* QuerySchema::columnInfo(const TQString& identifier, bool expanded)
{
computeFieldsExpanded();
return expanded ? d->columnInfosByNameExpanded[identifier] : d->columnInfosByName[identifier];
@@ -1144,7 +1144,7 @@ QueryColumnInfo::Vector QuerySchema::fieldsExpanded(FieldsExpandedOptions option
if (options == WithInternalFieldsAndRowID) {
if (!d->fakeRowIDField) {
d->fakeRowIDField = new Field("rowID", Field::BigInteger);
- d->fakeRowIDCol = new QueryColumnInfo(d->fakeRowIDField, QCString(), true);
+ d->fakeRowIDCol = new QueryColumnInfo(d->fakeRowIDField, TQCString(), true);
}
tmpFieldsExpandedWithInternal->insert(
fieldsExpandedVectorSize + internalFieldsCount, d->fakeRowIDCol );
@@ -1157,14 +1157,14 @@ QueryColumnInfo::Vector QuerySchema::fieldsExpanded(FieldsExpandedOptions option
return *d->fieldsExpanded;
//options == Unique:
- QDict<char> columnsAlreadyFound;
+ TQDict<char> columnsAlreadyFound;
QueryColumnInfo::Vector result( d->fieldsExpanded->count() ); //initial size is set
-// QMapConstIterator<QueryColumnInfo*, bool> columnsAlreadyFoundIt;
+// TQMapConstIterator<QueryColumnInfo*, bool> columnsAlreadyFoundIt;
//compute unique list
uint uniqueListCount = 0;
for (uint i=0; i<d->fieldsExpanded->count(); i++) {
QueryColumnInfo *ci = (*d->fieldsExpanded)[i];
-// columnsAlreadyFoundIt = columnsAlreadyFound.find(ci);
+// columnsAlreadyFoundIt = columnsAlreadyFound.tqfind(ci);
// uint foundColumnIndex = -1;
if (!columnsAlreadyFound[ci->aliasOrName()]) {// columnsAlreadyFoundIt==columnsAlreadyFound.constEnd())
columnsAlreadyFound.insert(ci->aliasOrName(), (char*)1);
@@ -1187,9 +1187,9 @@ QueryColumnInfo* QuerySchema::expandedOrInternalField(uint index)
return (index < vector.size()) ? vector[index] : 0;
}
-inline QString lookupColumnKey(Field *foreignField, Field* field)
+inline TQString lookupColumnKey(Field *foreignField, Field* field)
{
- QString res;
+ TQString res;
if (field->table()) // can be 0 for anonymous fields built as joined multiple visible columns
res = field->table()->name() + ".";
return res + field->name() + "_" + foreignField->table()->name() + "." + foreignField->name();
@@ -1201,8 +1201,8 @@ void QuerySchema::computeFieldsExpanded()
return;
if (!d->columnsOrder) {
- d->columnsOrder = new QMap<QueryColumnInfo*,int>();
- d->columnsOrderWithoutAsterisks = new QMap<QueryColumnInfo*,int>();
+ d->columnsOrder = new TQMap<QueryColumnInfo*,int>();
+ d->columnsOrderWithoutAsterisks = new TQMap<QueryColumnInfo*,int>();
}
else {
d->columnsOrder->clear();
@@ -1214,7 +1214,7 @@ void QuerySchema::computeFieldsExpanded()
//collect all fields in a list (not a vector yet, because we do not know its size)
QueryColumnInfo::List list; //temporary
QueryColumnInfo::List lookup_list; //temporary, for collecting additional fields related to lookup fields
- QMap<QueryColumnInfo*, bool> columnInfosOutsideAsterisks; //helper for filling d->columnInfosByName
+ TQMap<QueryColumnInfo*, bool> columnInfosOutsideAsterisks; //helper for filling d->columnInfosByName
uint i = 0;
uint fieldPosition = 0;
uint numberOfColumnsWithMultipleVisibleFields = 0; //used to find an unique name for anonymous field
@@ -1225,7 +1225,7 @@ void QuerySchema::computeFieldsExpanded()
Field::List *ast_fields = static_cast<QueryAsterisk*>(f)->table()->fields();
for (Field *ast_f = ast_fields->first(); ast_f; ast_f=ast_fields->next()) {
// d->detailedVisibility += isFieldVisible(fieldPosition);
- QueryColumnInfo *ci = new QueryColumnInfo(ast_f, QCString()/*no field for asterisk!*/,
+ QueryColumnInfo *ci = new QueryColumnInfo(ast_f, TQCString()/*no field for asterisk!*/,
isColumnVisible(fieldPosition));
list.append( ci );
KexiDBDbg << "QuerySchema::computeFieldsExpanded(): caching (unexpanded) columns order: "
@@ -1242,7 +1242,7 @@ void QuerySchema::computeFieldsExpanded()
//! \todo (js): perhaps not all fields should be appended here
// d->detailedVisibility += isFieldVisible(fieldPosition);
// list.append(tab_f);
- QueryColumnInfo *ci = new QueryColumnInfo(tab_f, QCString()/*no field for asterisk!*/,
+ QueryColumnInfo *ci = new QueryColumnInfo(tab_f, TQCString()/*no field for asterisk!*/,
isColumnVisible(fieldPosition));
list.append( ci );
KexiDBDbg << "QuerySchema::computeFieldsExpanded(): caching (unexpanded) columns order: "
@@ -1291,10 +1291,10 @@ void QuerySchema::computeFieldsExpanded()
// (the expression object will be owned by column info)
visibleColumn = new Field();
visibleColumn->setName(
- QString::fromLatin1("[multiple_visible_fields_%1]")
- .arg( ++numberOfColumnsWithMultipleVisibleFields ));
+ TQString::tqfromLatin1("[multiple_visible_fields_%1]")
+ .tqarg( ++numberOfColumnsWithMultipleVisibleFields ));
visibleColumn->setExpression(
- new ConstExpr(CHARACTER_STRING_LITERAL, QVariant()/*not important*/));
+ new ConstExpr(CHARACTER_STRING_LITERAL, TQVariant()/*not important*/));
if (!d->ownedVisibleColumns) {
d->ownedVisibleColumns = new Field::List();
d->ownedVisibleColumns->setAutoDelete(true);
@@ -1303,14 +1303,14 @@ void QuerySchema::computeFieldsExpanded()
}
lookup_list.append(
- new QueryColumnInfo(visibleColumn, QCString(), true/*visible*/, ci/*foreign*/) );
+ new QueryColumnInfo(visibleColumn, TQCString(), true/*visible*/, ci/*foreign*/) );
/*
//add visibleField to the list of SELECTed fields if it is not yes present there
if (!findTableField( visibleField->table()->name()+"."+visibleField->name() )) {
if (!table( visibleField->table()->name() )) {
}
if (!sql.isEmpty())
- sql += QString::fromLatin1(", ");
+ sql += TQString::tqfromLatin1(", ");
sql += (escapeIdentifier(visibleField->table()->name(), drvEscaping) + "."
+ escapeIdentifier(visibleField->name(), drvEscaping));
}*/
@@ -1330,10 +1330,10 @@ void QuerySchema::computeFieldsExpanded()
Field *boundField = boundColumnInfo->field;
if (!boundField)
continue;
- const QValueList<uint> visibleColumns( lookupFieldSchema->visibleColumns() );
+ const TQValueList<uint> visibleColumns( lookupFieldSchema->visibleColumns() );
bool ok = true;
// all indices in visibleColumns should be in [0..lookupQueryFieldsExpanded.size()-1]
- foreach (QValueList<uint>::ConstIterator, visibleColumnsIt, visibleColumns) {
+ foreach (TQValueList<uint>::ConstIterator, visibleColumnsIt, visibleColumns) {
if ((*visibleColumnsIt) >= lookupQueryFieldsExpanded.count()) {
ok = false;
break;
@@ -1351,10 +1351,10 @@ void QuerySchema::computeFieldsExpanded()
// (the expression object will be owned by column info)
visibleColumn = new Field();
visibleColumn->setName(
- QString::fromLatin1("[multiple_visible_fields_%1]")
- .arg( ++numberOfColumnsWithMultipleVisibleFields ));
+ TQString::tqfromLatin1("[multiple_visible_fields_%1]")
+ .tqarg( ++numberOfColumnsWithMultipleVisibleFields ));
visibleColumn->setExpression(
- new ConstExpr(CHARACTER_STRING_LITERAL, QVariant()/*not important*/));
+ new ConstExpr(CHARACTER_STRING_LITERAL, TQVariant()/*not important*/));
if (!d->ownedVisibleColumns) {
d->ownedVisibleColumns = new Field::List();
d->ownedVisibleColumns->setAutoDelete(true);
@@ -1363,14 +1363,14 @@ void QuerySchema::computeFieldsExpanded()
}
lookup_list.append(
- new QueryColumnInfo(visibleColumn, QCString(), true/*visible*/, ci/*foreign*/) );
+ new QueryColumnInfo(visibleColumn, TQCString(), true/*visible*/, ci/*foreign*/) );
/*
//add visibleField to the list of SELECTed fields if it is not yes present there
if (!findTableField( visibleField->table()->name()+"."+visibleField->name() )) {
if (!table( visibleField->table()->name() )) {
}
if (!sql.isEmpty())
- sql += QString::fromLatin1(", ");
+ sql += TQString::tqfromLatin1(", ");
sql += (escapeIdentifier(visibleField->table()->name(), drvEscaping) + "."
+ escapeIdentifier(visibleField->name(), drvEscaping));
}*/
@@ -1381,7 +1381,7 @@ void QuerySchema::computeFieldsExpanded()
if (!d->fieldsExpanded) {
d->fieldsExpanded = new QueryColumnInfo::Vector( list.count() );// Field::Vector( list.count() );
d->fieldsExpanded->setAutoDelete(true);
- d->columnsOrderExpanded = new QMap<QueryColumnInfo*,int>();
+ d->columnsOrderExpanded = new TQMap<QueryColumnInfo*,int>();
}
else {//for future:
d->fieldsExpanded->clear();
@@ -1406,13 +1406,13 @@ void QuerySchema::computeFieldsExpanded()
//store alias and table.alias
if (!d->columnInfosByNameExpanded[ ci->alias ])
d->columnInfosByNameExpanded.insert( ci->alias, ci );
- QString tableAndAlias( ci->alias );
+ TQString tableAndAlias( ci->alias );
if (ci->field->table())
tableAndAlias.prepend(ci->field->table()->name() + ".");
if (!d->columnInfosByNameExpanded[ tableAndAlias ])
d->columnInfosByNameExpanded.insert( tableAndAlias, ci );
//the same for "unexpanded" list
- if (columnInfosOutsideAsterisks.contains(ci)) {
+ if (columnInfosOutsideAsterisks.tqcontains(ci)) {
if (!d->columnInfosByName[ ci->alias ])
d->columnInfosByName.insert( ci->alias, ci );
if (!d->columnInfosByName[ tableAndAlias ])
@@ -1423,13 +1423,13 @@ void QuerySchema::computeFieldsExpanded()
//no alias: store name and table.name
if (!d->columnInfosByNameExpanded[ ci->field->name() ])
d->columnInfosByNameExpanded.insert( ci->field->name(), ci );
- QString tableAndName( ci->field->name() );
+ TQString tableAndName( ci->field->name() );
if (ci->field->table())
tableAndName.prepend(ci->field->table()->name() + ".");
if (!d->columnInfosByNameExpanded[ tableAndName ])
d->columnInfosByNameExpanded.insert( tableAndName, ci );
//the same for "unexpanded" list
- if (columnInfosOutsideAsterisks.contains(ci)) {
+ if (columnInfosOutsideAsterisks.tqcontains(ci)) {
if (!d->columnInfosByName[ ci->field->name() ])
d->columnInfosByName.insert( ci->field->name(), ci );
if (!d->columnInfosByName[ tableAndName ])
@@ -1439,13 +1439,13 @@ void QuerySchema::computeFieldsExpanded()
}
//remove duplicates for lookup fields
- QDict<uint> lookup_dict(101); //used to fight duplicates and to update QueryColumnInfo::indexForVisibleLookupValue()
+ TQDict<uint> lookup_dict(101); //used to fight duplicates and to update QueryColumnInfo::indexForVisibleLookupValue()
// (a mapping from table.name string to uint* lookupFieldIndex
lookup_dict.setAutoDelete(true);
i=0;
for (QueryColumnInfo::ListIterator it(lookup_list); (ci = it.current());)
{
- const QString key( lookupColumnKey(ci->foreignColumn()->field, ci->field) );
+ const TQString key( lookupColumnKey(ci->foreignColumn()->field, ci->field) );
if ( /* not needed columnInfo( tableAndFieldName ) || */
lookup_dict[ key ]) {
// this table.field is already fetched by this query
@@ -1453,7 +1453,7 @@ void QuerySchema::computeFieldsExpanded()
lookup_list.removeRef( ci );
}
else {
- lookup_dict.replace( key, new uint( i ) );
+ lookup_dict.tqreplace( key, new uint( i ) );
++it;
i++;
}
@@ -1502,15 +1502,15 @@ void QuerySchema::computeFieldsExpanded()
if (visibleColumns->fieldCount() == 1)
{
visibleColumn = visibleColumns->fields()->first();
- const QString key( lookupColumnKey(ci->field, visibleColumn) );
+ const TQString key( lookupColumnKey(ci->field, visibleColumn) );
uint *index = lookup_dict[ key ];
if (index)
ci->setIndexForVisibleLookupValue( d->fieldsExpanded->size() + *index );
}
else {
- const QString key( QString::fromLatin1("[multiple_visible_fields_%1]_%2.%3")
- .arg( ++numberOfColumnsWithMultipleVisibleFields )
- .arg(ci->field->table()->name()).arg(ci->field->name()) );
+ const TQString key( TQString::tqfromLatin1("[multiple_visible_fields_%1]_%2.%3")
+ .tqarg( ++numberOfColumnsWithMultipleVisibleFields )
+ .tqarg(ci->field->table()->name()).tqarg(ci->field->name()) );
uint *index = lookup_dict[ key ];
if (index)
ci->setIndexForVisibleLookupValue( d->fieldsExpanded->size() + *index );
@@ -1531,20 +1531,20 @@ void QuerySchema::computeFieldsExpanded()
Field *boundField = boundColumnInfo->field;
if (!boundField)
continue;
- const QValueList<uint> visibleColumns( lookupFieldSchema->visibleColumns() );
+ const TQValueList<uint> visibleColumns( lookupFieldSchema->visibleColumns() );
Field *visibleColumn = 0;
// for single visible column, just add it as-is
if (visibleColumns.count() == 1) {
visibleColumn = lookupQueryFieldsExpanded[ visibleColumns.first() ]->field;
- const QString key( lookupColumnKey(ci->field, visibleColumn) );
+ const TQString key( lookupColumnKey(ci->field, visibleColumn) );
uint *index = lookup_dict[ key ];
if (index)
ci->setIndexForVisibleLookupValue( d->fieldsExpanded->size() + *index );
}
else {
- const QString key( QString::fromLatin1("[multiple_visible_fields_%1]_%2.%3")
- .arg( ++numberOfColumnsWithMultipleVisibleFields )
- .arg(ci->field->table()->name()).arg(ci->field->name()) );
+ const TQString key( TQString::tqfromLatin1("[multiple_visible_fields_%1]_%2.%3")
+ .tqarg( ++numberOfColumnsWithMultipleVisibleFields )
+ .tqarg(ci->field->table()->name()).tqarg(ci->field->name()) );
uint *index = lookup_dict[ key ];
if (index)
ci->setIndexForVisibleLookupValue( d->fieldsExpanded->size() + *index );
@@ -1557,7 +1557,7 @@ void QuerySchema::computeFieldsExpanded()
}
}
-QMap<QueryColumnInfo*,int> QuerySchema::columnsOrder(ColumnsOrderOptions options)
+TQMap<QueryColumnInfo*,int> QuerySchema::columnsOrder(ColumnsOrderOptions options)
{
if (!d->columnsOrder)
computeFieldsExpanded();
@@ -1568,20 +1568,20 @@ QMap<QueryColumnInfo*,int> QuerySchema::columnsOrder(ColumnsOrderOptions options
return *d->columnsOrderExpanded;
}
-QValueVector<int> QuerySchema::pkeyFieldsOrder()
+TQValueVector<int> QuerySchema::pkeyFieldsOrder()
{
if (d->pkeyFieldsOrder)
return *d->pkeyFieldsOrder;
TableSchema *tbl = masterTable();
if (!tbl || !tbl->primaryKey())
- return QValueVector<int>();
+ return TQValueVector<int>();
//get order of PKEY fields (e.g. for rows updating or inserting )
IndexSchema *pkey = tbl->primaryKey();
pkey->debug();
debug();
- d->pkeyFieldsOrder = new QValueVector<int>( pkey->fieldCount(), -1 );
+ d->pkeyFieldsOrder = new TQValueVector<int>( pkey->fieldCount(), -1 );
const uint fCount = fieldsExpanded().count();
d->pkeyFieldsCount = 0;
@@ -1600,7 +1600,7 @@ QValueVector<int> QuerySchema::pkeyFieldsOrder()
}
}
KexiDBDbg << "QuerySchema::pkeyFieldsOrder(): " << d->pkeyFieldsCount
- << " OUT OF " << pkey->fieldCount() << " PKEY'S FIELDS FOUND IN QUERY " << name() << endl;
+ << " OUT OF " << pkey->fieldCount() << " PKEY'S FIELDS FOUND IN TQUERY " << name() << endl;
return *d->pkeyFieldsOrder;
}
@@ -1645,11 +1645,11 @@ QueryColumnInfo::List* QuerySchema::autoIncrementFields()
return d->autoincFields;
}
-QString QuerySchema::sqlColumnsList(QueryColumnInfo::List* infolist, Driver *driver)
+TQString QuerySchema::sqlColumnsList(QueryColumnInfo::List* infolist, Driver *driver)
{
if (!infolist)
- return QString::null;
- QString result;
+ return TQString();
+ TQString result;
result.reserve(256);
QueryColumnInfo::ListIterator it( *infolist );
bool start = true;
@@ -1663,7 +1663,7 @@ QString QuerySchema::sqlColumnsList(QueryColumnInfo::List* infolist, Driver *dri
return result;
}
-QString QuerySchema::autoIncrementSQLFieldsList(Driver *driver)
+TQString QuerySchema::autoIncrementSQLFieldsList(Driver *driver)
{
if ((Driver *)d->lastUsedDriverForAutoIncrementSQLFieldsList != driver
|| d->autoIncrementSQLFieldsList.isEmpty())
@@ -1680,7 +1680,7 @@ void QuerySchema::setWhereExpression(BaseExpr *expr)
d->whereExpr = expr;
}
-void QuerySchema::addToWhereExpression(KexiDB::Field *field, const QVariant& value, int relation)
+void QuerySchema::addToWhereExpression(KexiDB::Field *field, const TQVariant& value, int relation)
{
int token;
if (value.isNull())
@@ -1700,7 +1700,7 @@ void QuerySchema::addToWhereExpression(KexiDB::Field *field, const QVariant& val
KexiDBExpr_Relational,
new ConstExpr( token, value ),
relation,
- new VariableExpr((field->table() ? (field->table()->name()+".") : QString::null)+field->name())
+ new VariableExpr((field->table() ? (field->table()->name()+".") : TQString())+field->name())
);
if (d->whereExpr) {
d->whereExpr = new BinaryExpr(
@@ -1716,7 +1716,7 @@ void QuerySchema::addToWhereExpression(KexiDB::Field *field, const QVariant& val
}
/*
-void QuerySchema::addToWhereExpression(KexiDB::Field *field, const QVariant& value)
+void QuerySchema::addToWhereExpression(KexiDB::Field *field, const TQVariant& value)
switch (value.type()) {
case Int: case UInt: case Bool: case LongLong: case ULongLong:
token = INTEGER_CONST;
@@ -1837,13 +1837,13 @@ void QueryAsterisk::setTable(TableSchema *table)
m_table=table;
}
-QString QueryAsterisk::debugString() const
+TQString QueryAsterisk::debugString() const
{
- QString dbg;
+ TQString dbg;
if (isAllTableAsterisk()) {
dbg += "ALL-TABLES ASTERISK (*) ON TABLES(";
TableSchema *table;
- QString table_names;
+ TQString table_names;
for (TableSchema::ListIterator it( *query()->tables() ); (table = it.current()); ++it) {
if (!table_names.isEmpty())
table_names += ", ";