diff options
Diffstat (limited to 'kexi/kexidb/parser/parser_p.cpp')
-rw-r--r-- | kexi/kexidb/parser/parser_p.cpp | 100 |
1 files changed, 50 insertions, 50 deletions
diff --git a/kexi/kexidb/parser/parser_p.cpp b/kexi/kexidb/parser/parser_p.cpp index ca935d60..f64696e8 100644 --- a/kexi/kexidb/parser/parser_p.cpp +++ b/kexi/kexidb/parser/parser_p.cpp @@ -23,7 +23,7 @@ #include <kdebug.h> #include <klocale.h> -#include <qregexp.h> +#include <tqregexp.h> #include <assert.h> @@ -32,9 +32,9 @@ using namespace KexiDB; Parser *parser = 0; Field *field = 0; //bool requiresTable; -QPtrList<Field> fieldList; +TQPtrList<Field> fieldList; int current = 0; -QString ctoken = ""; +TQString ctoken = ""; //------------------------------------- @@ -92,7 +92,7 @@ void yyerror(const char *str) || otherError) { KexiDBDbg << parser->statement() << endl; - QString ptrline = ""; + TQString ptrline = ""; for(int i=0; i < current; i++) ptrline += " "; @@ -101,21 +101,21 @@ void yyerror(const char *str) KexiDBDbg << ptrline << endl; //lexer may add error messages - QString lexerErr = parser->error().error(); + TQString lexerErr = parser->error().error(); - QString errtypestr(str); + TQString errtypestr(str); if (lexerErr.isEmpty()) { #if 0 if (errtypestr.startsWith("parse error, unexpected ")) { //something like "parse error, unexpected IDENTIFIER, expecting ',' or ')'" - QString e = errtypestr.mid(24); + TQString e = errtypestr.mid(24); KexiDBDbg << e <<endl; - QString token = "IDENTIFIER"; + TQString token = "IDENTIFIER"; if (e.startsWith(token)) { - QRegExp re("'.'"); + TQRegExp re("'.'"); int pos=0; pos = re.search(e, pos); - QStringList captured=re.capturedTexts(); + TQStringList captured=re.capturedTexts(); if (captured.count()>=2) { // KexiDBDbg << "**" << captured.at(1) << endl; // KexiDBDbg << "**" << captured.at(2) << endl; @@ -142,21 +142,21 @@ void yyerror(const char *str) if (parser->isReservedKeyword(ctoken.latin1())) parser->setError( ParserError(i18n("Syntax Error"), - i18n("\"%1\" is a reserved keyword").arg(ctoken)+lexerErr, ctoken, current) ); + i18n("\"%1\" is a reserved keyword").tqarg(ctoken)+lexerErr, ctoken, current) ); else parser->setError( ParserError(i18n("Syntax Error"), - i18n("Syntax Error near \"%1\"").arg(ctoken)+lexerErr, ctoken, current) ); + i18n("Syntax Error near \"%1\"").tqarg(ctoken)+lexerErr, ctoken, current) ); } } } -void setError(const QString& errName, const QString& errDesc) +void setError(const TQString& errName, const TQString& errDesc) { parser->setError( ParserError(errName, errDesc, ctoken, current) ); yyerror(errName.latin1()); } -void setError(const QString& errDesc) +void setError(const TQString& errDesc) { setError("other error", errDesc); } @@ -194,7 +194,7 @@ bool parseData(Parser *p, const char *data) KexiDBDbg << "parseData(): ok" << endl; // KexiDBDbg << "parseData(): " << tableDict.count() << " loaded tables" << endl; /* TableSchema *ts; - for(QDictIterator<TableSchema> it(tableDict); TableSchema *s = tableList.first(); s; s = tableList.next()) + for(TQDictIterator<TableSchema> it(tableDict); TableSchema *s = tableList.first(); s; s = tableList.next()) { KexiDBDbg << " " << s->name() << endl; }*/ @@ -202,9 +202,9 @@ bool parseData(Parser *p, const char *data) Field::ListIterator it = parser->select()->fieldsIterator(); for(Field *item; (item = it.current()); ++it) { - if(tableList.findRef(item->table()) == -1) + if(tableList.tqfindRef(item->table()) == -1) { - ParserError err(i18n("Field List Error"), i18n("Unknown table '%1' in field list").arg(item->table()->name()), ctoken, current); + ParserError err(i18n("Field List Error"), i18n("Unknown table '%1' in field list").tqarg(item->table()->name()), ctoken, current); parser->setError(err); yyerror("fieldlisterror"); @@ -263,8 +263,8 @@ bool addColumn( ParseInfo& parseInfo, BaseExpr* columnExpr ) #if 0 KexiDBDbg << "found variable name: " << varName << endl; - int dotPos = varName.find('.'); - QString tableName, fieldName; + int dotPos = varName.tqfind('.'); + TQString tableName, fieldName; //TODO: shall we also support db name? if (dotPos>0) { tableName = varName.left(dotPos); @@ -288,15 +288,15 @@ bool addColumn( ParseInfo& parseInfo, BaseExpr* columnExpr ) setError(i18n("Ambiguous field name"), i18n("Both table \"%1\" and \"%2\" have defined \"%3\" field. " "Use \"<tableName>.%4\" notation to specify table name.") - .arg(firstField->table()->name()).arg(f->table()->name()) - .arg(fieldName).arg(fieldName)); + .tqarg(firstField->table()->name()).tqarg(f->table()->name()) + .tqarg(fieldName).tqarg(fieldName)); return false; } } } if (!firstField) { setError(i18n("Field not found"), - i18n("Table containing \"%1\" field not found").arg(fieldName)); + i18n("Table containing \"%1\" field not found").tqarg(fieldName)); return false; } //ok @@ -308,9 +308,9 @@ bool addColumn( ParseInfo& parseInfo, BaseExpr* columnExpr ) TableSchema *ts = parseInfo.querySchema->table( tableName ); if (ts) {//table.fieldname //check if "table" is covered by an alias - const QValueList<int> tPositions = parseInfo.querySchema->tablePositions(tableName); - QValueList<int>::ConstIterator it = tPositions.constBegin(); - QCString tableAlias; + const TQValueList<int> tPositions = parseInfo.querySchema->tablePositions(tableName); + TQValueList<int>::ConstIterator it = tPositions.constBegin(); + TQCString tableAlias; bool covered = true; for (; it!=tPositions.constEnd() && covered; ++it) { tableAlias = parseInfo.querySchema->tableAlias(*it); @@ -321,8 +321,8 @@ bool addColumn( ParseInfo& parseInfo, BaseExpr* columnExpr ) if (covered) { setError(i18n("Could not access the table directly using its name"), i18n("Table \"%1\" is covered by aliases. Instead of \"%2\", " - "you can write \"%3\"").arg(tableName) - .arg(tableName+"."+fieldName).arg(tableAlias+"."+fieldName.latin1())); + "you can write \"%3\"").tqarg(tableName) + .tqarg(tableName+"."+fieldName).tqarg(tableAlias+"."+fieldName.latin1())); return false; } } @@ -340,7 +340,7 @@ bool addColumn( ParseInfo& parseInfo, BaseExpr* columnExpr ) if (ts) { - QValueList<int> *positionsList = repeatedTablesAndAliases[ tableName ]; + TQValueList<int> *positionsList = repeatedTablesAndAliases[ tableName ]; if (!positionsList) { IMPL_ERROR(tableName + "." + fieldName + ", !positionsList "); return false; @@ -348,8 +348,8 @@ bool addColumn( ParseInfo& parseInfo, BaseExpr* columnExpr ) if (fieldName=="*") { if (positionsList->count()>1) { - setError(i18n("Ambiguous \"%1.*\" expression").arg(tableName), - i18n("More than one \"%1\" table or alias defined").arg(tableName)); + setError(i18n("Ambiguous \"%1.*\" expression").tqarg(tableName), + i18n("More than one \"%1\" table or alias defined").tqarg(tableName)); return false; } parseInfo.querySchema->addAsterisk( new QueryAsterisk(parseInfo.querySchema, ts) ); @@ -361,16 +361,16 @@ bool addColumn( ParseInfo& parseInfo, BaseExpr* columnExpr ) // check if table or alias is used twice and both have the same column // (so the column is ambiguous) int numberOfTheSameFields = 0; - for (QValueList<int>::iterator it = positionsList->begin(); + for (TQValueList<int>::iterator it = positionsList->begin(); it!=positionsList->end();++it) { TableSchema *otherTS = parseInfo.querySchema->tables()->at(*it); if (otherTS->field(fieldName)) numberOfTheSameFields++; if (numberOfTheSameFields>1) { - setError(i18n("Ambiguous \"%1.%2\" expression").arg(tableName).arg(fieldName), + setError(i18n("Ambiguous \"%1.%2\" expression").tqarg(tableName).tqarg(fieldName), i18n("More than one \"%1\" table or alias defined containing \"%2\" field") - .arg(tableName).arg(fieldName)); + .tqarg(tableName).tqarg(fieldName)); return false; } } @@ -379,7 +379,7 @@ bool addColumn( ParseInfo& parseInfo, BaseExpr* columnExpr ) } else { setError(i18n("Field not found"), i18n("Table \"%1\" has no \"%2\" field") - .arg(tableName).arg(fieldName)); + .tqarg(tableName).tqarg(fieldName)); return false; } } @@ -412,13 +412,13 @@ QuerySchema* buildSelectQuery( /*TODO: use this later if there are columns that use database fields, e.g. "SELECT 1 from table1 t, table2 t") is ok however. */ //used to collect information about first repeated table name or alias: -// QDict<char> tableNamesAndTableAliases(997, false); -// QString repeatedTableNameOrTableAlias; +// TQDict<char> tableNamesAndTableAliases(997, false); +// TQString repeatedTableNameOrTableAlias; if (tablesList) { for (int i=0; i<tablesList->args(); i++, columnNum++) { BaseExpr *e = tablesList->arg(i); VariableExpr* t_e = 0; - QCString aliasString; + TQCString aliasString; if (e->exprClass() == KexiDBExpr_SpecialBinary) { BinaryExpr* t_with_alias = e->toBinary(); assert(t_with_alias); @@ -432,16 +432,16 @@ QuerySchema* buildSelectQuery( t_e = e->toVariable(); } assert(t_e); - QCString tname = t_e->name.latin1(); - TableSchema *s = parser->db()->tableSchema(tname); + TQCString tname = t_e->name.latin1(); + TableSchema *s = parser->db()->tableSchema(TQString(tname)); if(!s) { setError(//i18n("Field List Error"), - i18n("Table \"%1\" does not exist").arg(tname)); + i18n("Table \"%1\" does not exist").tqarg(TQString(tname))); // yyerror("fieldlisterror"); CLEANUP; return 0; } - QCString tableOrAliasName; + TQCString tableOrAliasName; if (!aliasString.isEmpty()) { tableOrAliasName = aliasString; // KexiDBDbg << "- add alias for table: " << aliasString << endl; @@ -450,14 +450,14 @@ QuerySchema* buildSelectQuery( } // 1. collect information about first repeated table name or alias // (potential ambiguity) - QValueList<int> *list = parseInfo.repeatedTablesAndAliases[tableOrAliasName]; + TQValueList<int> *list = parseInfo.repeatedTablesAndAliases[tableOrAliasName]; if (list) { //another table/alias with the same name list->append( i ); // KexiDBDbg << "- another table/alias with name: " << tableOrAliasName << endl; } else { - list = new QValueList<int>(); + list = new TQValueList<int>(); list->append( i ); parseInfo.repeatedTablesAndAliases.insert( tableOrAliasName, list ); // KexiDBDbg << "- first table/alias with name: " << tableOrAliasName << endl; @@ -485,7 +485,7 @@ QuerySchema* buildSelectQuery( } } - /* set parent table if there's only one */ + /* set tqparent table if there's only one */ // if (parser->select()->tables()->count()==1) if (querySchema->tables()->count()==1) querySchema->setMasterTable(querySchema->tables()->first()); @@ -511,7 +511,7 @@ QuerySchema* buildSelectQuery( aliasVariable = e->toBinary()->right()->toVariable(); if (!aliasVariable) { setError(i18n("Invalid alias definition for column \"%1\"") - .arg(columnExpr->toString())); //ok? + .tqarg(columnExpr->toString())); //ok? CLEANUP; return 0; } @@ -542,7 +542,7 @@ QuerySchema* buildSelectQuery( e->toBinary()->m_larg = 0; } else { - setError(i18n("Invalid \"%1\" column definition").arg(e->toString())); //ok? + setError(i18n("Invalid \"%1\" column definition").tqarg(e->toString())); //ok? CLEANUP; return 0; } @@ -610,7 +610,7 @@ QuerySchema* buildSelectQuery( (*it).ascending, (*it).columnNumber-1 )) { setError(i18n("Could not define sorting - no column at position %1") - .arg((*it).columnNumber)); + .tqarg((*it).columnNumber)); CLEANUP; return 0; } @@ -619,7 +619,7 @@ QuerySchema* buildSelectQuery( Field * f = querySchema->findTableField((*it).aliasOrName); if (!f) { setError(i18n("Could not define sorting - " - "column name or alias \"%1\" does not exist").arg((*it).aliasOrName)); + "column name or alias \"%1\" does not exist").tqarg((*it).aliasOrName)); CLEANUP; return 0; } @@ -630,8 +630,8 @@ QuerySchema* buildSelectQuery( } } -// KexiDBDbg << "Select ColViews=" << (colViews ? colViews->debugString() : QString::null) -// << " Tables=" << (tablesList ? tablesList->debugString() : QString::null) << endl; +// KexiDBDbg << "Select ColViews=" << (colViews ? colViews->debugString() : TQString()) +// << " Tables=" << (tablesList ? tablesList->debugString() : TQString()) << endl; CLEANUP; return querySchema; |