diff options
Diffstat (limited to 'kexi/kexidb')
114 files changed, 2829 insertions, 2815 deletions
diff --git a/kexi/kexidb/admin.cpp b/kexi/kexidb/admin.cpp index 5d05af9e..a69279d0 100644 --- a/kexi/kexidb/admin.cpp +++ b/kexi/kexidb/admin.cpp @@ -33,7 +33,7 @@ AdminTools::~AdminTools() delete d; } -bool AdminTools::vacuum(const ConnectionData& data, const QString& databaseName) +bool AdminTools::vacuum(const ConnectionData& data, const TQString& databaseName) { Q_UNUSED(data); Q_UNUSED(databaseName); diff --git a/kexi/kexidb/admin.h b/kexi/kexidb/admin.h index 0a7a0d46..192f3b5c 100644 --- a/kexi/kexidb/admin.h +++ b/kexi/kexidb/admin.h @@ -44,7 +44,7 @@ class KEXI_DB_EXPORT AdminTools : public Object \return true on success, false on failure (then you can get error status from the AdminTools object). */ - virtual bool vacuum(const ConnectionData& data, const QString& databaseName); + virtual bool vacuum(const ConnectionData& data, const TQString& databaseName); //virtual bool vacuum(Connection& conn); protected: diff --git a/kexi/kexidb/alter.cpp b/kexi/kexidb/alter.cpp index f894b299..5a84424e 100644 --- a/kexi/kexidb/alter.cpp +++ b/kexi/kexidb/alter.cpp @@ -21,7 +21,7 @@ #include "utils.h" #include <kexiutils/utils.h> -#include <qmap.h> +#include <tqmap.h> #include <kstaticdeleter.h> @@ -36,7 +36,7 @@ class AlterTableHandler::Private ~Private() {} ActionList actions; - QGuardedPtr<Connection> conn; + TQGuardedPtr<Connection> conn; }; } @@ -91,7 +91,7 @@ AlterTableHandler::MoveFieldPositionAction& AlterTableHandler::ActionBase::toMov //-------------------------------------------------------- -AlterTableHandler::FieldActionBase::FieldActionBase(const QString& fieldName, int uid) +AlterTableHandler::FieldActionBase::FieldActionBase(const TQString& fieldName, int uid) : ActionBase() , m_fieldUID(uid) , m_fieldName(fieldName) @@ -110,21 +110,21 @@ AlterTableHandler::FieldActionBase::~FieldActionBase() //-------------------------------------------------------- -static KStaticDeleter< QMap<QCString,int> > KexiDB_alteringTypeForProperty_deleter; -QMap<QCString,int> *KexiDB_alteringTypeForProperty = 0; +static KStaticDeleter< TQMap<TQCString,int> > KexiDB_alteringTypeForProperty_deleter; +TQMap<TQCString,int> *KexiDB_alteringTypeForProperty = 0; -int AlterTableHandler::alteringTypeForProperty(const QCString& propertyName) +int AlterTableHandler::alteringTypeForProperty(const TQCString& propertyName) { if (!KexiDB_alteringTypeForProperty) { KexiDB_alteringTypeForProperty_deleter.setObject( KexiDB_alteringTypeForProperty, - new QMap<QCString,int>() ); + new TQMap<TQCString,int>() ); #define I(name, type) \ - KexiDB_alteringTypeForProperty->insert(QCString(name).lower(), (int)AlterTableHandler::type) + KexiDB_alteringTypeForProperty->insert(TQCString(name).lower(), (int)AlterTableHandler::type) #define I2(name, type1, type2) \ flag = (int)AlterTableHandler::type1|(int)AlterTableHandler::type2; \ if (flag & AlterTableHandler::PhysicalAlteringRequired) \ flag |= AlterTableHandler::MainSchemaAlteringRequired; \ - KexiDB_alteringTypeForProperty->insert(QCString(name).lower(), flag) + KexiDB_alteringTypeForProperty->insert(TQCString(name).lower(), flag) /* useful links: http://dev.mysql.com/doc/refman/5.0/en/create-table.html @@ -180,8 +180,8 @@ int AlterTableHandler::alteringTypeForProperty(const QCString& propertyName) if (res == 0) { if (KexiDB::isExtendedTableFieldProperty(propertyName)) return (int)ExtendedSchemaAlteringRequired; - KexiDBWarn << QString("AlterTableHandler::alteringTypeForProperty(): property \"%1\" not found!") - .arg(propertyName) << endl; + KexiDBWarn << TQString("AlterTableHandler::alteringTypeForProperty(): property \"%1\" not found!") + .tqarg(propertyName.data()) << endl; } return res; } @@ -189,7 +189,7 @@ int AlterTableHandler::alteringTypeForProperty(const QCString& propertyName) //--- AlterTableHandler::ChangeFieldPropertyAction::ChangeFieldPropertyAction( - const QString& fieldName, const QString& propertyName, const QVariant& newValue, int uid) + const TQString& fieldName, const TQString& propertyName, const TQVariant& newValue, int uid) : FieldActionBase(fieldName, uid) , m_propertyName(propertyName) , m_newValue(newValue) @@ -211,12 +211,12 @@ void AlterTableHandler::ChangeFieldPropertyAction::updateAlteringRequirements() setAlteringRequirements( alteringTypeForProperty( m_propertyName.latin1() ) ); } -QString AlterTableHandler::ChangeFieldPropertyAction::debugString(const DebugOptions& debugOptions) +TQString AlterTableHandler::ChangeFieldPropertyAction::debugString(const DebugOptions& debugOptions) { - QString s = QString("Set \"%1\" property for table field \"%2\" to \"%3\"") - .arg(m_propertyName).arg(fieldName()).arg(m_newValue.toString()); + TQString s = TQString("Set \"%1\" property for table field \"%2\" to \"%3\"") + .tqarg(m_propertyName).tqarg(fieldName()).tqarg(m_newValue.toString()); if (debugOptions.showUID) - s.append(QString(" (UID=%1)").arg(m_fieldUID)); + s.append(TQString(" (UID=%1)").tqarg(m_fieldUID)); return s; } @@ -230,9 +230,9 @@ static AlterTableHandler::ActionDict* createActionDict( } static void debugAction(AlterTableHandler::ActionBase *action, int nestingLevel, - bool simulate, const QString& prependString = QString::null, QString* debugTarget = 0) + bool simulate, const TQString& prependString = TQString(), TQString* debugTarget = 0) { - QString debugString; + TQString debugString; if (!debugTarget) debugString = prependString; if (action) { @@ -260,14 +260,14 @@ static void debugAction(AlterTableHandler::ActionBase *action, int nestingLevel, static void debugActionDict(AlterTableHandler::ActionDict *dict, int fieldUID, bool simulate) { - QString fieldName; + TQString fieldName; AlterTableHandler::ActionDictIterator it(*dict); if (dynamic_cast<AlterTableHandler::FieldActionBase*>(it.current())) //retrieve field name from the 1st related action fieldName = dynamic_cast<AlterTableHandler::FieldActionBase*>(it.current())->fieldName(); else fieldName = "??"; - QString dbg = QString("Action dict for field \"%1\" (%2, UID=%3):") - .arg(fieldName).arg(dict->count()).arg(fieldUID); + TQString dbg = TQString("Action dict for field \"%1\" (%2, UID=%3):") + .tqarg(fieldName).tqarg(dict->count()).tqarg(fieldUID); KexiDBDbg << dbg << endl; #ifdef KEXI_DEBUG_GUI if (simulate) @@ -314,9 +314,9 @@ void AlterTableHandler::ChangeFieldPropertyAction::simplifyActions(ActionDictDic ActionDict *actionsLikeThis = fieldActions[ uid() ]; if (m_propertyName=="name") { // Case 1. special: name1 -> name2, i.e. rename action - QString newName( newValue().toString() ); + TQString newName( newValue().toString() ); // try to find rename(newName, otherName) action - ActionBase *renameActionLikeThis = actionsLikeThis ? actionsLikeThis->find( "name" ) : 0; + ActionBase *renameActionLikeThis = actionsLikeThis ? actionsLikeThis->tqfind( "name" ) : 0; if (dynamic_cast<ChangeFieldPropertyAction*>(renameActionLikeThis)) { // 1. instead of having rename(fieldName(), newValue()) action, // let's have rename(fieldName(), otherName) action @@ -334,7 +334,7 @@ void AlterTableHandler::ChangeFieldPropertyAction::simplifyActions(ActionDictDic adict->insert(m_propertyName.latin1(), newRenameAction);*/ } else { - ActionBase *removeActionForThisField = actionsLikeThis ? actionsLikeThis->find( ":remove:" ) : 0; + ActionBase *removeActionForThisField = actionsLikeThis ? actionsLikeThis->tqfind( ":remove:" ) : 0; if (removeActionForThisField) { //if this field is going to be removed, jsut change the action's field name // and do not add a new action @@ -362,7 +362,7 @@ void AlterTableHandler::ChangeFieldPropertyAction::simplifyActions(ActionDictDic } return; } - ActionBase *removeActionForThisField = actionsLikeThis ? actionsLikeThis->find( ":remove:" ) : 0; + ActionBase *removeActionForThisField = actionsLikeThis ? actionsLikeThis->tqfind( ":remove:" ) : 0; if (removeActionForThisField) { //if this field is going to be removed, do not add a new action return; @@ -372,7 +372,7 @@ void AlterTableHandler::ChangeFieldPropertyAction::simplifyActions(ActionDictDic // becomes: [ setCaption(A, "captionB") ] // because adding this action does nothing ActionDict *nextActionsLikeThis = fieldActions[ uid() ]; //fieldName().latin1() ]; - if (!nextActionsLikeThis || !nextActionsLikeThis->find( m_propertyName.latin1() )) { + if (!nextActionsLikeThis || !nextActionsLikeThis->tqfind( m_propertyName.latin1() )) { //no such action, add this AlterTableHandler::ChangeFieldPropertyAction* newAction = new AlterTableHandler::ChangeFieldPropertyAction( *this ); @@ -389,7 +389,7 @@ bool AlterTableHandler::ChangeFieldPropertyAction::shouldBeRemoved(ActionDictDic } tristate AlterTableHandler::ChangeFieldPropertyAction::updateTableSchema(TableSchema &table, Field* field, - QMap<QString, QString>& fieldMap) + TQMap<TQString, TQString>& fieldMap) { //1. Simpler cases first: changes that do not affect table schema at all // "caption", "description", "width", "visibleDecimalPlaces" @@ -471,7 +471,7 @@ return true; //-------------------------------------------------------- -AlterTableHandler::RemoveFieldAction::RemoveFieldAction(const QString& fieldName, int uid) +AlterTableHandler::RemoveFieldAction::RemoveFieldAction(const TQString& fieldName, int uid) : FieldActionBase(fieldName, uid) { } @@ -493,11 +493,11 @@ void AlterTableHandler::RemoveFieldAction::updateAlteringRequirements() //! @todo } -QString AlterTableHandler::RemoveFieldAction::debugString(const DebugOptions& debugOptions) +TQString AlterTableHandler::RemoveFieldAction::debugString(const DebugOptions& debugOptions) { - QString s = QString("Remove table field \"%1\"").arg(fieldName()); + TQString s = TQString("Remove table field \"%1\"").tqarg(fieldName()); if (debugOptions.showUID) - s.append(QString(" (UID=%1)").arg(uid())); + s.append(TQString(" (UID=%1)").tqarg(uid())); return s; } @@ -519,7 +519,7 @@ void AlterTableHandler::RemoveFieldAction::simplifyActions(ActionDictDict &field } tristate AlterTableHandler::RemoveFieldAction::updateTableSchema(TableSchema &table, Field* field, - QMap<QString, QString>& fieldMap) + TQMap<TQString, TQString>& fieldMap) { fieldMap.remove( field->name() ); table.removeField(field); @@ -569,7 +569,7 @@ void AlterTableHandler::InsertFieldAction::setField(KexiDB::Field* field) if (m_field) delete m_field; m_field = field; - setFieldName(m_field ? m_field->name() : QString::null); + setFieldName(m_field ? m_field->name() : TQString()); } void AlterTableHandler::InsertFieldAction::updateAlteringRequirements() @@ -580,14 +580,14 @@ void AlterTableHandler::InsertFieldAction::updateAlteringRequirements() //! @todo } -QString AlterTableHandler::InsertFieldAction::debugString(const DebugOptions& debugOptions) +TQString AlterTableHandler::InsertFieldAction::debugString(const DebugOptions& debugOptions) { - QString s = QString("Insert table field \"%1\" at position %2") - .arg(m_field->name()).arg(m_index); + TQString s = TQString("Insert table field \"%1\" at position %2") + .tqarg(m_field->name()).tqarg(m_index); if (debugOptions.showUID) - s.append(QString(" (UID=%1)").arg(m_fieldUID)); + s.append(TQString(" (UID=%1)").tqarg(m_fieldUID)); if (debugOptions.showFieldDebug) - s.append(QString(" (%1)").arg(m_field->debugString())); + s.append(TQString(" (%1)").tqarg(m_field->debugString())); return s; } @@ -608,7 +608,7 @@ void AlterTableHandler::InsertFieldAction::simplifyActions(ActionDictDict &field // Try to find actions related to this action ActionDict *actionsForThisField = fieldActions[ uid() ]; //m_field->name().latin1() ]; - ActionBase *removeActionForThisField = actionsForThisField ? actionsForThisField->find( ":remove:" ) : 0; + ActionBase *removeActionForThisField = actionsForThisField ? actionsForThisField->tqfind( ":remove:" ) : 0; if (removeActionForThisField) { //if this field is going to be removed, do not add a new action //and remove the "Remove" action @@ -617,7 +617,7 @@ void AlterTableHandler::InsertFieldAction::simplifyActions(ActionDictDict &field } if (actionsForThisField) { //collect property values that have to be changed in this field - QMap<QCString, QVariant> values; + TQMap<TQCString, TQVariant> values; for (ActionDictIterator it(*actionsForThisField); it.current();) { ChangeFieldPropertyAction* changePropertyAction = dynamic_cast<ChangeFieldPropertyAction*>(it.current()); if (changePropertyAction) { @@ -642,13 +642,13 @@ void AlterTableHandler::InsertFieldAction::simplifyActions(ActionDictDict &field field().debug(); #ifdef KEXI_DEBUG_GUI KexiUtils::addAlterTableActionDebug( - QString("** Property-set actions moved to field definition itself:\n")+field().debugString(), 0); + TQString("** Property-set actions moved to field definition itself:\n")+field().debugString(), 0); #endif } else { #ifdef KEXI_DEBUG_GUI KexiUtils::addAlterTableActionDebug( - QString("** Failed to set properties for field ")+field().debugString(), 0); + TQString("** Failed to set properties for field ")+field().debugString(), 0); #endif KexiDBWarn << "AlterTableHandler::InsertFieldAction::simplifyActions(): KexiDB::setFieldProperties() failed!" << endl; delete f; @@ -665,7 +665,7 @@ void AlterTableHandler::InsertFieldAction::simplifyActions(ActionDictDict &field } tristate AlterTableHandler::InsertFieldAction::updateTableSchema(TableSchema &table, Field* field, - QMap<QString, QString>& fieldMap) + TQMap<TQString, TQString>& fieldMap) { //in most cases we won't add the field to fieldMap Q_UNUSED(field); @@ -686,7 +686,7 @@ tristate AlterTableHandler::InsertFieldAction::execute(Connection& conn, TableSc //-------------------------------------------------------- AlterTableHandler::MoveFieldPositionAction::MoveFieldPositionAction( - int fieldIndex, const QString& fieldName, int uid) + int fieldIndex, const TQString& fieldName, int uid) : FieldActionBase(fieldName, uid) , m_index(fieldIndex) { @@ -707,12 +707,12 @@ void AlterTableHandler::MoveFieldPositionAction::updateAlteringRequirements() //! @todo } -QString AlterTableHandler::MoveFieldPositionAction::debugString(const DebugOptions& debugOptions) +TQString AlterTableHandler::MoveFieldPositionAction::debugString(const DebugOptions& debugOptions) { - QString s = QString("Move table field \"%1\" to position %2") - .arg(fieldName()).arg(m_index); + TQString s = TQString("Move table field \"%1\" to position %2") + .tqarg(fieldName()).tqarg(m_index); if (debugOptions.showUID) - s.append(QString(" (UID=%1)").arg(uid())); + s.append(TQString(" (UID=%1)").tqarg(uid())); return s; } @@ -782,7 +782,7 @@ void AlterTableHandler::debug() it.current()->debug(); } -TableSchema* AlterTableHandler::execute(const QString& tableName, ExecutionArguments& args) +TableSchema* AlterTableHandler::execute(const TQString& tableName, ExecutionArguments& args) { args.result = false; if (!d->conn) { @@ -860,7 +860,7 @@ TableSchema* AlterTableHandler::execute(const QString& tableName, ExecutionArgum ActionVector actionsVector(allActionsCount); int currentActionsCount = 0; //some actions may be removed args.requirements = 0; - QDict<char> fieldsWithChangedMainSchema(997); // Used to collect fields with changed main schema. + TQDict<char> fieldsWithChangedMainSchema(997); // Used to collect fields with changed main schema. // This will be used when recreateTable is false to update kexi__fields for (ActionDictDictIterator it(fieldActions); it.current(); ++it) { for (AlterTableHandler::ActionDictIterator it2(*it.current());it2.current(); ++it2, currentActionsCount++) { @@ -878,7 +878,7 @@ TableSchema* AlterTableHandler::execute(const QString& tableName, ExecutionArgum } } // - Debug - QString dbg = QString("** Overall altering requirements: %1").arg(args.requirements); + TQString dbg = TQString("** Overall altering requirements: %1").tqarg(args.requirements); KexiDBDbg << dbg << endl; if (args.onlyComputeRequirements) { @@ -892,14 +892,14 @@ TableSchema* AlterTableHandler::execute(const QString& tableName, ExecutionArgum if (args.simulate) KexiUtils::addAlterTableActionDebug(dbg, 0); #endif - dbg = QString("** Ordered, simplified actions (%1, was %2):").arg(currentActionsCount).arg(allActionsCount); + dbg = TQString("** Ordered, simplified actions (%1, was %2):").tqarg(currentActionsCount).tqarg(allActionsCount); KexiDBDbg << dbg << endl; #ifdef KEXI_DEBUG_GUI if (args.simulate) KexiUtils::addAlterTableActionDebug(dbg, 0); #endif for (int i=0; i<allActionsCount; i++) { - debugAction(actionsVector[i], 1, args.simulate, QString("%1: ").arg(i+1), args.debugString); + debugAction(actionsVector[i], 1, args.simulate, TQString("%1: ").tqarg(i+1), args.debugString); } if (args.requirements == 0) {//nothing to do @@ -916,9 +916,9 @@ TableSchema* AlterTableHandler::execute(const QString& tableName, ExecutionArgum TableSchema *newTable = recreateTable ? new TableSchema(*oldTable, false/*!copy id*/) : oldTable; // find nonexisting temp name for new table schema if (recreateTable) { - QString tempDestTableName; + TQString tempDestTableName; while (true) { - tempDestTableName = QString("%1_temp%2%3").arg(newTable->name()).arg(QString::number(rand(), 16)).arg(QString::number(rand(), 16)); + tempDestTableName = TQString("%1_temp%2%3").tqarg(newTable->name()).tqarg(TQString::number(rand(), 16)).tqarg(TQString::number(rand(), 16)); if (!d->conn->tableSchema(tempDestTableName)) break; } @@ -931,7 +931,7 @@ TableSchema* AlterTableHandler::execute(const QString& tableName, ExecutionArgum // Update table schema in memory ---- int lastUID = -1; Field *currentField = 0; - QMap<QString, QString> fieldMap; // a map from new value to old value + TQMap<TQString, TQString> fieldMap; // a map from new value to old value foreach_list( Field::ListIterator, it, newTable->fieldsIterator() ) { fieldMap.insert( it.current()->name(), it.current()->name() ); } @@ -1007,14 +1007,14 @@ TableSchema* AlterTableHandler::execute(const QString& tableName, ExecutionArgum // -Some source fields can be skipped in case when there are deleted fields. // -Some destination fields can be skipped in case when there // are new empty fields without fixed/default value. - QString sql = QString("INSERT INTO %1 (").arg(d->conn->escapeIdentifier(newTable->name())); + TQString sql = TQString("INSERT INTO %1 (").tqarg(d->conn->escapeIdentifier(newTable->name())); //insert list of dest. fields bool first = true; - QString sourceFields; + TQString sourceFields; foreach_list( Field::ListIterator, it, newTable->fieldsIterator() ) { Field * const f = it.current(); - QString renamedFieldName( fieldMap[ f->name() ] ); - QString sourceSQLString; + TQString renamedFieldName( fieldMap[ f->name() ] ); + TQString sourceSQLString; if (!renamedFieldName.isEmpty()) { //this field should be renamed sourceSQLString = d->conn->escapeIdentifier(renamedFieldName); @@ -1051,7 +1051,7 @@ TableSchema* AlterTableHandler::execute(const QString& tableName, ExecutionArgum sourceFields.append( sourceSQLString ); } } - sql.append(QString(") SELECT ") + sourceFields + " FROM " + oldTable->name()); + sql.append(TQString(") SELECT ") + sourceFields + " FROM " + oldTable->name()); KexiDBDbg << " ** " << sql << endl; if (!d->conn->executeSQL( sql )) { setError(d->conn); @@ -1060,7 +1060,7 @@ TableSchema* AlterTableHandler::execute(const QString& tableName, ExecutionArgum return 0; } - const QString oldTableName = oldTable->name(); + const TQString oldTableName = oldTable->name(); /* args.result = d->conn->dropTable( oldTable ); if (!args.result || ~args.result) { setError(d->conn); @@ -1070,7 +1070,7 @@ TableSchema* AlterTableHandler::execute(const QString& tableName, ExecutionArgum oldTable = 0;*/ // Replace the old table with the new one (oldTable will be destroyed) - if (!d->conn->alterTableName(*newTable, oldTableName, true /*replace*/)) { + if (!d->conn->alterTableName(*newTable, oldTableName, true /*tqreplace*/)) { setError(d->conn); //! @todo delete newTable... args.result = false; @@ -1082,7 +1082,7 @@ TableSchema* AlterTableHandler::execute(const QString& tableName, ExecutionArgum if (!recreateTable) { if ((MainSchemaAlteringRequired & args.requirements) && !fieldsWithChangedMainSchema.isEmpty()) { //update main schema (kexi__fields) for changed fields - foreach_list(QDictIterator<char>, it, fieldsWithChangedMainSchema) { + foreach_list(TQDictIterator<char>, it, fieldsWithChangedMainSchema) { Field *f = newTable->field( it.currentKey() ); if (f) { if (!d->conn->storeMainFieldSchema(f)) { @@ -1100,12 +1100,12 @@ TableSchema* AlterTableHandler::execute(const QString& tableName, ExecutionArgum return newTable; } -/*TableSchema* AlterTableHandler::execute(const QString& tableName, tristate &result, bool simulate) +/*TableSchema* AlterTableHandler::execute(const TQString& tableName, tristate &result, bool simulate) { return executeInternal( tableName, result, simulate, 0 ); } -tristate AlterTableHandler::simulateExecution(const QString& tableName, QString& debugString) +tristate AlterTableHandler::simulateExecution(const TQString& tableName, TQString& debugString) { tristate result; (void)executeInternal( tableName, result, true//simulate diff --git a/kexi/kexidb/alter.h b/kexi/kexidb/alter.h index 1e6d8e87..807c28eb 100644 --- a/kexi/kexidb/alter.h +++ b/kexi/kexidb/alter.h @@ -22,8 +22,8 @@ #include "connection.h" -#include <qvaluelist.h> -#include <qasciidict.h> +#include <tqvaluelist.h> +#include <tqasciidict.h> #include <kdebug.h> @@ -141,17 +141,17 @@ class KEXI_DB_EXPORT AlterTableHandler : public Object }; class ActionBase; - typedef QAsciiDict<ActionBase> ActionDict; //!< for collecting actions related to a single field - typedef QIntDict<ActionDict> ActionDictDict; //!< for collecting groups of actions by field UID - typedef QAsciiDictIterator<ActionBase> ActionDictIterator; - typedef QIntDictIterator<ActionDict> ActionDictDictIterator; - typedef QPtrVector<ActionBase> ActionVector; //!< for collecting actions related to a single field + typedef TQAsciiDict<ActionBase> ActionDict; //!< for collecting actions related to a single field + typedef TQIntDict<ActionDict> ActionDictDict; //!< for collecting groups of actions by field UID + typedef TQAsciiDictIterator<ActionBase> ActionDictIterator; + typedef TQIntDictIterator<ActionDict> ActionDictDictIterator; + typedef TQPtrVector<ActionBase> ActionVector; //!< for collecting actions related to a single field //! Defines a type for action list. - typedef QPtrList<ActionBase> ActionList; + typedef TQPtrList<ActionBase> ActionList; //! Defines a type for action list's iterator. - typedef QPtrListIterator<ActionBase> ActionListIterator; + typedef TQPtrListIterator<ActionBase> ActionListIterator; //! Abstract base class used for implementing all the AlterTable actions. class KEXI_DB_EXPORT ActionBase { @@ -182,7 +182,7 @@ class KEXI_DB_EXPORT AlterTableHandler : public Object bool showFieldDebug : 1; }; - virtual QString debugString(const DebugOptions& debugOptions = DebugOptions()) { + virtual TQString debugString(const DebugOptions& debugOptions = DebugOptions()) { Q_UNUSED(debugOptions); return "ActionBase"; } void debug(const DebugOptions& debugOptions = DebugOptions()) { KexiDBDbg << debugString(debugOptions) @@ -210,7 +210,7 @@ class KEXI_DB_EXPORT AlterTableHandler : public Object Q_UNUSED(fieldActions); return false; } virtual tristate updateTableSchema(TableSchema &table, Field* field, - QMap<QString, QString>& fieldMap) + TQMap<TQString, TQString>& fieldMap) { Q_UNUSED(table); Q_UNUSED(field); Q_UNUSED(fieldMap); return true; } private: @@ -231,12 +231,12 @@ class KEXI_DB_EXPORT AlterTableHandler : public Object //! Abstract base class used for implementing table field-related actions. class KEXI_DB_EXPORT FieldActionBase : public ActionBase { public: - FieldActionBase(const QString& fieldName, int uid); + FieldActionBase(const TQString& fieldName, int uid); FieldActionBase(bool); virtual ~FieldActionBase(); //! \return field name for this action - QString fieldName() const { return m_fieldName; } + TQString fieldName() const { return m_fieldName; } /*! \return field's unique identifier This id is needed because in the meantime there can be more than one @@ -250,14 +250,14 @@ class KEXI_DB_EXPORT AlterTableHandler : public Object int uid() const { return m_fieldUID; } //! Sets field name for this action - void setFieldName(const QString& fieldName) { m_fieldName = fieldName; } + void setFieldName(const TQString& fieldName) { m_fieldName = fieldName; } protected: //! field's unique identifier, @see uid() int m_fieldUID; private: - QString m_fieldName; + TQString m_fieldName; }; /*! Defines an action for changing a single property value of a table field. @@ -270,22 +270,22 @@ class KEXI_DB_EXPORT AlterTableHandler : public Object */ class KEXI_DB_EXPORT ChangeFieldPropertyAction : public FieldActionBase { public: - ChangeFieldPropertyAction(const QString& fieldName, - const QString& propertyName, const QVariant& newValue, int uid); + ChangeFieldPropertyAction(const TQString& fieldName, + const TQString& propertyName, const TQVariant& newValue, int uid); //! @internal, used for constructing null action ChangeFieldPropertyAction(bool null); virtual ~ChangeFieldPropertyAction(); - QString propertyName() const { return m_propertyName; } - QVariant newValue() const { return m_newValue; } - virtual QString debugString(const DebugOptions& debugOptions = DebugOptions()); + TQString propertyName() const { return m_propertyName; } + TQVariant newValue() const { return m_newValue; } + virtual TQString debugString(const DebugOptions& debugOptions = DebugOptions()); virtual void simplifyActions(ActionDictDict &fieldActions); virtual bool shouldBeRemoved(ActionDictDict &fieldActions); virtual tristate updateTableSchema(TableSchema &table, Field* field, - QMap<QString, QString>& fieldMap); + TQMap<TQString, TQString>& fieldMap); protected: virtual void updateAlteringRequirements(); @@ -293,23 +293,23 @@ class KEXI_DB_EXPORT AlterTableHandler : public Object //! Performs physical execution of this action. virtual tristate execute(Connection &conn, TableSchema &table); - QString m_propertyName; - QVariant m_newValue; + TQString m_propertyName; + TQVariant m_newValue; }; //! Defines an action for removing a single table field. class KEXI_DB_EXPORT RemoveFieldAction : public FieldActionBase { public: - RemoveFieldAction(const QString& fieldName, int uid); + RemoveFieldAction(const TQString& fieldName, int uid); RemoveFieldAction(bool); virtual ~RemoveFieldAction(); - virtual QString debugString(const DebugOptions& debugOptions = DebugOptions()); + virtual TQString debugString(const DebugOptions& debugOptions = DebugOptions()); virtual void simplifyActions(ActionDictDict &fieldActions); virtual tristate updateTableSchema(TableSchema &table, Field* field, - QMap<QString, QString>& fieldMap); + TQMap<TQString, TQString>& fieldMap); protected: virtual void updateAlteringRequirements(); @@ -331,12 +331,12 @@ class KEXI_DB_EXPORT AlterTableHandler : public Object void setIndex( int index ) { m_index = index; } KexiDB::Field& field() const { return *m_field; } void setField(KexiDB::Field* field); - virtual QString debugString(const DebugOptions& debugOptions = DebugOptions()); + virtual TQString debugString(const DebugOptions& debugOptions = DebugOptions()); virtual void simplifyActions(ActionDictDict &fieldActions); virtual tristate updateTableSchema(TableSchema &table, Field* field, - QMap<QString, QString>& fieldMap); + TQMap<TQString, TQString>& fieldMap); protected: virtual void updateAlteringRequirements(); @@ -354,12 +354,12 @@ class KEXI_DB_EXPORT AlterTableHandler : public Object position within table schema. */ class KEXI_DB_EXPORT MoveFieldPositionAction : public FieldActionBase { public: - MoveFieldPositionAction(int fieldIndex, const QString& fieldName, int uid); + MoveFieldPositionAction(int fieldIndex, const TQString& fieldName, int uid); MoveFieldPositionAction(bool); virtual ~MoveFieldPositionAction(); int index() const { return m_index; } - virtual QString debugString(const DebugOptions& debugOptions = DebugOptions()); + virtual TQString debugString(const DebugOptions& debugOptions = DebugOptions()); virtual void simplifyActions(ActionDictDict &fieldActions); @@ -408,7 +408,7 @@ class KEXI_DB_EXPORT AlterTableHandler : public Object { } /*! If not 0, debug is directed here. Used only in the alter table test suite. */ - QString* debugString; + TQString* debugString; /*! Requrements computed, a combination of AlteringRequirements values. */ int requirements; /*! Set to true on success, to false on failure. */ @@ -439,14 +439,14 @@ class KEXI_DB_EXPORT AlterTableHandler : public Object \return the new table schema object created as a result of schema altering. The old table is returned if recreating table schema was not necessary or args.simulate is true. 0 is returned if args.result is not true. */ - TableSchema* execute(const QString& tableName, ExecutionArguments & args); + TableSchema* execute(const TQString& tableName, ExecutionArguments & args); //! Displays debug information about all actions collected by the handler. void debug(); /*! Like execute() with simulate set to true, but debug is directed to debugString. This function is used only in the alter table test suite. */ -// tristate simulateExecution(const QString& tableName, QString& debugString); +// tristate simulateExecution(const TQString& tableName, TQString& debugString); /*! Helper. \return a combination of AlteringRequirements values decribing altering type required when a given property field's \a propertyName is altered. @@ -454,11 +454,11 @@ class KEXI_DB_EXPORT AlterTableHandler : public Object as a temporary replacement before AlterTableHandler is fully implemented. Thus, it is possible to identify properties that have no PhysicalAlteringRequired flag set (e.g. caption or extended properties like visibleDecimalPlaces. */ - static int alteringTypeForProperty(const QCString& propertyName); + static int alteringTypeForProperty(const TQCString& propertyName); protected: -// TableSchema* executeInternal(const QString& tableName, tristate& result, bool simulate = false, -// QString* debugString = 0); +// TableSchema* executeInternal(const TQString& tableName, tristate& result, bool simulate = false, +// TQString* debugString = 0); class Private; Private *d; diff --git a/kexi/kexidb/connection.cpp b/kexi/kexidb/connection.cpp index 1a401a8a..830dee29 100644 --- a/kexi/kexidb/connection.cpp +++ b/kexi/kexidb/connection.cpp @@ -39,10 +39,10 @@ #include <kexiutils/utils.h> #include <kexiutils/identifier.h> -#include <qdir.h> -#include <qfileinfo.h> -#include <qguardedptr.h> -#include <qdom.h> +#include <tqdir.h> +#include <tqfileinfo.h> +#include <tqguardedptr.h> +#include <tqdom.h> #include <klocale.h> #include <kdebug.h> @@ -112,31 +112,31 @@ class ConnectionPrivate delete m_parser; } - void errorInvalidDBContents(const QString& details) { + void errorInvalidDBContents(const TQString& details) { conn->setError( ERR_INVALID_DATABASE_CONTENTS, i18n("Invalid database contents. ")+details); } - QString strItIsASystemObject() const { + TQString strItIsASystemObject() const { return i18n("It is a system object."); } inline Parser *parser() { return m_parser ? m_parser : (m_parser = new Parser(conn)); } Connection* const conn; //!< The \a Connection instance this \a ConnectionPrivate belongs to. - QGuardedPtr<ConnectionData> conn_data; //!< the \a ConnectionData used within that connection. + TQGuardedPtr<ConnectionData> conn_data; //!< the \a ConnectionData used within that connection. /*! Default transaction handle. If transactions are supported: Any operation on database (e.g. inserts) that is started without specifying transaction context, will be performed in the context of this transaction. */ Transaction default_trans; - QValueList<Transaction> transactions; + TQValueList<Transaction> transactions; - QPtrDict< QPtrList<Connection::TableSchemaChangeListenerInterface> > tableSchemaChangeListeners; + TQPtrDict< TQPtrList<Connection::TableSchemaChangeListenerInterface> > tableSchemaChangeListeners; - //! Used in Connection::setQuerySchemaObsolete( const QString& queryName ) + //! Used in Connection::setQuerySchemaObsolete( const TQString& queryName ) //! to collect obsolete queries. THese are deleted on connection deleting. - QPtrList<QuerySchema> obsoleteQueries; + TQPtrList<QuerySchema> obsoleteQueries; //! server version information for this connection. @@ -148,19 +148,19 @@ class ConnectionPrivate Parser *m_parser; //! Table schemas retrieved on demand with tableSchema() - QIntDict<TableSchema> tables; - QDict<TableSchema> tables_byname; - QIntDict<QuerySchema> queries; - QDict<QuerySchema> queries_byname; + TQIntDict<TableSchema> tables; + TQDict<TableSchema> tables_byname; + TQIntDict<QuerySchema> queries; + TQDict<QuerySchema> queries_byname; //! used just for removing system TableSchema objects on db close. - QPtrDict<TableSchema> kexiDBSystemTables; + TQPtrDict<TableSchema> kexiDBSystemTables; //! Database properties DatabaseProperties* dbProperties; - QString availableDatabaseName; //!< used by anyAvailableDatabaseName() - QString usedDatabase; //!< database name that is opened now (the currentDatabase() name) + TQString availableDatabaseName; //!< used by anyAvailableDatabaseName() + TQString usedDatabase; //!< database name that is opened now (the currentDatabase() name) //! true if rollbackTransaction() and commitTransaction() shouldn't remove //! the transaction object from 'transactions' list; used by closeDatabase() @@ -194,10 +194,10 @@ class ConnectionPrivate using namespace KexiDB; //! static: list of internal KexiDB system table names -QStringList KexiDB_kexiDBSystemTableNames; +TQStringList KexiDB_kexiDBSystemTableNames; Connection::Connection( Driver *driver, ConnectionData &conn_data ) - : QObject() + : TQObject() ,KexiDB::Object() ,d(new ConnectionPrivate(this, conn_data)) ,m_driver(driver) @@ -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(QDir::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; } @@ -268,7 +268,7 @@ bool Connection::isDatabaseUsed() const void Connection::clearError() { Object::clearError(); - m_sql = QString::null; + m_sql = TQString(); } bool Connection::disconnect() @@ -311,34 +311,34 @@ bool Connection::checkIsDatabaseUsed() return false; } -QStringList Connection::databaseNames(bool also_system_db) +TQStringList Connection::databaseNames(bool also_system_db) { KexiDBDbg << "Connection::databaseNames("<<also_system_db<<")"<< endl; if (!checkConnected()) - return QStringList(); + return TQStringList(); - QString tmpdbName; + TQString tmpdbName; //some engines need to have opened any database before executing "create database" if (!useTemporaryDatabaseIfNeeded(tmpdbName)) - return QStringList(); + return TQStringList(); - QStringList list, non_system_list; + TQStringList list, non_system_list; bool ret = drv_getDatabasesList( list ); if (!tmpdbName.isEmpty()) { //whatever result is - now we have to close temporary opened database: if (!closeDatabase()) - return QStringList(); + return TQStringList(); } if (!ret) - return QStringList(); + return TQStringList(); if (also_system_db) return list; //filter system databases: - for (QStringList::ConstIterator it = list.constBegin(); it!=list.constEnd(); ++it) { + for (TQStringList::ConstIterator it = list.constBegin(); it!=list.constEnd(); ++it) { KexiDBDbg << "Connection::databaseNames(): " << *it << endl; if (!m_driver->isSystemDatabaseName(*it)) { KexiDBDbg << "add " << *it << endl; @@ -348,29 +348,29 @@ QStringList Connection::databaseNames(bool also_system_db) return non_system_list; } -bool Connection::drv_getDatabasesList( QStringList &list ) +bool Connection::drv_getDatabasesList( TQStringList &list ) { list.clear(); return true; } -bool Connection::drv_databaseExists( const QString &dbName, bool ignoreErrors ) +bool Connection::drv_databaseExists( const TQString &dbName, bool ignoreErrors ) { - QStringList list = databaseNames(true);//also system + TQStringList list = databaseNames(true);//also system if (error()) { return false; } - if (list.find( dbName )==list.end()) { + if (list.tqfind( 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; } return true; } -bool Connection::databaseExists( const QString &dbName, bool ignoreErrors ) +bool Connection::databaseExists( const TQString &dbName, bool ignoreErrors ) { // KexiDBDbg << "Connection::databaseExists(" << dbName << "," << ignoreErrors << ")" << endl; if (!checkConnected()) @@ -380,29 +380,29 @@ bool Connection::databaseExists( const QString &dbName, bool ignoreErrors ) if (m_driver->isFileDriver()) { //for file-based db: file must exists and be accessible //js: moved from useDatabase(): - QFileInfo file(d->conn_data->fileName()); + TQFileInfo file(d->conn_data->fileName()); if (!file.exists() || ( !file.isFile() && !file.isSymLink()) ) { if (!ignoreErrors) setError(ERR_OBJECT_NOT_FOUND, i18n("Database file \"%1\" does not exist.") - .arg(QDir::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(QDir::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(QDir::convertSeparators(d->conn_data->fileName())) ); + .tqarg(TQDir::convertSeparators(d->conn_data->fileName())) ); return false; } return true; } - QString tmpdbName; + TQString tmpdbName; //some engines need to have opened any database before executing "create database" const bool orig_skip_databaseExists_check_in_useDatabase = d->skip_databaseExists_check_in_useDatabase; d->skip_databaseExists_check_in_useDatabase = true; @@ -424,7 +424,7 @@ bool Connection::databaseExists( const QString &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; \ } } @@ -432,18 +432,18 @@ bool Connection::databaseExists( const QString &dbName, bool ignoreErrors ) { createDatabase_CLOSE; return false; } -bool Connection::createDatabase( const QString &dbName ) +bool Connection::createDatabase( const TQString &dbName ) { if (!checkConnected()) 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()) { @@ -451,14 +451,14 @@ bool Connection::createDatabase( const QString &dbName ) d->conn_data->setFileName( dbName ); } - QString tmpdbName; + TQString tmpdbName; //some engines need to have opened any database before executing "create database" if (!useTemporaryDatabaseIfNeeded(tmpdbName)) return false; //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 QString &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; } } @@ -496,7 +496,7 @@ bool Connection::createDatabase( const QString &dbName ) return false; //-physically create system tables - for (QPtrDictIterator<TableSchema> it(d->kexiDBSystemTables); it.current(); ++it) { + for (TQPtrDictIterator<TableSchema> it(d->kexiDBSystemTables); it.current(); ++it) { if (!drv_createTable( it.current()->name() )) createDatabase_ERROR; } @@ -510,9 +510,9 @@ bool Connection::createDatabase( const QString &dbName ) FieldList *fl = ts->subList("p_id", "p_name", "p_mime", "p_url"); if (!fl) createDatabase_ERROR; - if (!insertRecord(*fl, QVariant(1), QVariant("Tables"), QVariant("kexi/table"), QVariant("http://koffice.org/kexi/"))) + if (!insertRecord(*fl, TQVariant(1), TQVariant("Tables"), TQVariant("kexi/table"), TQVariant("http://koffice.org/kexi/"))) createDatabase_ERROR; - if (!insertRecord(*fl, QVariant(2), QVariant("Queries"), QVariant("kexi/query"), QVariant("http://koffice.org/kexi/"))) + if (!insertRecord(*fl, TQVariant(2), TQVariant("Queries"), TQVariant("kexi/query"), TQVariant("http://koffice.org/kexi/"))) createDatabase_ERROR; */ @@ -534,7 +534,7 @@ bool Connection::createDatabase( const QString &dbName ) #undef createDatabase_CLOSE #undef createDatabase_ERROR -bool Connection::useDatabase( const QString &dbName, bool kexiCompatible, bool *cancelled, MessageHandler* msgHandler ) +bool Connection::useDatabase( const TQString &dbName, bool kexiCompatible, bool *cancelled, MessageHandler* msgHandler ) { if (cancelled) *cancelled = false; @@ -544,9 +544,9 @@ bool Connection::useDatabase( const QString &dbName, bool kexiCompatible, bool * if (dbName.isEmpty()) return false; - QString my_dbName = dbName; + TQString my_dbName = dbName; // if (my_dbName.isEmpty()) { -// const QStringList& db_lst = databaseNames(); +// const TQStringList& db_lst = databaseNames(); // if (!db_lst.isEmpty()) // my_dbName = db_lst.first(); // } @@ -566,7 +566,7 @@ bool Connection::useDatabase( const QString &dbName, bool kexiCompatible, bool * if (!drv_useDatabase( my_dbName, cancelled, msgHandler )) { if (cancelled && *cancelled) return false; - QString 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 @@ -582,14 +582,14 @@ bool Connection::useDatabase( const QString &dbName, bool kexiCompatible, bool * //-get global database information int num; bool ok; -// static QString notfound_str = i18n("\"%1\" database property not found"); +// static TQString notfound_str = i18n("\"%1\" database property not found"); num = d->dbProperties->value("kexidb_major_ver").toInt(&ok); if (!ok) return false; d->databaseVersion.major = num; /* if (true!=querySingleNumber( - "select db_value from kexi__db where db_property=" + m_driver->escapeString(QString("kexidb_major_ver")), num)) { - d->errorInvalidDBContents(notfound_str.arg("kexidb_major_ver")); + "select db_value from kexi__db where db_property=" + m_driver->escapeString(TQString("kexidb_major_ver")), num)) { + d->errorInvalidDBContents(notfound_str.tqarg("kexidb_major_ver")); return false; }*/ num = d->dbProperties->value("kexidb_minor_ver").toInt(&ok); @@ -597,8 +597,8 @@ bool Connection::useDatabase( const QString &dbName, bool kexiCompatible, bool * return false; d->databaseVersion.minor = num; /* if (true!=querySingleNumber( - "select db_value from kexi__db where db_property=" + m_driver->escapeString(QString("kexidb_minor_ver")), num)) { - d->errorInvalidDBContents(notfound_str.arg("kexidb_minor_ver")); + "select db_value from kexi__db where db_property=" + m_driver->escapeString(TQString("kexidb_minor_ver")), num)) { + d->errorInvalidDBContents(notfound_str.tqarg("kexidb_minor_ver")); return false; }*/ @@ -607,8 +607,8 @@ bool Connection::useDatabase( const QString &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( QString("%1.%2").arg(versionMajor()).arg(versionMinor()) ) - .arg( QString("%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()) { @@ -633,7 +633,7 @@ bool Connection::closeDatabase() /*! \todo (js) add CLEVER algorithm here for nested transactions */ if (m_driver->transactionsSupported()) { //rollback all transactions - QValueList<Transaction>::ConstIterator it; + TQValueList<Transaction>::ConstIterator it; d->dont_remove_transactions=true; //lock! for (it=d->transactions.constBegin(); it!= d->transactions.constEnd(); ++it) { if (!rollbackTransaction(*it)) {//rollback as much as you can, don't stop on prev. errors @@ -642,7 +642,7 @@ bool Connection::closeDatabase() else { KexiDBDbg << "Connection::closeDatabase(): transaction rolled back!" << endl; KexiDBDbg << "Connection::closeDatabase(): trans.refcount==" << - ((*it).m_data ? QString::number((*it).m_data->refcount) : "(null)") << endl; + ((*it).m_data ? TQString::number((*it).m_data->refcount) : "(null)") << endl; } } d->dont_remove_transactions=false; //unlock! @@ -664,14 +664,14 @@ bool Connection::closeDatabase() return ret; } -QString Connection::currentDatabase() const +TQString Connection::currentDatabase() const { return d->usedDatabase; } -bool Connection::useTemporaryDatabaseIfNeeded(QString &tmpdbName) +bool Connection::useTemporaryDatabaseIfNeeded(TQString &tmpdbName) { - if (!m_driver->isFileDriver() && m_driver->beh->USING_DATABASE_REQUIRED_TO_CONNECT + if (!m_driver->isFileDriver() && m_driver->beh->USING_DATABASE_RETQUIRED_TO_CONNECT && !isDatabaseUsed()) { //we have no db used, but it is required by engine to have used any! tmpdbName = anyAvailableDatabaseName(); @@ -686,19 +686,19 @@ bool Connection::useTemporaryDatabaseIfNeeded(QString &tmpdbName) if (!ret) { setError(errorNum(), i18n("Error during starting temporary connection using \"%1\" database name.") - .arg(tmpdbName) ); + .tqarg(tmpdbName) ); return false; } } return true; } -bool Connection::dropDatabase( const QString &dbName ) +bool Connection::dropDatabase( const TQString &dbName ) { if (!checkConnected()) return false; - QString dbToDrop; + TQString dbToDrop; if (dbName.isEmpty() && d->usedDatabase.isEmpty()) { if (!m_driver->isFileDriver() || (m_driver->isFileDriver() && d->conn_data->fileName().isEmpty()) ) { @@ -713,7 +713,7 @@ bool Connection::dropDatabase( const QString &dbName ) dbToDrop = d->usedDatabase; } else { if (m_driver->isFileDriver()) //lets get full path - dbToDrop = QFileInfo(dbName).absFilePath(); + dbToDrop = TQFileInfo(dbName).absFilePath(); else dbToDrop = dbName; } @@ -725,7 +725,7 @@ bool Connection::dropDatabase( const QString &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; } @@ -735,7 +735,7 @@ bool Connection::dropDatabase( const QString &dbName ) return false; } - QString tmpdbName; + TQString tmpdbName; //some engines need to have opened any database before executing "drop database" if (!useTemporaryDatabaseIfNeeded(tmpdbName)) return false; @@ -751,9 +751,9 @@ bool Connection::dropDatabase( const QString &dbName ) return ret; } -QStringList Connection::objectNames(int objType, bool* ok) +TQStringList Connection::objectNames(int objType, bool* ok) { - QStringList list; + TQStringList list; if (!checkIsDatabaseUsed()) { if(ok) @@ -761,11 +761,11 @@ QStringList Connection::objectNames(int objType, bool* ok) return list; } - QString sql; + TQString sql; if (objType==KexiDB::AnyObjectType) sql = "SELECT o_name FROM kexi__objects"; else - sql = QString::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) { @@ -775,7 +775,7 @@ QStringList Connection::objectNames(int objType, bool* ok) } for (c->moveFirst(); !c->eof(); c->moveNext()) { - QString name = c->value(0).toString(); + TQString name = c->value(0).toString(); if (KexiUtils::isIdentifier( name )) { list.append(name); } @@ -792,10 +792,10 @@ QStringList Connection::objectNames(int objType, bool* ok) return list; } -QStringList Connection::tableNames(bool also_system_tables) +TQStringList Connection::tableNames(bool also_system_tables) { bool ok = true; - QStringList list = objectNames(TableObjectType, &ok); + TQStringList list = objectNames(TableObjectType, &ok); if (also_system_tables && ok) { list += Connection::kexiDBSystemTableNames(); } @@ -803,7 +803,7 @@ QStringList Connection::tableNames(bool also_system_tables) } //! \todo (js): this will depend on KexiDB lib version -const QStringList& Connection::kexiDBSystemTableNames() +const TQStringList& Connection::kexiDBSystemTableNames() { if (KexiDB_kexiDBSystemTableNames.isEmpty()) { KexiDB_kexiDBSystemTableNames @@ -834,30 +834,30 @@ DatabaseProperties& Connection::databaseProperties() return *d->dbProperties; } -QValueList<int> Connection::tableIds() +TQValueList<int> Connection::tableIds() { return objectIds(KexiDB::TableObjectType); } -QValueList<int> Connection::queryIds() +TQValueList<int> Connection::queryIds() { return objectIds(KexiDB::QueryObjectType); } -QValueList<int> Connection::objectIds(int objType) +TQValueList<int> Connection::objectIds(int objType) { - QValueList<int> list; + TQValueList<int> list; if (!checkIsDatabaseUsed()) return list; Cursor *c = executeQuery( - QString::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()) { - QString tname = c->value(1).toString(); //kexi__objects.o_name + TQString tname = c->value(1).toString(); //kexi__objects.o_name if (KexiUtils::isIdentifier( tname )) { list.append(c->value(0).toInt()); //kexi__objects.o_id } @@ -868,10 +868,10 @@ QValueList<int> Connection::objectIds(int objType) return list; } -QString Connection::createTableStatement( const KexiDB::TableSchema& tableSchema ) const +TQString Connection::createTableStatement( const KexiDB::TableSchema& tableSchema ) const { // Each SQL identifier needs to be escaped in the generated query. - QString sql; + TQString sql; sql.reserve(4096); sql = "CREATE TABLE " + escapeIdentifier(tableSchema.name()) + " ("; bool first=true; @@ -882,10 +882,10 @@ QString Connection::createTableStatement( const KexiDB::TableSchema& tableSchema first = false; else sql += ", "; - QString v = escapeIdentifier(field->name()) + " "; + TQString v = escapeIdentifier(field->name()) + " "; const bool autoinc = field->isAutoIncrement(); - const bool pk = field->isPrimaryKey() || (autoinc && m_driver->beh->AUTO_INCREMENT_REQUIRES_PK); -//TODO: warning: ^^^^^ this allows only one autonumber per table when AUTO_INCREMENT_REQUIRES_PK==true! + const bool pk = field->isPrimaryKey() || (autoinc && m_driver->beh->AUTO_INCREMENT_RETQUIRES_PK); +//TODO: warning: ^^^^^ this allows only one autonumber per table when AUTO_INCREMENT_RETQUIRES_PK==true! if (autoinc && m_driver->beh->SPECIAL_AUTO_INCREMENT_DEF) { if (pk) v += m_driver->beh->AUTO_INCREMENT_TYPE + " " + m_driver->beh->AUTO_INCREMENT_PK_FIELD_OPTION; @@ -903,12 +903,12 @@ QString Connection::createTableStatement( const KexiDB::TableSchema& tableSchema if (field->isFPNumericType() && field->precision()>0) { if (field->scale()>0) - v += QString::fromLatin1("(%1,%2)").arg(field->precision()).arg(field->scale()); + v += TQString::tqfromLatin1("(%1,%2)").tqarg(field->precision()).tqarg(field->scale()); else - v += QString::fromLatin1("(%1)").arg(field->precision()); + v += TQString::tqfromLatin1("(%1)").tqarg(field->precision()); } else if (field->type()==Field::Text && field->length()>0) - v += QString::fromLatin1("(%1)").arg(field->length()); + v += TQString::tqfromLatin1("(%1)").tqarg(field->length()); if (autoinc) v += (" " + @@ -918,14 +918,14 @@ QString Connection::createTableStatement( const KexiDB::TableSchema& tableSchema if (pk) v += " PRIMARY KEY"; if (!pk && field->isUniqueKey()) - v += " UNIQUE"; + v += " UNITQUE"; ///@todo IS this ok for all engines?: if (!autoinc && !field->isPrimaryKey() && field->isNotNull()) if (!autoinc && !pk && field->isNotNull()) v += " NOT NULL"; //only add not null option if no autocommit is set if (field->defaultValue().isValid()) { - QString valToSQL( m_driver->valueToSQL( field, field->defaultValue() ) ); + TQString valToSQL( m_driver->valueToSQL( field, field->defaultValue() ) ); if (!valToSQL.isEmpty()) //for sanity - v += QString::fromLatin1(" DEFAULT ") + valToSQL; + v += TQString::tqfromLatin1(" DEFAULT ") + valToSQL; } } sql += v; @@ -935,20 +935,20 @@ QString Connection::createTableStatement( const KexiDB::TableSchema& tableSchema } //yeah, it is very efficient: -#define C_A(a) , const QVariant& c ## a +#define C_A(a) , const TQVariant& c ## a #define V_A0 m_driver->valueToSQL( tableSchema.field(0), c0 ) #define V_A(a) +","+m_driver->valueToSQL( \ tableSchema.field(a) ? tableSchema.field(a)->type() : Field::Text, c ## a ) -// KexiDBDbg << "******** " << QString("INSERT INTO ") + +// KexiDBDbg << "******** " << TQString("INSERT INTO ") + // escapeIdentifier(tableSchema.name()) + // " VALUES (" + vals + ")" <<endl; #define C_INS_REC(args, vals) \ bool Connection::insertRecord(KexiDB::TableSchema &tableSchema args) {\ return executeSQL( \ - QString("INSERT INTO ") + escapeIdentifier(tableSchema.name()) + " VALUES (" + vals + ")" \ + TQString("INSERT INTO ") + escapeIdentifier(tableSchema.name()) + " VALUES (" + vals + ")" \ ); \ } @@ -976,11 +976,11 @@ C_INS_REC_ALL #define C_INS_REC(args, vals) \ bool Connection::insertRecord(FieldList& fields args) \ { \ - QString value; \ + TQString value; \ Field::List *flist = fields.fields(); \ vals \ return executeSQL( \ - QString("INSERT INTO ") + \ + TQString("INSERT INTO ") + \ ((fields.fields()->first() && fields.fields()->first()->table()) ? \ escapeIdentifier(fields.fields()->first()->table()->name()) : \ "??") \ @@ -996,19 +996,19 @@ C_INS_REC_ALL #undef C_INS_REC #undef C_INS_REC_ALL -bool Connection::insertRecord(TableSchema &tableSchema, QValueList<QVariant>& values) +bool Connection::insertRecord(TableSchema &tableSchema, TQValueList<TQVariant>& values) { // Each SQL identifier needs to be escaped in the generated query. Field::List *fields = tableSchema.fields(); Field *f = fields->first(); -// QString s_val; +// TQString s_val; // s_val.reserve(4096); - m_sql = QString::null; - QValueList<QVariant>::ConstIterator it = values.constBegin(); + m_sql = TQString(); + TQValueList<TQVariant>::ConstIterator it = values.constBegin(); // int i=0; while (f && (it!=values.end())) { if (m_sql.isEmpty()) - m_sql = QString("INSERT INTO ") + + m_sql = TQString("INSERT INTO ") + escapeIdentifier(tableSchema.name()) + " VALUES ("; else @@ -1024,21 +1024,21 @@ bool Connection::insertRecord(TableSchema &tableSchema, QValueList<QVariant>& va return executeSQL(m_sql); } -bool Connection::insertRecord(FieldList& fields, QValueList<QVariant>& values) +bool Connection::insertRecord(FieldList& fields, TQValueList<TQVariant>& values) { // Each SQL identifier needs to be escaped in the generated query. Field::List *flist = fields.fields(); Field *f = flist->first(); if (!f) return false; -// QString s_val; +// TQString s_val; // s_val.reserve(4096); - m_sql = QString::null; - QValueList<QVariant>::ConstIterator it = values.constBegin(); + m_sql = TQString(); + TQValueList<TQVariant>::ConstIterator it = values.constBegin(); // int i=0; while (f && (it!=values.constEnd())) { if (m_sql.isEmpty()) - m_sql = QString("INSERT INTO ") + + m_sql = TQString("INSERT INTO ") + escapeIdentifier(flist->first()->table()->name()) + "(" + fields.sqlFieldsList(m_driver) + ") VALUES ("; else @@ -1053,11 +1053,11 @@ bool Connection::insertRecord(FieldList& fields, QValueList<QVariant>& values) return executeSQL(m_sql); } -bool Connection::executeSQL( const QString& statement ) +bool Connection::executeSQL( const TQString& statement ) { m_sql = statement; //remember for error handling if (!drv_executeSQL( m_sql )) { - m_errMsg = QString::null; //clear as this could be most probably jsut "Unknown error" string. + m_errMsg = TQString(); //clear as this could be most probably jsut "Unknown error" string. m_errorSql = statement; setError(this, ERR_SQL_EXECUTION_ERROR, i18n("Error while executing SQL statement.")); return false; @@ -1065,13 +1065,13 @@ bool Connection::executeSQL( const QString& statement ) return true; } -QString Connection::selectStatement( KexiDB::QuerySchema& querySchema, - const QValueList<QVariant>& params, +TQString Connection::selectStatement( KexiDB::QuerySchema& querySchema, + const TQValueList<TQVariant>& params, const SelectStatementOptions& options) const { //"SELECT FROM ..." is theoretically allowed " //if (querySchema.fieldCount()<1) -// return QString::null; +// return TQString(); // Each SQL identifier needs to be escaped in the generated query. if (!querySchema.statement().isEmpty()) @@ -1093,27 +1093,27 @@ QString Connection::selectStatement( KexiDB::QuerySchema& querySchema, } } - QString sql; //final sql string + TQString sql; //final sql string sql.reserve(4096); -//unused QString s_from_additional; //additional tables list needed for lookup fields - QString s_additional_joins; //additional joins needed for lookup fields - QString s_additional_fields; //additional fields to append to the fields list +//unused TQString s_from_additional; //additional tables list needed for lookup fields + TQString s_additional_joins; //additional joins needed for lookup fields + TQString s_additional_fields; //additional fields to append to the fields list uint internalUniqueTableAliasNumber = 0; //used to build internalUniqueTableAliases uint internalUniqueQueryAliasNumber = 0; //used to build internalUniqueQueryAliases number = 0; - QPtrList<QuerySchema> subqueries_for_lookup_data; // subqueries will be added to FROM section - QString kexidb_subquery_prefix("__kexidb_subquery_"); + TQPtrList<QuerySchema> subqueries_for_lookup_data; // subqueries will be added to FROM section + TQString kexidb_subquery_prefix("__kexidb_subquery_"); for (Field::ListIterator it = querySchema.fieldsIterator(); (f = it.current()); ++it, number++) { if (querySchema.isColumnVisible(number)) { if (!sql.isEmpty()) - sql += QString::fromLatin1(", "); + sql += TQString::tqfromLatin1(", "); if (f->isQueryAsterisk()) { if (!singleTable && static_cast<QueryAsterisk*>(f)->isSingleTableAsterisk()) //single-table * sql += escapeIdentifier(f->table()->name(), options.identifierEscaping) + - QString::fromLatin1(".*"); + TQString::tqfromLatin1(".*"); else //all-tables * (or simplified table.* when there's only one table) - sql += QString::fromLatin1("*"); + sql += TQString::tqfromLatin1("*"); } else { if (f->isExpression()) { @@ -1121,9 +1121,9 @@ QString Connection::selectStatement( KexiDB::QuerySchema& querySchema, } else { if (!f->table()) //sanity check - return QString::null; + return TQString(); - QString tableName; + TQString tableName; int tablePosition = querySchema.tableBoundToColumn(number); if (tablePosition>=0) tableName = querySchema.tableAlias(tablePosition); @@ -1135,9 +1135,9 @@ QString Connection::selectStatement( KexiDB::QuerySchema& querySchema, } sql += escapeIdentifier(f->name(), options.identifierEscaping); } - QString aliasString = QString(querySchema.columnAlias(number)); + TQString aliasString = TQString(querySchema.columnAlias(number)); if (!aliasString.isEmpty()) - sql += (QString::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 @@ QString Connection::selectStatement( KexiDB::QuerySchema& querySchema, { //add LEFT OUTER JOIN if (!s_additional_joins.isEmpty()) - s_additional_joins += QString::fromLatin1(" "); - QString internalUniqueTableAlias( QString("__kexidb_") + lookupTable->name() + "_" - + QString::number(internalUniqueTableAliasNumber++) ); - s_additional_joins += QString("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)); + 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") + .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 @@ QString Connection::selectStatement( KexiDB::QuerySchema& querySchema, /* not true //table should be added after FROM if (!s_from_additional.isEmpty()) - s_from_additional += QString::fromLatin1(", "); + s_from_additional += TQString::tqfromLatin1(", "); s_from_additional += escapeIdentifier(visibleField->table()->name(), options.identifierEscaping); */ } #endif if (!s_additional_fields.isEmpty()) - s_additional_fields += QString::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 ? ?" @@ -1197,48 +1197,48 @@ QString Connection::selectStatement( KexiDB::QuerySchema& querySchema, QuerySchema *lookupQuery = querySchema.connection()->querySchema( rowSource.name() ); if (!lookupQuery) { KexiDBWarn << "Connection::selectStatement(): !lookupQuery" << endl; - return QString::null; + return TQString(); } const QueryColumnInfo::Vector fieldsExpanded( lookupQuery->fieldsExpanded() ); if ((uint)lookupFieldSchema->boundColumn() >= fieldsExpanded.count()) { KexiDBWarn << "Connection::selectStatement(): (uint)lookupFieldSchema->boundColumn() >= fieldsExpanded.count()" << endl; - return QString::null; + return TQString(); } QueryColumnInfo *boundColumnInfo = fieldsExpanded.at( lookupFieldSchema->boundColumn() ); if (!boundColumnInfo) { KexiDBWarn << "Connection::selectStatement(): !boundColumnInfo" << endl; - return QString::null; + return TQString(); } Field *boundField = boundColumnInfo->field; if (!boundField) { KexiDBWarn << "Connection::selectStatement(): !boundField" << endl; - return QString::null; + return TQString(); } //add LEFT OUTER JOIN if (!s_additional_joins.isEmpty()) - s_additional_joins += QString::fromLatin1(" "); - QString internalUniqueQueryAlias( + s_additional_joins += TQString::tqfromLatin1(" "); + TQString internalUniqueQueryAlias( kexidb_subquery_prefix + lookupQuery->name() + "_" - + QString::number(internalUniqueQueryAliasNumber++) ); - s_additional_joins += QString("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)); + + TQString::number(internalUniqueQueryAliasNumber++) ); + s_additional_joins += TQString("LEFT OUTER JOIN (%1) AS %2 ON %3.%4=%5.%6") + .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 += QString::fromLatin1(", "); - const QValueList<uint> visibleColumns( lookupFieldSchema->visibleColumns() ); - QString expression; - foreach (QValueList<uint>::ConstIterator, visibleColumnsIt, visibleColumns) { + s_additional_fields += TQString::tqfromLatin1(", "); + const TQValueList<uint> visibleColumns( lookupFieldSchema->visibleColumns() ); + TQString expression; + foreach (TQValueList<uint>::ConstIterator, visibleColumnsIt, visibleColumns) { //! @todo Add lookup schema option for separator other than ' ' or even option for placeholders like "Name ? ?" //! @todo Add possibility for joining the values at client side. if (fieldsExpanded.count() <= (*visibleColumnsIt)) { KexiDBWarn << "Connection::selectStatement(): fieldsExpanded.count() <= (*visibleColumnsIt) : " << fieldsExpanded.count() << " <= " << *visibleColumnsIt << endl; - return QString::null; + return TQString(); } if (!expression.isEmpty()) expression += " || ' ' || "; @@ -1252,7 +1252,7 @@ QString Connection::selectStatement( KexiDB::QuerySchema& querySchema, else { KexiDBWarn << "Connection::selectStatement(): unsupported row source type " << rowSource.typeName() << endl; - return QString(); + return TQString(); } } } @@ -1260,12 +1260,12 @@ QString Connection::selectStatement( KexiDB::QuerySchema& querySchema, //add lookup fields if (!s_additional_fields.isEmpty()) - sql += (QString::fromLatin1(", ") + s_additional_fields); + sql += (TQString::tqfromLatin1(", ") + s_additional_fields); if (options.alsoRetrieveROWID) { //append rowid column - QString s; + TQString s; if (!sql.isEmpty()) - s = QString::fromLatin1(", "); + s = TQString::tqfromLatin1(", "); if (querySchema.masterTable()) s += (escapeIdentifier(querySchema.masterTable()->name())+"."); s += m_driver->beh->ROW_ID_FIELD_NAME; @@ -1275,8 +1275,8 @@ QString Connection::selectStatement( KexiDB::QuerySchema& querySchema, sql.prepend("SELECT "); TableSchema::List* tables = querySchema.tables(); if ((tables && !tables->isEmpty()) || !subqueries_for_lookup_data.isEmpty()) { - sql += QString::fromLatin1(" FROM "); - QString s_from; + sql += TQString::tqfromLatin1(" FROM "); + TQString s_from; if (tables) { TableSchema *table; number = 0; @@ -1284,38 +1284,38 @@ QString Connection::selectStatement( KexiDB::QuerySchema& querySchema, ++it, number++) { if (!s_from.isEmpty()) - s_from += QString::fromLatin1(", "); + s_from += TQString::tqfromLatin1(", "); s_from += escapeIdentifier(table->name(), options.identifierEscaping); - QString aliasString = QString(querySchema.tableAlias(number)); + TQString aliasString = TQString(querySchema.tableAlias(number)); if (!aliasString.isEmpty()) - s_from += (QString::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 += QString::fromLatin1(", "); + s_from += TQString::tqfromLatin1(", "); s_from += s_from_additional; }*/ } // add subqueries for lookup data uint subqueries_for_lookup_data_counter = 0; - for (QPtrListIterator<QuerySchema> it(subqueries_for_lookup_data); + for (TQPtrListIterator<QuerySchema> it(subqueries_for_lookup_data); subqueries_for_lookup_data.current(); ++it, subqueries_for_lookup_data_counter++) { if (!s_from.isEmpty()) - s_from += QString::fromLatin1(", "); - s_from += QString::fromLatin1("("); + s_from += TQString::tqfromLatin1(", "); + s_from += TQString::tqfromLatin1("("); s_from += selectStatement( *it.current(), params, options ); - s_from += QString::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; } - QString s_where; + TQString s_where; s_where.reserve(4096); //JOINS if (!s_additional_joins.isEmpty()) { - sql += QString::fromLatin1(" ") + s_additional_joins + QString::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 @@ QString Connection::selectStatement( KexiDB::QuerySchema& querySchema, wasWhere = true; } else - s_where += QString::fromLatin1(" AND "); + s_where += TQString::tqfromLatin1(" AND "); Field::Pair *pair; - QString s_where_sub; - for (QPtrListIterator<Field::Pair> p_it(*rel->fieldPairs()); (pair = p_it.current()); ++p_it) { + 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 += QString::fromLatin1(" AND "); + s_where_sub += TQString::tqfromLatin1(" AND "); s_where_sub += ( escapeIdentifier(pair->first->table()->name(), options.identifierEscaping) + - QString::fromLatin1(".") + + TQString::tqfromLatin1(".") + escapeIdentifier(pair->first->name(), options.identifierEscaping) + - QString::fromLatin1(" = ") + + TQString::tqfromLatin1(" = ") + escapeIdentifier(pair->second->table()->name(), options.identifierEscaping) + - QString::fromLatin1(".") + + TQString::tqfromLatin1(".") + escapeIdentifier(pair->second->name(), options.identifierEscaping)); } if (rel->fieldPairs()->count()>1) { s_where_sub.prepend("("); - s_where_sub += QString::fromLatin1(")"); + s_where_sub += TQString::tqfromLatin1(")"); } s_where += s_where_sub; } @@ -1362,20 +1362,20 @@ QString Connection::selectStatement( KexiDB::QuerySchema& querySchema, } } if (!s_where.isEmpty()) - sql += QString::fromLatin1(" WHERE ") + s_where; + sql += TQString::tqfromLatin1(" WHERE ") + s_where; //! \todo (js) add other sql parts //(use wasWhere here) // ORDER BY - QString orderByString( + TQString orderByString( querySchema.orderByColumnList().toSQLString(!singleTable/*includeTableName*/, driver(), options.identifierEscaping) ); - const QValueVector<int> pkeyFieldsOrder( querySchema.pkeyFieldsOrder() ); + const TQValueVector<int> pkeyFieldsOrder( querySchema.pkeyFieldsOrder() ); if (orderByString.isEmpty() && !pkeyFieldsOrder.isEmpty()) { //add automatic ORDER BY if there is no explicity defined (especially helps when there are complex JOINs) OrderByColumnList automaticPKOrderBy; const QueryColumnInfo::Vector fieldsExpanded( querySchema.fieldsExpanded() ); - foreach (QValueVector<int>::ConstIterator, it, pkeyFieldsOrder) { + foreach (TQValueVector<int>::ConstIterator, it, pkeyFieldsOrder) { if ((*it) < 0) // no field mentioned in this query continue; if ((*it) >= (int)fieldsExpanded.count()) { @@ -1396,7 +1396,7 @@ QString Connection::selectStatement( KexiDB::QuerySchema& querySchema, return sql; } -QString Connection::selectStatement( KexiDB::TableSchema& tableSchema, +TQString Connection::selectStatement( KexiDB::TableSchema& tableSchema, const SelectStatementOptions& options) const { return selectStatement( *tableSchema.query(), options ); @@ -1413,10 +1413,10 @@ Field* Connection::findSystemFieldName(KexiDB::FieldList* fieldlist) return 0; } -Q_ULLONG Connection::lastInsertedAutoIncValue(const QString& aiFieldName, const QString& tableName, - Q_ULLONG* ROWID) +TQ_ULLONG Connection::lastInsertedAutoIncValue(const TQString& aiFieldName, const TQString& tableName, + TQ_ULLONG* ROWID) { - Q_ULLONG row_id = drv_lastInsertRowID(); + TQ_ULLONG row_id = drv_lastInsertRowID(); if (ROWID) *ROWID = row_id; if (m_driver->beh->ROW_ID_FIELD_RETURNS_LAST_AUTOINCREMENTED_VALUE) { @@ -1424,17 +1424,17 @@ Q_ULLONG Connection::lastInsertedAutoIncValue(const QString& aiFieldName, const } RowData rdata; if (row_id<=0 || true!=querySingleRecord( - QString::fromLatin1("SELECT ") + tableName + QString::fromLatin1(".") + aiFieldName + QString::fromLatin1(" FROM ") + tableName - + QString::fromLatin1(" WHERE ") + m_driver->beh->ROW_ID_FIELD_NAME + QString::fromLatin1("=") + QString::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 (Q_ULLONG)-1; //ULL; + return (TQ_ULLONG)-1; //ULL; } return rdata[0].toULongLong(); } -Q_ULLONG Connection::lastInsertedAutoIncValue(const QString& aiFieldName, - const KexiDB::TableSchema& table, Q_ULLONG* ROWID) +TQ_ULLONG Connection::lastInsertedAutoIncValue(const TQString& aiFieldName, + const KexiDB::TableSchema& table, TQ_ULLONG* ROWID) { return lastInsertedAutoIncValue(aiFieldName,table.name(), ROWID); } @@ -1460,24 +1460,24 @@ static FieldList* createFieldListForKexi__Fields(TableSchema *kexi__fieldsSchema } //! builds a list of values for field's \a f properties. Used by createTable(). -void buildValuesForKexi__Fields(QValueList<QVariant>& vals, Field* f) +void buildValuesForKexi__Fields(TQValueList<TQVariant>& vals, Field* f) { vals.clear(); vals - << QVariant(f->table()->id()) - << QVariant(f->type()) - << QVariant(f->name()) - << QVariant(f->isFPNumericType() ? f->scale() : f->length()) - << QVariant(f->isFPNumericType() ? f->precision() : 0) - << QVariant(f->constraints()) - << QVariant(f->options()) - // KexiDB::variantToString() is needed here because the value can be of any QVariant type, + << TQVariant(f->table()->id()) + << TQVariant(f->type()) + << TQVariant(f->name()) + << TQVariant(f->isFPNumericType() ? f->scale() : f->length()) + << TQVariant(f->isFPNumericType() ? f->precision() : 0) + << TQVariant(f->constraints()) + << TQVariant(f->options()) + // KexiDB::variantToString() is needed here because the value can be of any TQVariant type, // depending on f->type() << (f->defaultValue().isNull() - ? QVariant() : QVariant(KexiDB::variantToString( f->defaultValue() ))) - << QVariant(f->order()) - << QVariant(f->caption()) - << QVariant(f->description()); + ? TQVariant() : TQVariant(KexiDB::variantToString( f->defaultValue() ))) + << TQVariant(f->order()) + << TQVariant(f->caption()) + << TQVariant(f->description()); } bool Connection::storeMainFieldSchema(Field *field) @@ -1488,21 +1488,21 @@ bool Connection::storeMainFieldSchema(Field *field) if (!fl) return false; - QValueList<QVariant> vals; + TQValueList<TQVariant> vals; buildValuesForKexi__Fields(vals, field); - QValueList<QVariant>::ConstIterator valsIt = vals.constBegin(); + TQValueList<TQVariant>::ConstIterator valsIt = vals.constBegin(); Field *f; bool first = true; - QString sql = "UPDATE kexi__fields SET "; + TQString sql = "UPDATE kexi__fields SET "; for (Field::ListIterator it( fl->fieldsIterator() ); (f = it.current()); ++it, ++valsIt) { - sql.append( (first ? QString::null : QString(", ")) + + sql.append( (first ? TQString() : TQString(", ")) + f->name() + "=" + m_driver->valueToSQL( f, *valsIt ) ); if (first) first = false; } delete fl; - sql.append(QString(" WHERE t_id=") + QString::number( field->table()->id() ) + sql.append(TQString(" WHERE t_id=") + TQString::number( field->table()->id() ) + " AND f_name=" + m_driver->valueToSQL( Field::Text, field->name() ) ); return executeSQL( sql ); } @@ -1535,13 +1535,13 @@ bool Connection::createTable( KexiDB::TableSchema* tableSchema, bool replaceExis } const bool internalTable = dynamic_cast<InternalTableSchema*>(tableSchema); - const QString &tableName = tableSchema->name().lower(); + const TQString &tableName = tableSchema->name().lower(); if (!internalTable) { 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; } } @@ -1617,7 +1617,7 @@ bool Connection::createTable( KexiDB::TableSchema* tableSchema, bool replaceExis // int order = 0; Field *f; for (Field::ListIterator it( *tableSchema->fields() ); (f = it.current()); ++it/*, order++*/) { - QValueList<QVariant> vals; + TQValueList<TQVariant> vals; buildValuesForKexi__Fields(vals, f); if (!insertRecord(*fl, vals )) createTable_ERR; @@ -1676,7 +1676,7 @@ bool Connection::removeObject( uint objId ) return true; } -bool Connection::drv_dropTable( const QString& name ) +bool Connection::drv_dropTable( const TQString& name ) { m_sql = "DROP TABLE " + escapeIdentifier(name); return executeSQL(m_sql); @@ -1701,13 +1701,13 @@ tristate Connection::dropTable( KexiDB::TableSchema* tableSchema, bool alsoRemov if (!tableSchema) return false; - QString errmsg(i18n("Table \"%1\" cannot be removed.\n")); + TQString errmsg(i18n("Table \"%1\" cannot be removed.\n")); //be sure that we handle the correct TableSchema object: if (tableSchema->id() < 0 || 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; } @@ -1751,13 +1751,13 @@ tristate Connection::dropTable( KexiDB::TableSchema* tableSchema, bool alsoRemov return commitAutoCommitTransaction(tg.transaction()); } -tristate Connection::dropTable( const QString& table ) +tristate Connection::dropTable( const TQString& table ) { clearError(); 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 @@ -1784,27 +1784,27 @@ tristate Connection::alterTable( TableSchema& tableSchema, TableSchema& newTable empty = true; #endif if (empty) { - ok = createTable(&newTableSchema, true/*replace*/); + ok = createTable(&newTableSchema, true/*tqreplace*/); } return ok; } -bool Connection::alterTableName(TableSchema& tableSchema, const QString& newName, bool replace) +bool Connection::alterTableName(TableSchema& tableSchema, const TQString& newName, bool tqreplace) { 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 QString oldTableName = tableSchema.name(); - const QString newTableName = newName.lower().stripWhiteSpace(); + 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! @@ -1813,10 +1813,10 @@ bool Connection::alterTableName(TableSchema& tableSchema, const QString& newName TableSchema *tableToReplace = this->tableSchema( newName ); const bool destTableExists = tableToReplace != 0; const int origID = destTableExists ? tableToReplace->id() : -1; //will be reused in the new table - if (!replace && destTableExists) { + if (!tqreplace && 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; } @@ -1830,7 +1830,7 @@ bool Connection::alterTableName(TableSchema& tableSchema, const QString& newName // drop the table replaced (with schema) if (destTableExists) { - if (!replace) { + if (!tqreplace) { return false; } if (!dropTable( newName )) { @@ -1838,13 +1838,13 @@ bool Connection::alterTableName(TableSchema& tableSchema, const QString& newName } // the new table owns the previous table's id: - if (!executeSQL(QString::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(QString::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 QString& newName // Update kexi__objects //TODO - if (!executeSQL(QString::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; @@ -1884,13 +1884,13 @@ bool Connection::alterTableName(TableSchema& tableSchema, const QString& newName return true; } -bool Connection::drv_alterTableName(TableSchema& tableSchema, const QString& newName) +bool Connection::drv_alterTableName(TableSchema& tableSchema, const TQString& newName) { - const QString oldTableName = tableSchema.name(); + const TQString oldTableName = tableSchema.name(); tableSchema.setName(newName); - if (!executeSQL(QString::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; @@ -1932,13 +1932,13 @@ bool Connection::dropQuery( KexiDB::QuerySchema* querySchema ) return commitAutoCommitTransaction(tg.transaction()); } -bool Connection::dropQuery( const QString& query ) +bool Connection::dropQuery( const TQString& query ) { clearError(); 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); @@ -1951,7 +1951,7 @@ bool Connection::drv_createTable( const KexiDB::TableSchema& tableSchema ) return executeSQL(m_sql); } -bool Connection::drv_createTable( const QString& tableSchemaName ) +bool Connection::drv_createTable( const TQString& tableSchemaName ) { TableSchema *ts = d->tables_byname[tableSchemaName]; if (!ts) @@ -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()) \ @@ -2157,7 +2157,7 @@ void Connection::setDefaultTransaction(const Transaction& trans) d->default_trans = trans; } -const QValueList<Transaction>& Connection::transactions() +const TQValueList<Transaction>& Connection::transactions() { return d->transactions; } @@ -2179,7 +2179,7 @@ bool Connection::setAutoCommit(bool on) TransactionData* Connection::drv_beginTransaction() { - QString old_sql = m_sql; //don't + TQString old_sql = m_sql; //don't if (!executeSQL( "BEGIN" )) return 0; return new TransactionData(this); @@ -2200,7 +2200,7 @@ bool Connection::drv_setAutoCommit(bool /*on*/) return true; } -Cursor* Connection::executeQuery( const QString& statement, uint cursor_options ) +Cursor* Connection::executeQuery( const TQString& statement, uint cursor_options ) { if (statement.isEmpty()) return 0; @@ -2215,7 +2215,7 @@ Cursor* Connection::executeQuery( const QString& statement, uint cursor_options return c; } -Cursor* Connection::executeQuery( QuerySchema& query, const QValueList<QVariant>& params, +Cursor* Connection::executeQuery( QuerySchema& query, const TQValueList<TQVariant>& params, uint cursor_options ) { Cursor *c = prepareQuery( query, params, cursor_options ); @@ -2231,7 +2231,7 @@ Cursor* Connection::executeQuery( QuerySchema& query, const QValueList<QVariant> Cursor* Connection::executeQuery( QuerySchema& query, uint cursor_options ) { - return executeQuery(query, QValueList<QVariant>(), cursor_options); + return executeQuery(query, TQValueList<TQVariant>(), cursor_options); } Cursor* Connection::executeQuery( TableSchema& table, uint cursor_options ) @@ -2244,7 +2244,7 @@ Cursor* Connection::prepareQuery( TableSchema& table, uint cursor_options ) return prepareQuery( *table.query(), cursor_options ); } -Cursor* Connection::prepareQuery( QuerySchema& query, const QValueList<QVariant>& params, +Cursor* Connection::prepareQuery( QuerySchema& query, const TQValueList<TQVariant>& params, uint cursor_options ) { Cursor* cursor = prepareQuery(query, cursor_options); @@ -2270,7 +2270,7 @@ bool Connection::setupObjectSchemaData( const RowData &data, SchemaData &sdata ) { //not found: retrieve schema /* KexiDB::Cursor *cursor; - if (!(cursor = executeQuery( QString("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,19 +2300,19 @@ bool Connection::setupObjectSchemaData( const RowData &data, SchemaData &sdata ) tristate Connection::loadObjectSchemaData( int objectID, SchemaData &sdata ) { RowData data; - if (true!=querySingleRecord(QString::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 ); } -tristate Connection::loadObjectSchemaData( int objectType, const QString& objectName, SchemaData &sdata ) +tristate Connection::loadObjectSchemaData( int objectType, const TQString& objectName, SchemaData &sdata ) { RowData data; - if (true!=querySingleRecord(QString::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(QString::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 @@ -2340,8 +2340,8 @@ bool Connection::storeObjectSchemaData( SchemaData &sdata, bool newObject ) if (sdata.id()<=0) {//get new ID fl = ts->subList("o_type", "o_name", "o_caption", "o_desc"); ok = fl!=0; - if (ok && !insertRecord(*fl, QVariant(sdata.type()), QVariant(sdata.name()), - QVariant(sdata.caption()), QVariant(sdata.description()) )) + if (ok && !insertRecord(*fl, TQVariant(sdata.type()), TQVariant(sdata.name()), + TQVariant(sdata.caption()), TQVariant(sdata.description()) )) ok = false; delete fl; if (!ok) @@ -2357,21 +2357,21 @@ bool Connection::storeObjectSchemaData( SchemaData &sdata, bool newObject ) } else { fl = ts->subList("o_id", "o_type", "o_name", "o_caption", "o_desc"); ok = fl!=0; - if (ok && !insertRecord(*fl, QVariant(sdata.id()), QVariant(sdata.type()), QVariant(sdata.name()), - QVariant(sdata.caption()), QVariant(sdata.description()) )) + if (ok && !insertRecord(*fl, TQVariant(sdata.id()), TQVariant(sdata.type()), TQVariant(sdata.name()), + TQVariant(sdata.caption()), TQVariant(sdata.description()) )) ok = false; delete fl; return ok; } } //existing object: - return executeSQL(QString("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())) ); + return executeSQL(TQString("UPDATE kexi__objects SET o_type=%2, o_caption=%3, o_desc=%4 WHERE o_id=%1") + .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 QString* sql, QuerySchema* query, +tristate Connection::querySingleRecordInternal(RowData &data, const TQString* sql, QuerySchema* query, bool addLimitTo1) { Q_ASSERT(sql || query); @@ -2394,7 +2394,7 @@ tristate Connection::querySingleRecordInternal(RowData &data, const QString* sql return deleteCursor(cursor); } -tristate Connection::querySingleRecord(const QString& sql, RowData &data, bool addLimitTo1) +tristate Connection::querySingleRecord(const TQString& sql, RowData &data, bool addLimitTo1) { return querySingleRecordInternal(data, &sql, 0, addLimitTo1); } @@ -2407,13 +2407,13 @@ 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; } -tristate Connection::querySingleString(const QString& sql, QString &value, uint column, bool addLimitTo1) +tristate Connection::querySingleString(const TQString& sql, TQString &value, uint column, bool addLimitTo1) { KexiDB::Cursor *cursor; m_sql = addLimitTo1 ? (sql + " LIMIT 1") : sql; // is this safe?; @@ -2435,9 +2435,9 @@ tristate Connection::querySingleString(const QString& sql, QString &value, uint return deleteCursor(cursor); } -tristate Connection::querySingleNumber(const QString& sql, int &number, uint column, bool addLimitTo1) +tristate Connection::querySingleNumber(const TQString& sql, int &number, uint column, bool addLimitTo1) { - static QString str; + static TQString str; static bool ok; const tristate result = querySingleString(sql, str, column, addLimitTo1); if (result!=true) @@ -2446,7 +2446,7 @@ tristate Connection::querySingleNumber(const QString& sql, int &number, uint col return ok; } -bool Connection::queryStringList(const QString& sql, QStringList& list, uint column) +bool Connection::queryStringList(const TQString& sql, TQStringList& list, uint column) { KexiDB::Cursor *cursor; clearError(); @@ -2477,14 +2477,14 @@ bool Connection::queryStringList(const QString& sql, QStringList& list, uint col return deleteCursor(cursor); } -bool Connection::resultExists(const QString& sql, bool &success, bool addLimitTo1) +bool Connection::resultExists(const TQString& sql, bool &success, bool addLimitTo1) { KexiDB::Cursor *cursor; //optimization - if (m_driver->beh->SELECT_1_SUBQUERY_SUPPORTED) { + if (m_driver->beh->SELECT_1_SUBTQUERY_SUPPORTED) { //this is at least for sqlite if (addLimitTo1 && sql.left(6).upper() == "SELECT") - m_sql = QString("SELECT 1 FROM (") + sql + ") LIMIT 1"; // is this safe?; + m_sql = TQString("SELECT 1 FROM (") + sql + ") LIMIT 1"; // is this safe?; else m_sql = sql; } @@ -2517,7 +2517,7 @@ bool Connection::isEmpty( TableSchema& table, bool &success ) //! Used by addFieldPropertyToExtendedTableSchemaData() static void createExtendedTableSchemaMainElementIfNeeded( - QDomDocument& doc, QDomElement& extendedTableSchemaMainEl, + TQDomDocument& doc, TQDomElement& extendedTableSchemaMainEl, bool& extendedTableSchemaStringIsEmpty) { if (!extendedTableSchemaStringIsEmpty) @@ -2525,13 +2525,13 @@ static void createExtendedTableSchemaMainElementIfNeeded( //init document extendedTableSchemaMainEl = doc.createElement("EXTENDED_TABLE_SCHEMA"); doc.appendChild( extendedTableSchemaMainEl ); - extendedTableSchemaMainEl.setAttribute("version", QString::number(KEXIDB_EXTENDED_TABLE_SCHEMA_VERSION)); + extendedTableSchemaMainEl.setAttribute("version", TQString::number(KEXIDB_EXTENDED_TABLE_SCHEMA_VERSION)); extendedTableSchemaStringIsEmpty = false; } //! Used by addFieldPropertyToExtendedTableSchemaData() -static void createExtendedTableSchemaFieldElementIfNeeded(QDomDocument& doc, - QDomElement& extendedTableSchemaMainEl, const QString& fieldName, QDomElement& extendedTableSchemaFieldEl, +static void createExtendedTableSchemaFieldElementIfNeeded(TQDomDocument& doc, + TQDomElement& extendedTableSchemaMainEl, const TQString& fieldName, TQDomElement& extendedTableSchemaFieldEl, bool append = true) { if (!extendedTableSchemaFieldEl.isNull()) @@ -2549,9 +2549,9 @@ static void createExtendedTableSchemaFieldElementIfNeeded(QDomDocument& doc, If extendedTableSchemaFieldEl is null, creates <field> element (with optional "custom" attribute is \a custom is false). */ static void addFieldPropertyToExtendedTableSchemaData( - Field *f, const char* propertyName, const QVariant& propertyValue, - QDomDocument& doc, QDomElement& extendedTableSchemaMainEl, - QDomElement& extendedTableSchemaFieldEl, + Field *f, const char* propertyName, const TQVariant& propertyValue, + TQDomDocument& doc, TQDomElement& extendedTableSchemaMainEl, + TQDomElement& extendedTableSchemaFieldEl, bool& extendedTableSchemaStringIsEmpty, bool custom = false ) { @@ -2561,31 +2561,31 @@ static void addFieldPropertyToExtendedTableSchemaData( doc, extendedTableSchemaMainEl, f->name(), extendedTableSchemaFieldEl); //create <property> - QDomElement extendedTableSchemaFieldPropertyEl = doc.createElement("property"); + TQDomElement extendedTableSchemaFieldPropertyEl = doc.createElement("property"); extendedTableSchemaFieldEl.appendChild( extendedTableSchemaFieldPropertyEl ); if (custom) extendedTableSchemaFieldPropertyEl.setAttribute("custom", "true"); extendedTableSchemaFieldPropertyEl.setAttribute("name", propertyName); - QDomElement extendedTableSchemaFieldPropertyValueEl; + TQDomElement extendedTableSchemaFieldPropertyValueEl; switch (propertyValue.type()) { - case QVariant::String: + case TQVariant::String: extendedTableSchemaFieldPropertyValueEl = doc.createElement("string"); break; - case QVariant::CString: + case TQVariant::CString: extendedTableSchemaFieldPropertyValueEl = doc.createElement("cstring"); break; - case QVariant::Int: - case QVariant::Double: - case QVariant::UInt: - case QVariant::LongLong: - case QVariant::ULongLong: + case TQVariant::Int: + case TQVariant::Double: + case TQVariant::UInt: + case TQVariant::LongLong: + case TQVariant::ULongLong: extendedTableSchemaFieldPropertyValueEl = doc.createElement("number"); break; - case QVariant::Bool: + case TQVariant::Bool: extendedTableSchemaFieldPropertyValueEl = doc.createElement("bool"); break; default: -//! @todo add more QVariant types +//! @todo add more TQVariant types KexiDBFatal << "addFieldPropertyToExtendedTableSchemaData(): impl. error" << endl; } extendedTableSchemaFieldPropertyEl.appendChild( extendedTableSchemaFieldPropertyValueEl ); @@ -2596,14 +2596,14 @@ static void addFieldPropertyToExtendedTableSchemaData( bool Connection::storeExtendedTableSchemaData(TableSchema& tableSchema) { //! @todo future: save in older versions if neeed - QDomDocument doc("EXTENDED_TABLE_SCHEMA"); - QDomElement extendedTableSchemaMainEl; + TQDomDocument doc("EXTENDED_TABLE_SCHEMA"); + TQDomElement extendedTableSchemaMainEl; bool extendedTableSchemaStringIsEmpty = true; //for each field: Field *f; for (Field::ListIterator it( *tableSchema.fields() ); (f = it.current()); ++it) { - QDomElement extendedTableSchemaFieldEl; + TQDomElement extendedTableSchemaFieldEl; if (f->visibleDecimalPlaces()>=0/*nondefault*/ && KexiDB::supportsVisibleDecimalPlacesProperty(f->type())) { addFieldPropertyToExtendedTableSchemaData( f, "visibleDecimalPlaces", f->visibleDecimalPlaces(), doc, @@ -2639,14 +2639,14 @@ bool Connection::storeExtendedTableSchemaData(TableSchema& tableSchema) // Store extended schema information (see ExtendedTableSchemaInformation in Kexi Wiki) if (extendedTableSchemaStringIsEmpty) { #ifdef KEXI_DEBUG_GUI - KexiUtils::addAlterTableActionDebug(QString("** Extended table schema REMOVED.")); + KexiUtils::addAlterTableActionDebug(TQString("** Extended table schema REMOVED.")); #endif if (!removeDataBlock( tableSchema.id(), "extended_schema")) return false; } else { #ifdef KEXI_DEBUG_GUI - KexiUtils::addAlterTableActionDebug(QString("** Extended table schema set to:\n")+doc.toString(4)); + KexiUtils::addAlterTableActionDebug(TQString("** Extended table schema set to:\n")+doc.toString(4)); #endif if (!storeDataBlock( tableSchema.id(), doc.toString(1), "extended_schema" )) return false; @@ -2668,7 +2668,7 @@ bool Connection::loadExtendedTableSchemaData(TableSchema& tableSchema) return false; } // Load extended schema information, if present (see ExtendedTableSchemaInformation in Kexi Wiki) - QString extendedTableSchemaString; + TQString extendedTableSchemaString; tristate res = loadDataBlock( tableSchema.id(), extendedTableSchemaString, "extended_schema" ); if (!res) loadExtendedTableSchemaData_ERR; @@ -2690,37 +2690,37 @@ bool Connection::loadExtendedTableSchemaData(TableSchema& tableSchema) if (extendedTableSchemaString.isEmpty()) return true; - QDomDocument doc; - QString errorMsg; + TQDomDocument doc; + TQString errorMsg; 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) if (doc.doctype().name()!="EXTENDED_TABLE_SCHEMA") loadExtendedTableSchemaData_ERR3( extendedTableSchemaString ); - QDomElement docEl = doc.documentElement(); + TQDomElement docEl = doc.documentElement(); if (docEl.tagName()!="EXTENDED_TABLE_SCHEMA") loadExtendedTableSchemaData_ERR3( extendedTableSchemaString ); - for (QDomNode n = docEl.firstChild(); !n.isNull(); n = n.nextSibling()) { - QDomElement fieldEl = n.toElement(); + for (TQDomNode n = docEl.firstChild(); !n.isNull(); n = n.nextSibling()) { + TQDomElement fieldEl = n.toElement(); if (fieldEl.tagName()=="field") { Field *f = tableSchema.field( fieldEl.attribute("name") ); if (f) { //set properties of the field: //! @todo more properties - for (QDomNode propNode = fieldEl.firstChild(); + for (TQDomNode propNode = fieldEl.firstChild(); !propNode.isNull(); propNode = propNode.nextSibling()) { - QDomElement propEl = propNode.toElement(); + TQDomElement propEl = propNode.toElement(); bool ok; int intValue; if (propEl.tagName()=="property") { - QCString propertyName = propEl.attribute("name").latin1(); + TQCString propertyName = propEl.attribute("name").latin1(); if (propEl.attribute("custom")=="true") { //custom property f->setCustomProperty(propertyName, @@ -2762,7 +2762,7 @@ KexiDB::Field* Connection::setupField( const RowData &data ) if (!ok) return 0; Field::Type f_type = (Field::Type)f_int_type; - int f_len = QMAX( 0, data.at(3).toInt(&ok) ); + int f_len = TQMAX( 0, data.at(3).toInt(&ok) ); if (!ok) return 0; int f_prec = data.at(4).toInt(&ok); @@ -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( - QString::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; @@ -2859,17 +2859,17 @@ KexiDB::TableSchema* Connection::setupTableSchema( const RowData &data ) return t; } -TableSchema* Connection::tableSchema( const QString& tableName ) +TableSchema* Connection::tableSchema( const TQString& tableName ) { - QString m_tableName = tableName.lower(); + TQString m_tableName = tableName.lower(); TableSchema *t = d->tables_byname[m_tableName]; if (t) return t; //not found: retrieve schema RowData data; - if (true!=querySingleRecord(QString::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,30 +2882,30 @@ TableSchema* Connection::tableSchema( int tableId ) return t; //not found: retrieve schema RowData data; - if (true!=querySingleRecord(QString::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); } -tristate Connection::loadDataBlock( int objectID, QString &dataString, const QString& dataID ) +tristate Connection::loadDataBlock( int objectID, TQString &dataString, const TQString& dataID ) { if (objectID<=0) return false; return querySingleString( - QString("SELECT o_data FROM kexi__objectdata WHERE o_id=") + QString::number(objectID) + TQString("SELECT o_data FROM kexi__objectdata WHERE o_id=") + TQString::number(objectID) + " AND " + KexiDB::sqlWhere(m_driver, KexiDB::Field::Text, "o_sub_id", dataID), dataString ); } -bool Connection::storeDataBlock( int objectID, const QString &dataString, const QString& dataID ) +bool Connection::storeDataBlock( int objectID, const TQString &dataString, const TQString& dataID ) { if (objectID<=0) return false; - QString sql(QString::fromLatin1("SELECT kexi__objectdata.o_id FROM kexi__objectdata WHERE o_id=%1").arg(objectID)); - QString sql_sub( KexiDB::sqlWhere(m_driver, KexiDB::Field::Text, "o_sub_id", dataID) ); + 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; exists = resultExists(sql + " and " + sql_sub, ok); @@ -2914,20 +2914,20 @@ bool Connection::storeDataBlock( int objectID, const QString &dataString, const if (exists) { return executeSQL( "UPDATE kexi__objectdata SET o_data=" + m_driver->valueToSQL( KexiDB::Field::LongText, dataString ) - + " WHERE o_id=" + QString::number(objectID) + " AND " + sql_sub ); + + " WHERE o_id=" + TQString::number(objectID) + " AND " + sql_sub ); } return executeSQL( - QString::fromLatin1("INSERT INTO kexi__objectdata (o_id, o_data, o_sub_id) VALUES (") - + QString::number(objectID) +"," + m_driver->valueToSQL( KexiDB::Field::LongText, dataString ) + 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 ) + ")" ); } -bool Connection::removeDataBlock( int objectID, const QString& dataID) +bool Connection::removeDataBlock( int objectID, const TQString& dataID) { if (objectID<=0) return false; if (dataID.isEmpty()) - return KexiDB::deleteRow(*this, "kexi__objectdata", "o_id", QString::number(objectID)); + return KexiDB::deleteRow(*this, "kexi__objectdata", "o_id", TQString::number(objectID)); else return KexiDB::deleteRow(*this, "kexi__objectdata", "o_id", KexiDB::Field::Integer, objectID, "o_sub_id", KexiDB::Field::Text, dataID); @@ -2939,11 +2939,11 @@ KexiDB::QuerySchema* Connection::setupQuerySchema( const RowData &data ) const int objID = data[0].toInt(&ok); if (!ok) return false; - QString sqlText; + TQString sqlText; 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 )) { @@ -2966,17 +2966,17 @@ KexiDB::QuerySchema* Connection::setupQuerySchema( const RowData &data ) return query; } -QuerySchema* Connection::querySchema( const QString& queryName ) +QuerySchema* Connection::querySchema( const TQString& queryName ) { - QString m_queryName = queryName.lower(); + TQString m_queryName = queryName.lower(); QuerySchema *q = d->queries_byname[m_queryName]; if (q) return q; //not found: retrieve schema RowData data; - if (true!=querySingleRecord(QString::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,14 +2990,14 @@ QuerySchema* Connection::querySchema( int queryId ) //not found: retrieve schema clearError(); RowData data; - if (true!=querySingleRecord(QString::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); } -bool Connection::setQuerySchemaObsolete( const QString& queryName ) +bool Connection::setQuerySchemaObsolete( const TQString& queryName ) { QuerySchema* oldQuery = querySchema( queryName ); if (!oldQuery) @@ -3008,14 +3008,14 @@ bool Connection::setQuerySchemaObsolete( const QString& queryName ) return true; } -TableSchema* Connection::newKexiDBSystemTableSchema(const QString& tsname) +TableSchema* Connection::newKexiDBSystemTableSchema(const TQString& tsname) { TableSchema *ts = new TableSchema(tsname.lower()); insertInternalTableSchema( ts ); return ts; } -bool Connection::isInternalTableSchema(const QString& tableName) +bool Connection::isInternalTableSchema(const TQString& tableName) { return (d->kexiDBSystemTables[ d->tables_byname[tableName] ]) // these are here for compatiblility because we're no longer instantiate @@ -3119,7 +3119,7 @@ void Connection::removeMe(TableSchema *ts) } } -QString Connection::anyAvailableDatabaseName() +TQString Connection::anyAvailableDatabaseName() { if (!d->availableDatabaseName.isEmpty()) { return d->availableDatabaseName; @@ -3127,19 +3127,19 @@ QString Connection::anyAvailableDatabaseName() return m_driver->beh->ALWAYS_AVAILABLE_DATABASE_NAME; } -void Connection::setAvailableDatabaseName(const QString& dbName) +void Connection::setAvailableDatabaseName(const TQString& dbName) { d->availableDatabaseName = dbName; } //! @internal used in updateRow(), insertRow(), inline void updateRowDataWithNewValues(QuerySchema &query, RowData& data, KexiDB::RowEditBuffer::DBMap& b, - QMap<QueryColumnInfo*,int>& columnsOrderExpanded) + TQMap<QueryColumnInfo*,int>& columnsOrderExpanded) { columnsOrderExpanded = query.columnsOrder(QuerySchema::ExpandedList); - QMap<QueryColumnInfo*,int>::ConstIterator columnsOrderExpandedIt; + TQMap<QueryColumnInfo*,int>::ConstIterator columnsOrderExpandedIt; for (KexiDB::RowEditBuffer::DBMap::ConstIterator it=b.constBegin();it!=b.constEnd();++it) { - columnsOrderExpandedIt = columnsOrderExpanded.find( it.key() ); + columnsOrderExpandedIt = columnsOrderExpanded.tqfind( it.key() ); if (columnsOrderExpandedIt == columnsOrderExpanded.constEnd()) { KexiDBWarn << "(Connection) updateRowDataWithNewValues(): \"now also assign new value in memory\" step " "- could not find item '" << it.key()->aliasOrName() << "'" << endl; @@ -3178,7 +3178,7 @@ bool Connection::updateRow(QuerySchema &query, RowData& data, RowEditBuffer& buf } //update the record: m_sql = "UPDATE " + escapeIdentifier(mt->name()) + " SET "; - QString sqlset, sqlwhere; + TQString sqlset, sqlwhere; sqlset.reserve(1024); sqlwhere.reserve(1024); KexiDB::RowEditBuffer::DBMap b = buf.dbBuffer(); @@ -3191,7 +3191,7 @@ bool Connection::updateRow(QuerySchema &query, RowData& data, RowEditBuffer& buf m_driver->valueToSQL(it.key()->field,it.data())); } if (pkey) { - const QValueVector<int> pkeyFieldsOrder( query.pkeyFieldsOrder() ); + const TQValueVector<int> pkeyFieldsOrder( query.pkeyFieldsOrder() ); KexiDBDbg << pkey->fieldCount() << " ? " << query.pkeyFieldsCount() << endl; if (pkey->fieldCount() != query.pkeyFieldsCount()) { //sanity check KexiDBWarn << " -- NO ENTIRE MASTER TABLE's PKEY SPECIFIED!" << endl; @@ -3204,10 +3204,10 @@ bool Connection::updateRow(QuerySchema &query, RowData& data, RowEditBuffer& buf for (Field::ListIterator it = pkey->fieldsIterator(); it.current(); i++, ++it) { if (!sqlwhere.isEmpty()) sqlwhere+=" AND "; - QVariant val = data[ pkeyFieldsOrder[i] ]; + 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; } @@ -3228,7 +3228,7 @@ bool Connection::updateRow(QuerySchema &query, RowData& data, RowEditBuffer& buf return false; } //success: now also assign new values in memory: - QMap<QueryColumnInfo*,int> columnsOrderExpanded; + TQMap<QueryColumnInfo*,int> columnsOrderExpanded; updateRowDataWithNewValues(query, data, b, columnsOrderExpanded); return true; } @@ -3254,7 +3254,7 @@ bool Connection::insertRow(QuerySchema &query, RowData& data, RowEditBuffer& buf if (!getROWID && !pkey) KexiDBWarn << " -- WARNING: NO MASTER TABLE's PKEY" << endl; - QString sqlcols, sqlvals; + TQString sqlcols, sqlvals; sqlcols.reserve(1024); sqlvals.reserve(1024); @@ -3268,7 +3268,7 @@ bool Connection::insertRow(QuerySchema &query, RowData& data, RowEditBuffer& buf QueryColumnInfo *ci = fieldsExpanded.at(i); if (ci->field && KexiDB::isDefaultValueAllowed(ci->field) && !ci->field->defaultValue().isNull() - && !b.contains( ci )) + && !b.tqcontains( ci )) { KexiDBDbg << "Connection::insertRow(): adding default value '" << ci->field->defaultValue().toString() << "' for column '" << ci->field->name() << "'" << endl; @@ -3279,19 +3279,19 @@ bool Connection::insertRow(QuerySchema &query, RowData& data, RowEditBuffer& buf if (b.isEmpty()) { // empty row inserting requested: if (!getROWID && !pkey) { - KexiDBWarn << "MASTER TABLE's PKEY REQUIRED FOR INSERTING EMPTY ROWS: INSERT CANCELLED" << endl; + KexiDBWarn << "MASTER TABLE's PKEY RETQUIRED FOR INSERTING EMPTY ROWS: INSERT CANCELLED" << endl; setError(ERR_INSERT_NO_MASTER_TABLES_PKEY, i18n("Could not insert row because master table has no primary key defined.")); return false; } if (pkey) { - const QValueVector<int> pkeyFieldsOrder( query.pkeyFieldsOrder() ); + const TQValueVector<int> pkeyFieldsOrder( query.pkeyFieldsOrder() ); // KexiDBDbg << pkey->fieldCount() << " ? " << query.pkeyFieldsCount() << endl; if (pkey->fieldCount() != query.pkeyFieldsCount()) { //sanity check 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; } } @@ -3308,7 +3308,7 @@ bool Connection::insertRow(QuerySchema &query, RowData& data, RowEditBuffer& buf } } sqlcols += escapeIdentifier(anyField->name()); - sqlvals += m_driver->valueToSQL(anyField,QVariant()/*NULL*/); + sqlvals += m_driver->valueToSQL(anyField,TQVariant()/*NULL*/); } else { // non-empty row inserting requested: @@ -3333,31 +3333,31 @@ bool Connection::insertRow(QuerySchema &query, RowData& data, RowEditBuffer& buf return false; } //success: now also assign a new value in memory: - QMap<QueryColumnInfo*,int> columnsOrderExpanded; + TQMap<QueryColumnInfo*,int> columnsOrderExpanded; updateRowDataWithNewValues(query, data, b, columnsOrderExpanded); //fetch autoincremented values QueryColumnInfo::List *aif_list = query.autoIncrementFields(); - Q_ULLONG ROWID = 0; + TQ_ULLONG ROWID = 0; if (pkey && !aif_list->isEmpty()) { //! @todo now only if PKEY is present, this should also work when there's no PKEY QueryColumnInfo *id_columnInfo = aif_list->first(); //! @todo safe to cast it? - Q_ULLONG last_id = lastInsertedAutoIncValue( + TQ_ULLONG last_id = lastInsertedAutoIncValue( id_columnInfo->field->name(), id_columnInfo->field->table()->name(), &ROWID); - if (last_id==(Q_ULLONG)-1 || last_id<=0) { + if (last_id==(TQ_ULLONG)-1 || last_id<=0) { //! @todo show error //! @todo remove just inserted row. How? Using ROLLBACK? return false; } RowData aif_data; - QString getAutoIncForInsertedValue = QString::fromLatin1("SELECT ") + TQString getAutoIncForInsertedValue = TQString::tqfromLatin1("SELECT ") + query.autoIncrementSQLFieldsList(m_driver) - + QString::fromLatin1(" FROM ") + + TQString::tqfromLatin1(" FROM ") + escapeIdentifier(id_columnInfo->field->table()->name()) - + QString::fromLatin1(" WHERE ") + + TQString::tqfromLatin1(" WHERE ") + escapeIdentifier(id_columnInfo->field->name()) + "=" - + QString::number(last_id); + + TQString::number(last_id); if (true!=querySingleRecord(getAutoIncForInsertedValue, aif_data)) { //! @todo show error return false; @@ -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; @@ -3410,11 +3410,11 @@ bool Connection::deleteRow(QuerySchema &query, RowData& data, bool useROWID) //update the record: m_sql = "DELETE FROM " + escapeIdentifier(mt->name()) + " WHERE "; - QString sqlwhere; + TQString sqlwhere; sqlwhere.reserve(1024); if (pkey) { - const QValueVector<int> pkeyFieldsOrder( query.pkeyFieldsOrder() ); + const TQValueVector<int> pkeyFieldsOrder( query.pkeyFieldsOrder() ); KexiDBDbg << pkey->fieldCount() << " ? " << query.pkeyFieldsCount() << endl; if (pkey->fieldCount() != query.pkeyFieldsCount()) { //sanity check KexiDBWarn << " -- NO ENTIRE MASTER TABLE's PKEY SPECIFIED!" << endl; @@ -3426,10 +3426,10 @@ bool Connection::deleteRow(QuerySchema &query, RowData& data, bool useROWID) for (Field::ListIterator it = pkey->fieldsIterator(); it.current(); i++, ++it) { if (!sqlwhere.isEmpty()) sqlwhere+=" AND "; - QVariant val = data[ pkeyFieldsOrder[i] ]; + 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; } @@ -3477,20 +3477,20 @@ bool Connection::deleteAllRows(QuerySchema &query) void Connection::registerForTableSchemaChanges(TableSchemaChangeListenerInterface& listener, TableSchema &schema) { - QPtrList<TableSchemaChangeListenerInterface>* listeners = d->tableSchemaChangeListeners[&schema]; + TQPtrList<TableSchemaChangeListenerInterface>* listeners = d->tableSchemaChangeListeners[&schema]; if (!listeners) { - listeners = new QPtrList<TableSchemaChangeListenerInterface>(); + listeners = new TQPtrList<TableSchemaChangeListenerInterface>(); d->tableSchemaChangeListeners.insert(&schema, listeners); } //TODO: inefficient - if (listeners->findRef( &listener )==-1) + if (listeners->tqfindRef( &listener )==-1) listeners->append( &listener ); } void Connection::unregisterForTableSchemaChanges(TableSchemaChangeListenerInterface& listener, TableSchema &schema) { - QPtrList<TableSchemaChangeListenerInterface>* listeners = d->tableSchemaChangeListeners[&schema]; + TQPtrList<TableSchemaChangeListenerInterface>* listeners = d->tableSchemaChangeListeners[&schema]; if (!listeners) return; //TODO: inefficient @@ -3499,15 +3499,15 @@ void Connection::unregisterForTableSchemaChanges(TableSchemaChangeListenerInterf void Connection::unregisterForTablesSchemaChanges(TableSchemaChangeListenerInterface& listener) { - for (QPtrDictIterator< QPtrList<TableSchemaChangeListenerInterface> > it(d->tableSchemaChangeListeners); + for (TQPtrDictIterator< TQPtrList<TableSchemaChangeListenerInterface> > it(d->tableSchemaChangeListeners); it.current(); ++it) { - if (-1!=it.current()->find(&listener)) + if (-1!=it.current()->tqfind(&listener)) it.current()->take(); } } -QPtrList<Connection::TableSchemaChangeListenerInterface>* +TQPtrList<Connection::TableSchemaChangeListenerInterface>* Connection::tableSchemaChangeListeners(TableSchema& tableSchema) const { KexiDBDbg << d->tableSchemaChangeListeners.count() << endl; @@ -3516,13 +3516,13 @@ Connection::tableSchemaChangeListeners(TableSchema& tableSchema) const tristate Connection::closeAllTableSchemaChangeListeners(TableSchema& tableSchema) { - QPtrList<Connection::TableSchemaChangeListenerInterface> *listeners = d->tableSchemaChangeListeners[&tableSchema]; + TQPtrList<Connection::TableSchemaChangeListenerInterface> *listeners = d->tableSchemaChangeListeners[&tableSchema]; if (!listeners) return true; - QPtrListIterator<KexiDB::Connection::TableSchemaChangeListenerInterface> tmpListeners(*listeners); //safer copy + TQPtrListIterator<KexiDB::Connection::TableSchemaChangeListenerInterface> tmpListeners(*listeners); //safer copy tristate res = true; //try to close every window - for (QPtrListIterator<KexiDB::Connection::TableSchemaChangeListenerInterface> it(tmpListeners); + for (TQPtrListIterator<KexiDB::Connection::TableSchemaChangeListenerInterface> it(tmpListeners); it.current() && res==true; ++it) { res = it.current()->closeListener(); diff --git a/kexi/kexidb/connection.h b/kexi/kexidb/connection.h index b72e01d4..79bd3840 100644 --- a/kexi/kexidb/connection.h +++ b/kexi/kexidb/connection.h @@ -20,15 +20,15 @@ #ifndef KEXIDB_CONNECTION_H #define KEXIDB_CONNECTION_H -#include <qobject.h> -#include <qstringlist.h> -#include <qintdict.h> -#include <qdict.h> -#include <qptrdict.h> -#include <qvaluevector.h> -#include <qvaluelist.h> -#include <qvariant.h> -#include <qguardedptr.h> +#include <tqobject.h> +#include <tqstringlist.h> +#include <tqintdict.h> +#include <tqdict.h> +#include <tqptrdict.h> +#include <tqvaluevector.h> +#include <tqvaluelist.h> +#include <tqvariant.h> +#include <tqguardedptr.h> #include <kexidb/object.h> #include <kexidb/connectiondata.h> @@ -44,7 +44,7 @@ namespace KexiDB { //! structure for storing single record with type information -typedef QValueVector<QVariant> RowData; +typedef TQValueVector<TQVariant> RowData; class Cursor; class ConnectionPrivate; @@ -58,9 +58,10 @@ class AlterTableHandler; It supports data queries and modification by creating client-side database cursors. Database transactions are supported. */ -class KEXI_DB_EXPORT Connection : public QObject, public KexiDB::Object +class KEXI_DB_EXPORT Connection : public TQObject, public KexiDB::Object { Q_OBJECT + TQ_OBJECT public: @@ -107,14 +108,14 @@ class KEXI_DB_EXPORT Connection : public QObject, public KexiDB::Object /*! \return list of database names for opened connection. If \a also_system_db is true, the system database names are also returned. */ - QStringList databaseNames(bool also_system_db = false); + TQStringList databaseNames(bool also_system_db = false); /*! \return true if database \a dbName exists. If \a ignoreErrors is true, error flag of connection won't be modified for any errors (it will quietly return), else (ignoreErrors == false) we can check why the database does not exist using error(), errorNum() and/or errorMsg(). */ - bool databaseExists( const QString &dbName, bool ignoreErrors = true ); + bool databaseExists( const TQString &dbName, bool ignoreErrors = true ); /*! \brief Creates new database with name \a dbName, using this connection. @@ -127,7 +128,7 @@ class KEXI_DB_EXPORT Connection : public QObject, public KexiDB::Object for database schema documentation (detailed description of kexi__* 'system' tables). \sa useDatabase() */ - bool createDatabase( const QString &dbName ); + bool createDatabase( const TQString &dbName ); /*! \brief Opens an existing database specified by \a dbName. @@ -139,7 +140,7 @@ class KEXI_DB_EXPORT Connection : public QObject, public KexiDB::Object (the same as specified for ConnectionData). \return true on success, false on failure. If user has cancelled this action and \a cancelled is not 0, *cancelled is set to true. */ - bool useDatabase( const QString &dbName, bool kexiCompatible = true, bool *cancelled = 0, + bool useDatabase( const TQString &dbName, bool kexiCompatible = true, bool *cancelled = 0, MessageHandler* msgHandler = 0 ); /*! @@ -153,27 +154,27 @@ class KEXI_DB_EXPORT Connection : public QObject, public KexiDB::Object \return name of currently used database for this connection or empty string if there is no used database */ - QString currentDatabase() const; + TQString currentDatabase() const; /*! \brief Drops database with name \a dbName. if dbName is not specified, currently used database name is used (it is closed before dropping). */ - bool dropDatabase( const QString &dbName = QString::null ); + bool dropDatabase( const TQString &dbName = TQString() ); /*! \return names of all the \a objecttype (see \a ObjectTypes in global.h) schemas stored in currently used database. KexiDB::AnyObjectType can be passed as \a objType to get names of objects of any type. If \a ok is not null then variable pointed by it will be set to the result. On error, the functions can return incomplete list. */ - QStringList objectNames(int objType = KexiDB::AnyObjectType, bool* ok = 0); + TQStringList objectNames(int objType = KexiDB::AnyObjectType, bool* ok = 0); /*! \return names of all table schemas stored in currently used database. If \a also_system_tables is true, internal KexiDB system table names (kexi__*) are also returned. \sa kexiDBSystemTableNames() */ - QStringList tableNames(bool also_system_tables = false); + TQStringList tableNames(bool also_system_tables = false); /*! \return list of internal KexiDB system table names (kexi__*). This does not mean that these tables can be found @@ -184,7 +185,7 @@ class KEXI_DB_EXPORT Connection : public QObject, public KexiDB::Object opened database can contain fewer 'system' tables than in current KexiDB implementation, if the current one is newer than the one used to build the database. */ - static const QStringList& kexiDBSystemTableNames(); + static const TQStringList& kexiDBSystemTableNames(); /*! \return server version information for this connection. If database is not connected (i.e. isConnected() is false) 0 is returned. */ @@ -206,16 +207,16 @@ class KEXI_DB_EXPORT Connection : public QObject, public KexiDB::Object If \a also_system_tables is true, Internal KexiDB system tables (kexi__*) are not available here because these have no identifiers assigned (more formally: id=-1). */ - QValueList<int> tableIds(); + TQValueList<int> tableIds(); /*! \return ids of all database query schemas stored in currently used database. These ids can be later used as argument for querySchema(). This is a shortcut for objectIds(TableObjectType). */ - QValueList<int> queryIds(); + TQValueList<int> queryIds(); /*! \return names of all schemas of object with \a objType type that are stored in currently used database. */ - QValueList<int> objectIds(int objType); + TQValueList<int> objectIds(int objType); /*! \brief Creates new transaction handle and starts a new transaction. \return KexiDB::Transaction object if transaction has been started @@ -231,7 +232,7 @@ class KEXI_DB_EXPORT Connection : public QObject, public KexiDB::Object Transaction beginTransaction(); /*! \todo for nested transactions: - Tansaction* beginTransaction(transaction *parent_transaction); + Tansaction* beginTransaction(transaction *tqparent_transaction); */ /*! Commits transaction \a trans. If there is not \a trans argument passed, and there is default transaction @@ -283,7 +284,7 @@ class KEXI_DB_EXPORT Connection : public QObject, public KexiDB::Object Use Transaction::active() to check that. Inactive transaction handle is useless and can be safely dropped. */ - const QValueList<Transaction>& transactions(); + const TQValueList<Transaction>& transactions(); /*! \return true if "auto commit" option is on. @@ -320,8 +321,8 @@ class KEXI_DB_EXPORT Connection : public QObject, public KexiDB::Object bool setAutoCommit(bool on); /*! driver-specific string escaping */ -//js: MOVED TO Driver virtual QString escapeString(const QString& str) const = 0; -// virtual QCString escapeString(const QCString& str) const = 0; +//js: MOVED TO Driver virtual TQString escapeString(const TQString& str) const = 0; +// virtual TQCString escapeString(const TQCString& str) const = 0; /*! Prepares SELECT query described by raw \a statement. \return opened cursor created for results of this query @@ -334,9 +335,9 @@ class KEXI_DB_EXPORT Connection : public QObject, public KexiDB::Object resources and return Cursor subclass' object (passing \a statement and \a cursor_options to it's constructor). */ - virtual Cursor* prepareQuery( const QString& statement, uint cursor_options = 0) = 0; + virtual Cursor* prepareQuery( const TQString& statement, uint cursor_options = 0) = 0; - /*! \overload prepareQuery( const QString& statement = QString::null, uint cursor_options = 0) + /*! \overload prepareQuery( const TQString& statement = TQString(), uint cursor_options = 0) Prepares query described by \a query schema. \a params are values of parameters that will be inserted into places marked with [] before execution of the query. @@ -345,16 +346,16 @@ class KEXI_DB_EXPORT Connection : public QObject, public KexiDB::Object (passing \a query and \a cursor_options to it's constructor). Kexi SQL and driver-specific escaping is performed on table names. */ - Cursor* prepareQuery( QuerySchema& query, const QValueList<QVariant>& params, + Cursor* prepareQuery( QuerySchema& query, const TQValueList<TQVariant>& params, uint cursor_options = 0 ); - /*! \overload prepareQuery( QuerySchema& query, const QValueList<QVariant>& params, + /*! \overload prepareQuery( QuerySchema& query, const TQValueList<TQVariant>& params, uint cursor_options = 0 ) Prepares query described by \a query schema without parameters. */ virtual Cursor* prepareQuery( QuerySchema& query, uint cursor_options = 0 ) = 0; - /*! \overload prepareQuery( const QString& statement = QString::null, uint cursor_options = 0) + /*! \overload prepareQuery( const TQString& statement = TQString(), uint cursor_options = 0) Statement is build from data provided by \a table schema, it is like "select * from table_name".*/ Cursor* prepareQuery( TableSchema& table, uint cursor_options = 0); @@ -367,22 +368,22 @@ class KEXI_DB_EXPORT Connection : public QObject, public KexiDB::Object Identifiers in \a statement that are the same as keywords in Kexi SQL or the backend's SQL need to have been escaped. */ - Cursor* executeQuery( const QString& statement, uint cursor_options = 0 ); + Cursor* executeQuery( const TQString& statement, uint cursor_options = 0 ); - /*! \overload executeQuery( const QString& statement, uint cursor_options = 0 ) + /*! \overload executeQuery( const TQString& statement, uint cursor_options = 0 ) \a params are values of parameters that will be inserted into places marked with [] before execution of the query. Statement is build from data provided by \a query schema. Kexi SQL and driver-specific escaping is performed on table names. */ - Cursor* executeQuery( QuerySchema& query, const QValueList<QVariant>& params, + Cursor* executeQuery( QuerySchema& query, const TQValueList<TQVariant>& params, uint cursor_options = 0 ); - /*! \overload executeQuery( QuerySchema& query, const QValueList<QVariant>& params, + /*! \overload executeQuery( QuerySchema& query, const TQValueList<TQVariant>& params, uint cursor_options = 0 ) */ Cursor* executeQuery( QuerySchema& query, uint cursor_options = 0 ); - /*! \overload executeQuery( const QString& statement, uint cursor_options = 0 ) + /*! \overload executeQuery( const TQString& statement, uint cursor_options = 0 ) Executes query described by \a query schema without parameters. Statement is build from data provided by \a table schema, it is like "select * from table_name".*/ @@ -403,7 +404,7 @@ class KEXI_DB_EXPORT Connection : public QObject, public KexiDB::Object /*! \return schema of a table pointed by \a tableName, retrieved from currently used database. KexiDB system table schema can be also retrieved. \sa tableSchema( int tableId ) */ - TableSchema* tableSchema( const QString& tableName ); + TableSchema* tableSchema( const TQString& tableName ); /*! \return schema of a query pointed by \a queryId, retrieved from currently used database. The schema is cached inside connection, @@ -412,10 +413,10 @@ class KEXI_DB_EXPORT Connection : public QObject, public KexiDB::Object /*! \return schema of a query pointed by \a queryName, retrieved from currently used database. \sa querySchema( int queryId ) */ - QuerySchema* querySchema( const QString& queryName ); + QuerySchema* querySchema( const TQString& queryName ); /*! Sets \a queryName query obsolete by moving it out of the query sets, so it will not be - accessible by querySchema( const QString& queryName ). The existing query object is not + accessible by querySchema( const TQString& queryName ). The existing query object is not destroyed, to avoid problems when it's referenced. In this case, a new query schema will be retrieved directly from the backend. @@ -423,10 +424,10 @@ class KEXI_DB_EXPORT Connection : public QObject, public KexiDB::Object This solves the problem when user has changed a query schema but already form still uses previously instantiated query schema. \return true if there is such query. Otherwise the method does nothing. */ - bool setQuerySchemaObsolete( const QString& queryName ); + bool setQuerySchemaObsolete( const TQString& queryName ); -//js: MOVED TO Driver QString valueToSQL( const Field::Type ftype, const QVariant& v ) const; -// QString valueToSQL( const Field *field, const QVariant& v ) const; +//js: MOVED TO Driver TQString valueToSQL( const Field::Type ftype, const TQVariant& v ) const; +// TQString valueToSQL( const Field *field, const TQVariant& v ) const; /*! Executes \a sql query and stores first record's data inside \a data. This is convenient method when we need only first record from query result, @@ -435,9 +436,9 @@ class KEXI_DB_EXPORT Connection : public QObject, public KexiDB::Object so \a sql should not include one already. \return true if query was successfully executed and first record has been found, false on data retrieving failure, and cancelled if there's no single record available. */ - tristate querySingleRecord(const QString& sql, RowData &data, bool addLimitTo1 = true); + tristate querySingleRecord(const TQString& sql, RowData &data, bool addLimitTo1 = true); - /*! Like tristate querySingleRecord(const QString& sql, RowData &data) + /*! Like tristate querySingleRecord(const TQString& sql, RowData &data) but uses QuerySchema object. If \a addLimitTo1 is true (the default), adds a LIMIT clause to the query. */ tristate querySingleRecord(QuerySchema& query, RowData &data, bool addLimitTo1 = true); @@ -450,7 +451,7 @@ class KEXI_DB_EXPORT Connection : public QObject, public KexiDB::Object \return true if query was successfully executed and first record has been found, false on data retrieving failure, and cancelled if there's no single record available. \sa queryStringList() */ - tristate querySingleString(const QString& sql, QString &value, uint column = 0, + tristate querySingleString(const TQString& sql, TQString &value, uint column = 0, bool addLimitTo1 = true); /*! Convenience function: executes \a sql query and stores first @@ -458,7 +459,7 @@ class KEXI_DB_EXPORT Connection : public QObject, public KexiDB::Object Note: "LIMIT 1" is appended to \a sql statement if \a addLimitTo1 is true (the default). \return true if query was successfully executed and first record has been found, false on data retrieving failure, and cancelled if there's no single record available. */ - tristate querySingleNumber(const QString& sql, int &number, uint column = 0, + tristate querySingleNumber(const TQString& sql, int &number, uint column = 0, bool addLimitTo1 = true); /*! Executes \a sql query and stores Nth field's string value of every record @@ -468,7 +469,7 @@ class KEXI_DB_EXPORT Connection : public QObject, public KexiDB::Object \return true if all values were fetched successfuly, false on data retrieving failure. Returning empty list can be still a valid result. On errors, the list is not cleared, it may contain a few retrieved values. */ - bool queryStringList(const QString& sql, QStringList& list, uint column = 0); + bool queryStringList(const TQString& sql, TQStringList& list, uint column = 0); /*! \return true if there is at least one record returned in \a sql query. Does not fetch any records. \a success will be set to false @@ -476,20 +477,20 @@ class KEXI_DB_EXPORT Connection : public QObject, public KexiDB::Object "no results" and "query execution error" states. Note: real executed query is: "SELECT 1 FROM (\a sql) LIMIT 1" if \a addLimitTo1 is true (the default). */ - bool resultExists(const QString& sql, bool &success, bool addLimitTo1 = true); + bool resultExists(const TQString& sql, bool &success, bool addLimitTo1 = true); /*! \return true if there is at least one record in \a table. */ bool isEmpty( TableSchema& table, bool &success ); -//! @todo perhaps use Q_ULLONG here? +//! @todo perhaps use TQ_ULLONG here? /*! \return number of records in \a sql query. Does not fetch any records. -1 is returned on query execution errors (>0 otherwise). Note: real executed query is: "SELECT COUNT() FROM (\a sql) LIMIT 1" (using querySingleNumber()) */ - int resultCount(const QString& sql); + int resultCount(const TQString& sql); //PROTOTYPE: - #define A , const QVariant& + #define A , const TQVariant& #define H_INS_REC(args) bool insertRecord(TableSchema &tableSchema args) #define H_INS_REC_ALL \ H_INS_REC(A); \ @@ -510,9 +511,9 @@ class KEXI_DB_EXPORT Connection : public QObject, public KexiDB::Object #undef H_INS_REC #undef A - bool insertRecord(TableSchema &tableSchema, QValueList<QVariant>& values); + bool insertRecord(TableSchema &tableSchema, TQValueList<TQVariant>& values); - bool insertRecord(FieldList& fields, QValueList<QVariant>& values); + bool insertRecord(FieldList& fields, TQValueList<TQVariant>& values); /*! Creates table defined by \a tableSchema. Schema information is also added into kexi system tables, for later reuse. @@ -531,7 +532,7 @@ class KEXI_DB_EXPORT Connection : public QObject, public KexiDB::Object - \a tableSchema is not inserted into Connection's structures, so you are still owner of this object - existing table schema object is not destroyed (i.e. it is still available - e.g. using Connection::tableSchema(const QString& ), even if the table + e.g. using Connection::tableSchema(const TQString& ), even if the table was physically dropped. */ bool createTable( TableSchema* tableSchema, bool replaceExisting = false ); @@ -547,7 +548,7 @@ class KEXI_DB_EXPORT Connection : public QObject, public KexiDB::Object /*! It is a convenience function, does exactly the same as bool dropTable( KexiDB::TableSchema* tableSchema ) */ - tristate dropTable( const QString& table ); + tristate dropTable( const TQString& table ); /*! Alters \a tableSchema using \a newTableSchema in memory and on the db backend. \return true on success, cancelled if altering was cancelled. */ @@ -565,7 +566,7 @@ class KEXI_DB_EXPORT Connection : public QObject, public KexiDB::Object -- false is returned and ERR_OBJECT_EXISTS error is set. The schema of \a tableSchema is updated on success. \return true on success. */ - bool alterTableName(TableSchema& tableSchema, const QString& newName, bool replace = false); + bool alterTableName(TableSchema& tableSchema, const TQString& newName, bool tqreplace = false); /*! Drops a query defined by \a querySchema. If true is returned, schema information \a querySchema is destoyed @@ -575,7 +576,7 @@ class KEXI_DB_EXPORT Connection : public QObject, public KexiDB::Object /*! It is a convenience function, does exactly the same as bool dropQuery( KexiDB::QuerySchema* querySchema ) */ - bool dropQuery( const QString& query ); + bool dropQuery( const TQString& query ); /*! Removes information about object with \a objId from internal "kexi__object" and "kexi__objectdata" tables. @@ -610,7 +611,7 @@ class KEXI_DB_EXPORT Connection : public QObject, public KexiDB::Object this connection specifics (e.g. you need to check something remotely). */ - virtual QString anyAvailableDatabaseName(); + virtual TQString anyAvailableDatabaseName(); /*! Sets \a dbName as name of a database that can be accessible. This is option that e.g. application that make use of KexiDB library can set @@ -622,7 +623,7 @@ class KEXI_DB_EXPORT Connection : public QObject, public KexiDB::Object \sa anyAvailableDatabaseName() */ - void setAvailableDatabaseName(const QString& dbName); + void setAvailableDatabaseName(const TQString& dbName); /*! Because some engines need to have opened any database before executing administrative sql statements like "create database" or "drop database", @@ -639,7 +640,7 @@ class KEXI_DB_EXPORT Connection : public QObject, public KexiDB::Object Note: This method has nothing to do with creating or using temporary databases in such meaning that these database are not persistent */ - bool useTemporaryDatabaseIfNeeded(QString &tmpdbName); + bool useTemporaryDatabaseIfNeeded(TQString &tmpdbName); /*! \return autoincrement field's \a aiFieldName value of last inserted record. This refers \a tableName table. @@ -647,24 +648,24 @@ class KEXI_DB_EXPORT Connection : public QObject, public KexiDB::Object Simply, method internally fetches last inserted record and returns selected field's value. Requirements: field must be of integer type, there must be a record inserted in current database session (whatever this means). - On error (Q_ULLONG)-1 is returned. + On error (TQ_ULLONG)-1 is returned. Last inserted record is identified by magical row identifier, usually called ROWID (PostgreSQL has it as well as SQLite; see DriverBehaviour::ROW_ID_FIELD_RETURNS_LAST_AUTOINCREMENTED_VALUE). ROWID's value will be assigned back to \a ROWID if this pointer is not null. */ - Q_ULLONG lastInsertedAutoIncValue(const QString& aiFieldName, const QString& tableName, - Q_ULLONG* ROWID = 0); + TQ_ULLONG lastInsertedAutoIncValue(const TQString& aiFieldName, const TQString& tableName, + TQ_ULLONG* ROWID = 0); - /*! \overload int lastInsertedAutoIncValue(const QString&, const QString&, Q_ULLONG*) + /*! \overload int lastInsertedAutoIncValue(const TQString&, const TQString&, TQ_ULLONG*) */ - Q_ULLONG lastInsertedAutoIncValue(const QString& aiFieldName, - const TableSchema& table, Q_ULLONG* ROWID = 0); + TQ_ULLONG lastInsertedAutoIncValue(const TQString& aiFieldName, + const TableSchema& table, TQ_ULLONG* ROWID = 0); /*! Executes query \a statement, but without returning resulting rows (used mostly for functional queries). Only use this method if you really need. */ - bool executeSQL( const QString& statement ); + bool executeSQL( const TQString& statement ); //! @short options used in selectStatement() class KEXI_DB_EXPORT SelectStatementOptions @@ -687,19 +688,19 @@ class KEXI_DB_EXPORT Connection : public QObject, public KexiDB::Object /*! \return "SELECT ..." statement's string needed for executing query defined by \a querySchema and \a params. */ - QString selectStatement( QuerySchema& querySchema, - const QValueList<QVariant>& params, + TQString selectStatement( QuerySchema& querySchema, + const TQValueList<TQVariant>& params, const SelectStatementOptions& options = SelectStatementOptions() ) const; - /*! \overload QString selectStatement( QuerySchema& querySchema, - QValueList<QVariant> params = QValueList<QVariant>(), + /*! \overload TQString selectStatement( QuerySchema& querySchema, + TQValueList<TQVariant> params = TQValueList<TQVariant>(), const SelectStatementOptions& options = SelectStatementOptions() ) const; \return "SELECT ..." statement's string needed for executing query defined by \a querySchema. */ - inline QString selectStatement( QuerySchema& querySchema, + inline TQString selectStatement( QuerySchema& querySchema, const SelectStatementOptions& options = SelectStatementOptions() ) const { - return selectStatement(querySchema, QValueList<QVariant>(), options); + return selectStatement(querySchema, TQValueList<TQVariant>(), options); } /*! Stores object's schema data (id, name, caption, help text) @@ -721,13 +722,13 @@ class KEXI_DB_EXPORT Connection : public QObject, public KexiDB::Object /*! Finds object schema data for object of type \a objectType and name \a objectName. If the object is found, resulted schema is stored in \a sdata and true is returned, otherwise false is returned. */ - tristate loadObjectSchemaData( int objectType, const QString& objectName, SchemaData &sdata ); + tristate loadObjectSchemaData( int objectType, const TQString& objectName, SchemaData &sdata ); /*! Loads (potentially large) data block (e.g. xml form's representation), referenced by objectID and puts it to \a dataString. The can be block indexed with optional \a dataID. \return true on success, false on failure and cancelled when there is no such data block \sa storeDataBlock(). */ - tristate loadDataBlock( int objectID, QString &dataString, const QString& dataID ); + tristate loadDataBlock( int objectID, TQString &dataString, const TQString& dataID ); /*! Stores (potentially large) data block \a dataString (e.g. xml form's representation), referenced by objectID. Block will be stored in "kexi__objectdata" table and @@ -735,14 +736,14 @@ class KEXI_DB_EXPORT Connection : public QObject, public KexiDB::Object If there is already such record in the table, it's simply overwritten. \return true on success \sa loadDataBlock(). */ - bool storeDataBlock( int objectID, const QString &dataString, const QString& dataID = QString::null ); + bool storeDataBlock( int objectID, const TQString &dataString, const TQString& dataID = TQString() ); /*! Removes (potentially large) string data (e.g. xml form's representation), referenced by objectID, and pointed by optional \a dataID. \return true on success. Does not fail if the block does not exist. Note that if \a dataID is not specified, all data blocks for this dialog will be removed. \sa loadDataBlock() storeDataBlock(). */ - bool removeDataBlock( int objectID, const QString& dataID = QString::null); + bool removeDataBlock( int objectID, const TQString& dataID = TQString()); class KEXI_DB_EXPORT TableSchemaChangeListenerInterface { @@ -755,7 +756,7 @@ class KEXI_DB_EXPORT Connection : public QObject, public KexiDB::Object /*! i18n'd string that can be displayed for user to inform about e.g. conflicting listeners. */ - QString listenerInfoString; + TQString listenerInfoString; }; //TMP// TODO: will be more generic /** Register \a listener for receiving (listening) information about changes @@ -768,7 +769,7 @@ class KEXI_DB_EXPORT Connection : public QObject, public KexiDB::Object void unregisterForTablesSchemaChanges(TableSchemaChangeListenerInterface& listener); - QPtrList<Connection::TableSchemaChangeListenerInterface>* + TQPtrList<Connection::TableSchemaChangeListenerInterface>* tableSchemaChangeListeners(TableSchema& tableSchema) const; tristate closeAllTableSchemaChangeListeners(TableSchema& tableSchema); @@ -781,7 +782,7 @@ class KEXI_DB_EXPORT Connection : public QObject, public KexiDB::Object This method is used for example in KexiProject to insert information about "kexi__blobs" table schema. Use createTable() to physically create table. After createTable() calling insertInternalTableSchema() is not required. - Also used internally by newKexiDBSystemTableSchema(const QString& tsname) */ + Also used internally by newKexiDBSystemTableSchema(const TQString& tsname) */ void insertInternalTableSchema(TableSchema *tableSchema); //! @todo move this somewhere to low level class (MIGRATION?) @@ -789,7 +790,7 @@ class KEXI_DB_EXPORT Connection : public QObject, public KexiDB::Object with name \a tableName exists in the database. \return false if it does not exist or error occurred. The lookup is case insensitive. */ - virtual bool drv_containsTable( const QString &tableName ) = 0; + virtual bool drv_containsTable( const TQString &tableName ) = 0; /*! Creates table using \a tableSchema information. \return true on success. Default implementation @@ -813,7 +814,7 @@ class KEXI_DB_EXPORT Connection : public QObject, public KexiDB::Object Moved to public for KexiProject. @todo fix this after refactoring */ - virtual bool drv_alterTableName(TableSchema& tableSchema, const QString& newName); + virtual bool drv_alterTableName(TableSchema& tableSchema, const TQString& newName); /*! Physically drops table named with \a name. Default impelmentation executes "DROP TABLE.." command, @@ -822,13 +823,13 @@ class KEXI_DB_EXPORT Connection : public QObject, public KexiDB::Object Moved to public for KexiMigrate @todo fix this after refatoring */ - virtual bool drv_dropTable( const QString& name ); + virtual bool drv_dropTable( const TQString& name ); /*! Prepare a SQL statement and return a \a PreparedStatement instance. */ virtual PreparedStatement::Ptr prepareStatement(PreparedStatement::StatementType type, FieldList& fields) = 0; - bool isInternalTableSchema(const QString& tableName); + bool isInternalTableSchema(const TQString& tableName); /*! Setups schema data for object that owns sdata (e.g. table, query) using \a cursor opened on 'kexi__objects' table, pointing to a record @@ -874,7 +875,7 @@ class KEXI_DB_EXPORT Connection : public QObject, public KexiDB::Object /*! Executes query \a statement, but without returning resulting rows (used mostly for functional queries). Only use this method if you really need. */ - virtual bool drv_executeSQL( const QString& statement ) = 0; + virtual bool drv_executeSQL( const TQString& statement ) = 0; /*! For reimplemenation: loads list of databases' names available for this connection and adds these names to \a list. If your server is not able to offer such a list, @@ -882,18 +883,18 @@ class KEXI_DB_EXPORT Connection : public QObject, public KexiDB::Object The method should return true only if there was no error on getting database names list from the server. Default implementation puts empty list into \a list and returns true. */ - virtual bool drv_getDatabasesList( QStringList &list ); + virtual bool drv_getDatabasesList( TQStringList &list ); //! @todo move this somewhere to low level class (MIGRATION?) /*! LOW LEVEL METHOD. For reimplemenation: loads low-level list of table names available for this connection. The names are in lower case. The method should return true only if there was no error on getting database names list from the server. */ - virtual bool drv_getTablesList( QStringList &list ) = 0; + virtual bool drv_getTablesList( TQStringList &list ) = 0; /*! For optional reimplemenation: asks server if database \a dbName exists. This method is used internally in databaseExists(). The default implementation - calls databaseNames and checks if that list contains \a dbName. If you need to + calls databaseNames and checks if that list tqcontains \a dbName. If you need to ask the server specifically if a database exists, eg. if you can't retrieve a list of all available database names, please reimplement this method and do all needed checks. @@ -903,14 +904,14 @@ class KEXI_DB_EXPORT Connection : public QObject, public KexiDB::Object Note: This method should also work if there is already database used (with useDatabase()); in this situation no changes should be made in current database selection. */ - virtual bool drv_databaseExists( const QString &dbName, bool ignoreErrors = true ); + virtual bool drv_databaseExists( const TQString &dbName, bool ignoreErrors = true ); /*! For reimplemenation: creates new database using connection */ - virtual bool drv_createDatabase( const QString &dbName = QString::null ) = 0; + virtual bool drv_createDatabase( const TQString &dbName = TQString() ) = 0; /*! For reimplemenation: opens existing database using connection \return true on success, false on failure and cancelled if user has cancelled this action. */ - virtual bool drv_useDatabase( const QString &dbName = QString::null, bool *cancelled = 0, + virtual bool drv_useDatabase( const TQString &dbName = TQString(), bool *cancelled = 0, MessageHandler* msgHandler = 0 ) = 0; /*! For reimplemenation: closes previously opened database @@ -935,7 +936,7 @@ class KEXI_DB_EXPORT Connection : public QObject, public KexiDB::Object /*! For reimplemenation: drops database from the server using connection. After drop, database shouldn't be accessible anymore. */ - virtual bool drv_dropDatabase( const QString &dbName = QString::null ) = 0; + virtual bool drv_dropDatabase( const TQString &dbName = TQString() ) = 0; /*! \return "CREATE TABLE ..." statement string needed for \a tableSchema creation in the database. @@ -943,7 +944,7 @@ class KEXI_DB_EXPORT Connection : public QObject, public KexiDB::Object Note: The statement string can be specific for this connection's driver database, and thus not reusable in general. */ - QString createTableStatement( const TableSchema& tableSchema ) const; + TQString createTableStatement( const TableSchema& tableSchema ) const; /*! \return "SELECT ..." statement's string needed for executing query @@ -953,7 +954,7 @@ class KEXI_DB_EXPORT Connection : public QObject, public KexiDB::Object Note: The statement string can be specific for this connection's driver database, and thus not reusable in general. */ - QString selectStatement( TableSchema& tableSchema, + TQString selectStatement( TableSchema& tableSchema, const SelectStatementOptions& options = SelectStatementOptions() ) const; /*! @@ -963,11 +964,11 @@ class KEXI_DB_EXPORT Connection : public QObject, public KexiDB::Object Used internally, e.g. in createDatabase(). \return true on success */ - virtual bool drv_createTable( const QString& tableSchemaName ); + virtual bool drv_createTable( const TQString& tableSchemaName ); // /*! Executes query \a statement and returns resulting rows // (used mostly for SELECT query). */ -// virtual bool drv_executeQuery( const QString& statement ) = 0; +// virtual bool drv_executeQuery( const TQString& statement ) = 0; /*! \return unique identifier of last inserted row. Typically this is just primary key value. @@ -975,7 +976,7 @@ class KEXI_DB_EXPORT Connection : public QObject, public KexiDB::Object just inserted row. Note for driver developers: contact js (at) iidea.pl if your engine do not offers this information. */ - virtual Q_ULLONG drv_lastInsertRowID() = 0; + virtual TQ_ULLONG drv_lastInsertRowID() = 0; /*! Note for driver developers: begins new transaction and returns handle to it. Default implementation just @@ -1065,7 +1066,7 @@ class KEXI_DB_EXPORT Connection : public QObject, public KexiDB::Object /*! Creates cursor data and initializes cursor using \a statement for later data retrieval. */ -// virtual CursorData* drv_createCursor( const QString& statement ) = 0; +// virtual CursorData* drv_createCursor( const TQString& statement ) = 0; /*! Closes and deletes cursor data. */ // virtual bool drv_deleteCursor( CursorData *data ) = 0; @@ -1106,7 +1107,7 @@ class KEXI_DB_EXPORT Connection : public QObject, public KexiDB::Object Allocates single table KexiDB system object named \a tsname and adds this to list of such objects (for later removal on closeDatabase()). */ - TableSchema* newKexiDBSystemTableSchema(const QString& tsname); + TableSchema* newKexiDBSystemTableSchema(const TQString& tsname); //! Identifier escaping function in the associated Driver. /*! Calls the identifier escaping function in the associated Driver to @@ -1120,7 +1121,7 @@ class KEXI_DB_EXPORT Connection : public QObject, public KexiDB::Object For efficiency, kexi__* system tables and columns therein are not escaped - we assume these are valid identifiers for all drivers. */ - inline QString escapeIdentifier(const QString& id, + inline TQString escapeIdentifier(const TQString& id, int escaping = Driver::EscapeDriver|Driver::EscapeAsNecessary ) const { return m_driver->escapeIdentifier(id, escaping); } @@ -1136,7 +1137,7 @@ class KEXI_DB_EXPORT Connection : public QObject, public KexiDB::Object /*! @internal used by querySingleRecord() methods. Note: "LIMIT 1" is appended to \a sql statement if \a addLimitTo1 is true (the default). */ - tristate querySingleRecordInternal(RowData &data, const QString* sql, + tristate querySingleRecordInternal(RowData &data, const TQString* sql, QuerySchema* query, bool addLimitTo1 = true); /*! @internal used by Driver::createConnection(). @@ -1172,12 +1173,12 @@ class KEXI_DB_EXPORT Connection : public QObject, public KexiDB::Object Note for driver developers: implement this if the driver has to support the altering. */ virtual tristate drv_changeFieldProperty(TableSchema &table, Field& field, - const QString& propertyName, const QVariant& value) { + const TQString& propertyName, const TQVariant& value) { Q_UNUSED(table); Q_UNUSED(field); Q_UNUSED(propertyName); Q_UNUSED(value); return cancelled; } //! cursors created for this connection - QPtrDict<KexiDB::Cursor> m_cursors; + TQPtrDict<KexiDB::Cursor> m_cursors; private: ConnectionPrivate* d; //!< @internal d-pointer class. diff --git a/kexi/kexidb/connectiondata.cpp b/kexi/kexidb/connectiondata.cpp index a74237cc..4f45b0f4 100644 --- a/kexi/kexidb/connectiondata.cpp +++ b/kexi/kexidb/connectiondata.cpp @@ -21,8 +21,8 @@ #include <kexidb/drivermanager.h> -#include <qfileinfo.h> -#include <qdir.h> +#include <tqfileinfo.h> +#include <tqdir.h> #include <klocale.h> @@ -50,7 +50,7 @@ ConnectionDataBase::ConnectionDataBase() /*================================================================*/ ConnectionData::ConnectionData() -: QObject() +: TQObject() , ConnectionDataBase() , formatVersion(0) , priv(new ConnectionData::Private()) @@ -58,7 +58,7 @@ ConnectionData::ConnectionData() } ConnectionData::ConnectionData(const ConnectionData& cd) -: QObject() +: TQObject() , ConnectionDataBase() , priv(0) { @@ -82,33 +82,33 @@ ConnectionData& ConnectionData::operator=(const ConnectionData& cd) return *this; } -void ConnectionData::setFileName( const QString& fn ) +void ConnectionData::setFileName( const TQString& fn ) { - QFileInfo file(fn); + TQFileInfo file(fn); if (!fn.isEmpty() && m_fileName != file.absFilePath()) { - m_fileName = QDir::convertSeparators(file.absFilePath()); - m_dbPath = QDir::convertSeparators(file.dirPath(true)); + m_fileName = TQDir::convertSeparators(file.absFilePath()); + m_dbPath = TQDir::convertSeparators(file.dirPath(true)); m_dbFileName = file.fileName(); } } -QString ConnectionData::serverInfoString(bool addUser) const +TQString ConnectionData::serverInfoString(bool addUser) const { - const QString& i18nFile = i18n("file"); + const TQString& i18nFile = i18n("file"); if (!m_dbFileName.isEmpty()) return i18nFile+": "+(m_dbPath.isEmpty() ? "" : m_dbPath - + QDir::separator()) + m_dbFileName; + + TQDir::separator()) + m_dbFileName; DriverManager man; if (!driverName.isEmpty()) { Driver::Info info = man.driverInfo(driverName); if (!info.name.isEmpty() && info.fileBased) - return QString("<")+i18nFile+">"; + return TQString("<")+i18nFile+">"; } - return ( (userName.isEmpty() || !addUser) ? QString("") : (userName+"@")) - + (hostName.isEmpty() ? QString("localhost") : hostName) - + (port!=0 ? (QString(":")+QString::number(port)) : QString::null); + return ( (userName.isEmpty() || !addUser) ? TQString("") : (userName+"@")) + + (hostName.isEmpty() ? TQString("localhost") : hostName) + + (port!=0 ? (TQString(":")+TQString::number(port)) : TQString()); } diff --git a/kexi/kexidb/connectiondata.h b/kexi/kexidb/connectiondata.h index cd3c1537..fdb69ad5 100644 --- a/kexi/kexidb/connectiondata.h +++ b/kexi/kexidb/connectiondata.h @@ -22,9 +22,9 @@ #include <kexidb/kexidb_export.h> -#include <qobject.h> -#include <qstring.h> -#include <qptrlist.h> +#include <tqobject.h> +#include <tqstring.h> +#include <tqptrlist.h> namespace KexiDB { @@ -33,7 +33,7 @@ namespace KexiDB { ConnectionData class. */ /*! @internal Used by ConnectionData. - It is easier to internally operate on non-QObject-derived object, + It is easier to internally operate on non-TQObject-derived object, e.g.: to copy data members in ConnectionData ctor. */ class ConnectionDataBase { @@ -46,12 +46,12 @@ class ConnectionDataBase Captions are optional for identyfying given connection by name eg. for users. */ - QString caption; + TQString caption; /*! \brief The additional description for the connection */ - QString description; + TQString description; /*! \brief Used for identifying a single piece of data in a set @@ -73,14 +73,14 @@ class ConnectionDataBase driver should be used to perform connection, before we get an appropriate driver object from DriverManager. */ - QString driverName; + TQString driverName; /*! \brief Host name used for the remote connection. Can be empty if the connection is not remote. If it is empty "localhost" is used. */ - QString hostName; + TQString hostName; /*! \brief Port used for the remote connection. @@ -107,15 +107,15 @@ class ConnectionDataBase For local connections only. If empty, it's driver will try to locate existing local socket file. Empty by default. */ - QString localSocketFileName; + TQString localSocketFileName; /*! \brief Password used for the connection. Can be empty string or null. If it is empty (equal to ""), empty password is passed to the driver. - If it is null (QString::null), no password is passed to the driver. + If it is null (TQString()), no password is passed to the driver. In this case, applications using KexiDB should ask for the password. */ - QString password; + TQString password; /*! \brief True if password should be saved to a file for the connection. @@ -130,7 +130,7 @@ class ConnectionDataBase \brief Username used for the connection. Can be empty. */ - QString userName; + TQString userName; protected: /*! @@ -139,31 +139,31 @@ class ConnectionDataBase For file-based database engines like SQLite, \a fileName is used instead hostName and port */ - QString m_fileName; + TQString m_fileName; /*! \brief Absolute path to the database file Will be empty if database is not file-based */ - QString m_dbPath; + TQString m_dbPath; /*! \brief Filename of the database file Will be empty if database is not file-based */ - QString m_dbFileName; + TQString m_dbFileName; }; //! Database specific connection data, e.g. host, port. /*! Connection data, once configured, can be later stored for reuse. */ -class KEXI_DB_EXPORT ConnectionData : public QObject, public ConnectionDataBase +class KEXI_DB_EXPORT ConnectionData : public TQObject, public ConnectionDataBase { public: - typedef QPtrList<ConnectionData> List; - typedef QPtrListIterator<ConnectionData> ListIterator; + typedef TQPtrList<ConnectionData> List; + typedef TQPtrListIterator<ConnectionData> ListIterator; ConnectionData(); @@ -180,7 +180,7 @@ class KEXI_DB_EXPORT ConnectionData : public QObject, public ConnectionDataBase function to set the file name of the database to use. \a fn can be either absolute or relative path to the file. */ - void setFileName( const QString& fn ); + void setFileName( const TQString& fn ); /*! \brief Get the filename used by the connection @@ -189,21 +189,21 @@ class KEXI_DB_EXPORT ConnectionData : public QObject, public ConnectionDataBase instead hostName and port. @return An absolute path to the database file being used */ - QString fileName() const { return m_fileName; } + TQString fileName() const { return m_fileName; } /*! \brief The directory the database file is in \return file path (for file-based engines) but without a file name */ - QString dbPath() const { return m_dbPath; } + TQString dbPath() const { return m_dbPath; } /*! \brief The file name (without path) of the database file \return The file name (for file-based engines) but without a full path */ - QString dbFileName() const { return m_dbFileName; } + TQString dbFileName() const { return m_dbFileName; } /*! \brief A user-friendly string for the server @@ -218,7 +218,7 @@ class KEXI_DB_EXPORT ConnectionData : public QObject, public ConnectionDataBase User's name is added if \a addUser is true (the default). */ - QString serverInfoString(bool addUser = true) const; + TQString serverInfoString(bool addUser = true) const; /*! @internal Format version used when saving the data to a shortcut file. diff --git a/kexi/kexidb/cursor.cpp b/kexi/kexidb/cursor.cpp index 4b9cdea3..dc95e30f 100644 --- a/kexi/kexidb/cursor.cpp +++ b/kexi/kexidb/cursor.cpp @@ -37,27 +37,27 @@ using namespace KexiDB; #endif -Cursor::Cursor(Connection* conn, const QString& statement, uint options) - : QObject() +Cursor::Cursor(Connection* conn, const TQString& statement, uint options) + : TQObject() , m_conn(conn) , m_query(0) , m_rawStatement(statement) , m_options(options) { #ifdef KEXI_DEBUG_GUI - KexiUtils::addKexiDBDebug(QString("Create cursor: ")+statement); + KexiUtils::addKexiDBDebug(TQString("Create cursor: ")+statement); #endif init(); } Cursor::Cursor(Connection* conn, QuerySchema& query, uint options ) - : QObject() + : TQObject() , m_conn(conn) , m_query(&query) , m_options(options) { #ifdef KEXI_DEBUG_GUI - KexiUtils::addKexiDBDebug(QString("Create cursor for query \"%1\": ").arg(query.name())+query.debugString()); + KexiUtils::addKexiDBDebug(TQString("Create cursor for query \"%1\": ").tqarg(query.name())+query.debugString()); #endif init(); } @@ -108,9 +108,9 @@ Cursor::~Cursor() { #ifdef KEXI_DEBUG_GUI if (m_query) - KexiUtils::addKexiDBDebug(QString("~ Delete cursor for query")); + KexiUtils::addKexiDBDebug(TQString("~ Delete cursor for query")); else - KexiUtils::addKexiDBDebug(QString("~ Delete cursor: ")+m_rawStatement); + KexiUtils::addKexiDBDebug(TQString("~ Delete cursor: ")+m_rawStatement); #endif /* if (!m_query) KexiDBDbg << "Cursor::~Cursor() '" << m_rawStatement.latin1() << "'" << endl; @@ -166,7 +166,7 @@ bool Cursor::open() //luci: WHAT_EXACTLY_SHOULD_THAT_BE? // if (!m_readAhead) // jowenn: to ensure before first state, without cluttering implementation code - if (m_conn->driver()->beh->_1ST_ROW_READ_AHEAD_REQUIRED_TO_KNOW_IF_THE_RESULT_IS_EMPTY) { + if (m_conn->driver()->beh->_1ST_ROW_READ_AHEAD_RETQUIRED_TO_KNOW_IF_THE_RESULT_IS_EMPTY) { // KexiDBDbg << "READ AHEAD:" << endl; m_readAhead = getNextRecord(); //true if any record in this query // KexiDBDbg << "READ AHEAD = " << m_readAhead << endl; @@ -346,7 +346,7 @@ bool Cursor::bof() const return m_at==0; } -Q_LLONG Cursor::at() const +TQ_LLONG Cursor::at() const { if (m_readAhead) return 0; @@ -494,9 +494,9 @@ bool Cursor::deleteAllRows() return m_conn->deleteAllRows(*m_query); } -QString Cursor::debugString() const +TQString Cursor::debugString() const { - QString dbg = "CURSOR( "; + TQString dbg = "CURSOR( "; if (!m_query) { dbg += "RAW STATEMENT: '"; dbg += m_rawStatement; @@ -516,7 +516,7 @@ QString Cursor::debugString() const else dbg += " NOT_BUFFERED"; dbg += " AT="; - dbg += QString::number((unsigned long)at()); + dbg += TQString::number((unsigned long)at()); dbg += " )"; return dbg; } @@ -526,7 +526,7 @@ void Cursor::debug() const KexiDBDbg << debugString() << endl; } -void Cursor::setOrderByColumnList(const QStringList& columnNames) +void Cursor::setOrderByColumnList(const TQStringList& columnNames) { Q_UNUSED(columnNames); //! @todo implement this: @@ -537,9 +537,9 @@ void Cursor::setOrderByColumnList(const QStringList& columnNames) //TODO } -/*! Convenience method, similar to setOrderBy(const QStringList&). */ -void Cursor::setOrderByColumnList(const QString& column1, const QString& column2, - const QString& column3, const QString& column4, const QString& column5) +/*! Convenience method, similar to setOrderBy(const TQStringList&). */ +void Cursor::setOrderByColumnList(const TQString& column1, const TQString& column2, + const TQString& column3, const TQString& column4, const TQString& column5) { Q_UNUSED(column1); Q_UNUSED(column2); @@ -555,15 +555,15 @@ QueryColumnInfo::Vector Cursor::orderByColumnList() const return m_orderByColumnList ? *m_orderByColumnList: QueryColumnInfo::Vector(); } -QValueList<QVariant> Cursor::queryParameters() const +TQValueList<TQVariant> Cursor::queryParameters() const { - return m_queryParameters ? *m_queryParameters : QValueList<QVariant>(); + return m_queryParameters ? *m_queryParameters : TQValueList<TQVariant>(); } -void Cursor::setQueryParameters(const QValueList<QVariant>& params) +void Cursor::setQueryParameters(const TQValueList<TQVariant>& params) { if (!m_queryParameters) - m_queryParameters = new QValueList<QVariant>(params); + m_queryParameters = new TQValueList<TQVariant>(params); else *m_queryParameters = params; } diff --git a/kexi/kexidb/cursor.h b/kexi/kexidb/cursor.h index 6ea64dd9..b19b0694 100644 --- a/kexi/kexidb/cursor.h +++ b/kexi/kexidb/cursor.h @@ -20,10 +20,10 @@ #ifndef KEXIDB_CURSOR_H #define KEXIDB_CURSOR_H -#include <qstring.h> -#include <qvariant.h> -#include <qptrvector.h> -#include <qvaluevector.h> +#include <tqstring.h> +#include <tqvariant.h> +#include <tqptrvector.h> +#include <tqvaluevector.h> #include <kexidb/connection.h> #include <kexidb/object.h> @@ -63,9 +63,10 @@ class RowEditBuffer; instead. - QuerySchema object is not owned by Cursor object that uses it. */ -class KEXI_DB_EXPORT Cursor: public QObject, public Object +class KEXI_DB_EXPORT Cursor: public TQObject, public Object { Q_OBJECT + TQ_OBJECT public: //! Cursor options that describes its behaviour @@ -92,7 +93,7 @@ class KEXI_DB_EXPORT Cursor: public QObject, public Object // Omit \a statement if cursor is already initialized with statement // at creation time. If \a statement is not empty, existing statement // (if any) is overwritten. */ -// bool open( const QString& statement = QString::null ); +// bool open( const TQString& statement = TQString() ); /*! Closes previously opened cursor. If the cursor is closed, nothing happens. */ @@ -103,14 +104,14 @@ class KEXI_DB_EXPORT Cursor: public QObject, public Object inline QuerySchema *query() const { return m_query; } //! \return query parameters assigned to this cursor - QValueList<QVariant> queryParameters() const; + TQValueList<TQVariant> queryParameters() const; //! Sets query parameters \a params for this cursor. - void setQueryParameters(const QValueList<QVariant>& params); + void setQueryParameters(const TQValueList<TQVariant>& params); /*! \return raw query statement used to define this cursor or null string if raw statement instead (but QuerySchema is defined instead). */ - inline QString rawStatement() const { return m_rawStatement; } + inline TQString rawStatement() const { return m_rawStatement; } /*! \return logically or'd cursor's options, selected from Cursor::Options enum. */ @@ -157,7 +158,7 @@ class KEXI_DB_EXPORT Cursor: public QObject, public Object Value -1 means that cursor does not point to any valid record (this happens eg. after open(), close(), and after moving after last record or before first one. */ - Q_LLONG at() const; + TQ_LLONG at() const; /*! \return number of fields available for this cursor. This never includes ROWID column or other internal coluns (e.g. lookup). */ @@ -174,10 +175,10 @@ class KEXI_DB_EXPORT Cursor: public QObject, public Object /*! \return a value stored in column number \a i (counting from 0). Is has unspecified behaviour if the cursor is not at valid record. Note for driver developers: - If \a i is >= than m_fieldCount, null QVariant value should be returned. + If \a i is >= than m_fieldCount, null TQVariant value should be returned. To return a value typically you can use a pointer to internal structure that contain current row data (buffered or unbuffered). */ - virtual QVariant value(uint i) = 0; + virtual TQVariant value(uint i) = 0; /*! [PROTOTYPE] \return current record data or NULL if there is no current records. */ virtual const char ** rowData() const = 0; @@ -196,15 +197,15 @@ class KEXI_DB_EXPORT Cursor: public QObject, public Object Use this method before calling open(). You can also call reopen() after calling this method to see effects of applying records order. */ - void setOrderByColumnList(const QStringList& columnNames); + void setOrderByColumnList(const TQStringList& columnNames); - /*! Convenience method, similar to setOrderByColumnList(const QStringList&). */ - void setOrderByColumnList(const QString& column1, const QString& column2 = QString::null, - const QString& column3 = QString::null, const QString& column4 = QString::null, - const QString& column5 = QString::null); + /*! Convenience method, similar to setOrderByColumnList(const TQStringList&). */ + void setOrderByColumnList(const TQString& column1, const TQString& column2 = TQString(), + const TQString& column3 = TQString(), const TQString& column4 = TQString(), + const TQString& column5 = TQString()); /*! \return a list of fields contained in ORDER BY section of the query. - @see setOrderBy(const QStringList&) */ + @see setOrderBy(const TQStringList&) */ QueryColumnInfo::Vector orderByColumnList() const; /*! Puts current record's data into \a data (makes a deep copy). @@ -236,17 +237,17 @@ class KEXI_DB_EXPORT Cursor: public QObject, public Object to refer a documentation. SQLite is one of such engines. Note for driver developers: Leave the default implementation (null string is returned ) if your engine has no such capability. */ - virtual QString serverResultName() { return QString::null; } + virtual TQString serverResultName() { return TQString(); } /*! \return (not i18n'd) description text (message) of last operation's error/result. In most cases engines do return such a messages, any user can then use this to refer a documentation. Note for driver developers: Leave the default implementation (null string is returned ) if your engine has no such capability. */ - virtual QString serverErrorMsg() { return QString::null; } + virtual TQString serverErrorMsg() { return TQString(); } /*! \return Debug information. */ - QString debugString() const; + TQString debugString() const; //! Outputs debug information. void debug() const; @@ -256,7 +257,7 @@ class KEXI_DB_EXPORT Cursor: public QObject, public Object typedef enum FetchResult { FetchError=0, FetchOK=1, FetchEnd=2 }; /*! Cursor will operate on \a conn, raw \a statement will be used to execute query. */ - Cursor(Connection* conn, const QString& statement, uint options = NoOptions ); + Cursor(Connection* conn, const TQString& statement, uint options = NoOptions ); /*! Cursor will operate on \a conn, \a query schema will be used to execute query. */ Cursor(Connection* conn, QuerySchema& query, uint options = NoOptions ); @@ -299,7 +300,7 @@ class KEXI_DB_EXPORT Cursor: public QObject, public Object virtual void drv_bufferMovePointerPrev() = 0; /*! Moves pointer (that points to the buffer) to a new place: \a at. */ - virtual void drv_bufferMovePointerTo(Q_LLONG at) = 0; + virtual void drv_bufferMovePointerTo(TQ_LLONG at) = 0; /*DISABLED: ! This is called only once in open(), after successful drv_open(). Reimplement this if you need (or not) to do get the first record after drv_open(), @@ -318,10 +319,10 @@ class KEXI_DB_EXPORT Cursor: public QObject, public Object the same that is returend by serverResult(). */ virtual void drv_clearServerResult() = 0; - QGuardedPtr<Connection> m_conn; + TQGuardedPtr<Connection> m_conn; QuerySchema *m_query; // CursorData *m_data; - QString m_rawStatement; + TQString m_rawStatement; bool m_opened : 1; //js (m_at==0 is enough) bool m_beforeFirst : 1; bool m_atLast : 1; @@ -329,7 +330,7 @@ class KEXI_DB_EXPORT Cursor: public QObject, public Object // bool m_atLast; bool m_validRecord : 1; //!< true if valid record is currently retrieved @ current position bool m_containsROWIDInfo : 1; - Q_LLONG m_at; + TQ_LLONG m_at; uint m_fieldCount; //!< cached field count information uint m_logicalFieldCount; //!< logical field count, i.e. without intrernal values like ROWID or lookup uint m_options; //!< cursor options that describes its behaviour @@ -346,7 +347,7 @@ class KEXI_DB_EXPORT Cursor: public QObject, public Object //! Used by setOrderByColumnList() QueryColumnInfo::Vector* m_orderByColumnList; - QValueList<QVariant>* m_queryParameters; + TQValueList<TQVariant>* m_queryParameters; private: bool m_readAhead : 1; diff --git a/kexi/kexidb/cursor_p.h b/kexi/kexidb/cursor_p.h index c03eba66..1e4bc33e 100644 --- a/kexi/kexidb/cursor_p.h +++ b/kexi/kexidb/cursor_p.h @@ -20,7 +20,7 @@ #ifndef KEXIDB_CURSOR_P_H #define KEXIDB_CURSOR_P_H -#include <qstring.h> +#include <tqstring.h> #include "connection.h" diff --git a/kexi/kexidb/dbobjectnamevalidator.cpp b/kexi/kexidb/dbobjectnamevalidator.cpp index 77ed0e55..b7a2f633 100644 --- a/kexi/kexidb/dbobjectnamevalidator.cpp +++ b/kexi/kexidb/dbobjectnamevalidator.cpp @@ -25,8 +25,8 @@ using namespace KexiDB; using namespace KexiUtils; ObjectNameValidator::ObjectNameValidator( - KexiDB::Driver *drv, QObject * parent, const char * name) -: Validator(parent,name) + KexiDB::Driver *drv, TQObject * tqparent, const char * name) +: Validator(tqparent,name) { m_drv = drv; } @@ -36,8 +36,8 @@ ObjectNameValidator::~ObjectNameValidator() } Validator::Result ObjectNameValidator::internalCheck( - const QString & /*valueName*/, const QVariant& v, - QString &message, QString &details) + const TQString & /*valueName*/, const TQVariant& v, + TQString &message, TQString &details) { if (m_drv.isNull() ? !KexiDB::Driver::isKexiDBSystemObjectName(v.toString()) @@ -45,7 +45,7 @@ Validator::Result ObjectNameValidator::internalCheck( return Validator::Ok; message = i18n("You cannot use name \"%1\" for your object.\n" "It is reserved for internal Kexi objects. Please choose another name.") - .arg(v.toString()); + .tqarg(v.toString()); details = i18n("Names of internal Kexi objects are starting with \"kexi__\"."); return Validator::Error; } diff --git a/kexi/kexidb/dbobjectnamevalidator.h b/kexi/kexidb/dbobjectnamevalidator.h index 9b8ac617..2b9a0645 100644 --- a/kexi/kexidb/dbobjectnamevalidator.h +++ b/kexi/kexidb/dbobjectnamevalidator.h @@ -21,8 +21,8 @@ #define KEXIDBOBJECTNAMEVALIDATOR_H #include <kexiutils/validator.h> -#include <qstring.h> -#include <qguardedptr.h> +#include <tqstring.h> +#include <tqguardedptr.h> namespace KexiDB { @@ -36,13 +36,13 @@ namespace KexiDB { /*! \a drv is a KexiDB driver on which isSystemObjectName() will be called inside check(). If \a drv is 0, KexiDB::Driver::isKexiDBSystemObjectName() static function is called instead. */ - ObjectNameValidator(KexiDB::Driver *drv, QObject * parent = 0, const char * name = 0); + ObjectNameValidator(KexiDB::Driver *drv, TQObject * tqparent = 0, const char * name = 0); virtual ~ObjectNameValidator(); protected: - virtual KexiUtils::Validator::Result internalCheck(const QString &valueName, const QVariant& v, - QString &message, QString &details); - QGuardedPtr<KexiDB::Driver> m_drv; + virtual KexiUtils::Validator::Result internalCheck(const TQString &valueName, const TQVariant& v, + TQString &message, TQString &details); + TQGuardedPtr<KexiDB::Driver> m_drv; }; } diff --git a/kexi/kexidb/dbproperties.cpp b/kexi/kexidb/dbproperties.cpp index c5780542..44b69192 100644 --- a/kexi/kexidb/dbproperties.cpp +++ b/kexi/kexidb/dbproperties.cpp @@ -32,117 +32,117 @@ DatabaseProperties::~DatabaseProperties() { } -bool DatabaseProperties::setValue( const QString& _name, const QVariant& value ) +bool DatabaseProperties::setValue( const TQString& _name, const TQVariant& value ) { - QString name(_name.stripWhiteSpace()); + TQString name(_name.stripWhiteSpace()); bool ok; //we need to know whether update or insert bool exists = m_conn->resultExists( - QString::fromLatin1("SELECT 1 FROM kexi__db WHERE db_property=%1") - .arg(m_conn->driver()->escapeString(name)), ok); + TQString::tqfromLatin1("SELECT 1 FROM kexi__db WHERE db_property=%1") + .tqarg(m_conn->driver()->escapeString(name)), ok); if (!ok) { - setError(m_conn, i18n("Could not set value of database property \"%1\".").arg(name)); + setError(m_conn, i18n("Could not set value of database property \"%1\".").tqarg(name)); return false; } if (exists) { if (!m_conn->executeSQL( - QString::fromLatin1("UPDATE kexi__db SET db_value=%1 WHERE db_property=%2") - .arg(m_conn->driver()->escapeString(value.toString())) - .arg(m_conn->driver()->escapeString(name)))) + TQString::tqfromLatin1("UPDATE kexi__db SET db_value=%1 WHERE db_property=%2") + .tqarg(m_conn->driver()->escapeString(value.toString())) + .tqarg(m_conn->driver()->escapeString(name)))) { - setError(m_conn, i18n("Could not set value of database property \"%1\".").arg(name)); + setError(m_conn, i18n("Could not set value of database property \"%1\".").tqarg(name)); return false; } return true; } if (!m_conn->executeSQL( - QString::fromLatin1("INSERT INTO kexi__db (db_property, db_value) VALUES (%1, %2)") - .arg(m_conn->driver()->escapeString(name)) - .arg(m_conn->driver()->escapeString(value.toString())))) + TQString::tqfromLatin1("INSERT INTO kexi__db (db_property, db_value) VALUES (%1, %2)") + .tqarg(m_conn->driver()->escapeString(name)) + .tqarg(m_conn->driver()->escapeString(value.toString())))) { - setError(m_conn, i18n("Could not set value of database property \"%1\".").arg(name)); + setError(m_conn, i18n("Could not set value of database property \"%1\".").tqarg(name)); return false; } return true; } -bool DatabaseProperties::setCaption( const QString& _name, const QString& caption ) +bool DatabaseProperties::setCaption( const TQString& _name, const TQString& caption ) { - QString name(_name.stripWhiteSpace()); + TQString name(_name.stripWhiteSpace()); //captions have ' ' prefix name.prepend(" "); bool ok; //we need to know whether update or insert bool exists = m_conn->resultExists( - QString::fromLatin1("SELECT 1 FROM kexi__db WHERE db_property=%1") - .arg(m_conn->driver()->escapeString(name)), ok); + TQString::tqfromLatin1("SELECT 1 FROM kexi__db WHERE db_property=%1") + .tqarg(m_conn->driver()->escapeString(name)), ok); if (!ok) { - setError(m_conn, i18n("Could not set caption for database property \"%1\".").arg(name)); + setError(m_conn, i18n("Could not set caption for database property \"%1\".").tqarg(name)); return false; } if (exists) { if (!m_conn->executeSQL( - QString::fromLatin1("UPDATE kexi__db SET db_value=%1 WHERE db_property=%2") - .arg(m_conn->driver()->escapeString(caption)) - .arg(m_conn->driver()->escapeString(name)))) + TQString::tqfromLatin1("UPDATE kexi__db SET db_value=%1 WHERE db_property=%2") + .tqarg(m_conn->driver()->escapeString(caption)) + .tqarg(m_conn->driver()->escapeString(name)))) { - setError(m_conn, i18n("Could not set caption for database property \"%1\".").arg(name)); + setError(m_conn, i18n("Could not set caption for database property \"%1\".").tqarg(name)); return false; } return true; } if (!m_conn->executeSQL( - QString::fromLatin1("INSERT INTO kexi__db (db_property, db_value) VALUES (%1, %2)") - .arg(m_conn->driver()->escapeString(name)) - .arg(m_conn->driver()->escapeString(caption)))) + TQString::tqfromLatin1("INSERT INTO kexi__db (db_property, db_value) VALUES (%1, %2)") + .tqarg(m_conn->driver()->escapeString(name)) + .tqarg(m_conn->driver()->escapeString(caption)))) { - setError(m_conn, i18n("Could not set caption for database property \"%1\".").arg(name)); + setError(m_conn, i18n("Could not set caption for database property \"%1\".").tqarg(name)); return false; } return true; } -QVariant DatabaseProperties::value( const QString& _name ) +TQVariant DatabaseProperties::value( const TQString& _name ) { - QString result; - QString name(_name.stripWhiteSpace()); + TQString result; + TQString name(_name.stripWhiteSpace()); if (true!=m_conn->querySingleString( - QString::fromLatin1("SELECT db_value FROM kexi__db WHERE db_property=") + TQString::tqfromLatin1("SELECT db_value FROM kexi__db WHERE db_property=") + m_conn->driver()->escapeString(name), result)) { - m_conn->setError(ERR_NO_DB_PROPERTY, i18n("Could not read database property \"%1\".").arg(name)); - return QVariant(); + m_conn->setError(ERR_NO_DB_PROPERTY, i18n("Could not read database property \"%1\".").tqarg(name)); + return TQVariant(); } return result; } -QString DatabaseProperties::caption( const QString& _name ) +TQString DatabaseProperties::caption( const TQString& _name ) { - QString result; - QString name(_name.stripWhiteSpace()); + TQString result; + TQString name(_name.stripWhiteSpace()); //captions have ' ' prefix name.prepend(" "); if (true!=m_conn->querySingleString( - QString::fromLatin1("SELECT db_value FROM kexi__db WHERE db_property=") + TQString::tqfromLatin1("SELECT db_value FROM kexi__db WHERE db_property=") + m_conn->driver()->escapeString(name), result)) { - setError(m_conn, i18n("Could not read database property \"%1\".").arg(name)); - return QString::null; + setError(m_conn, i18n("Could not read database property \"%1\".").tqarg(name)); + return TQString(); } return result; } -QStringList DatabaseProperties::names() +TQStringList DatabaseProperties::names() { - QStringList result; + TQStringList result; if (true!=m_conn->queryStringList( - QString::fromLatin1("SELECT db_value FROM kexi__db WHERE db_property NOT LIKE ") - + m_conn->driver()->escapeString(QString::fromLatin1(" %%")), result, 0 /*0-th*/)) { + TQString::tqfromLatin1("SELECT db_value FROM kexi__db WHERE db_property NOT LIKE ") + + m_conn->driver()->escapeString(TQString::tqfromLatin1(" %%")), result, 0 /*0-th*/)) { // ^^ exclude captions setError(m_conn, i18n("Could not read database properties.")); - return QStringList(); + return TQStringList(); } return result; } diff --git a/kexi/kexidb/dbproperties.h b/kexi/kexidb/dbproperties.h index 91aed7e2..d4b193fa 100644 --- a/kexi/kexidb/dbproperties.h +++ b/kexi/kexidb/dbproperties.h @@ -38,28 +38,28 @@ class KEXI_DB_EXPORT DatabaseProperties : public KexiDB::Object If there's no such property defined, it will be added. Existing value will be overwritten. Note that to execute this method, database must be opened in read-write mode. \return true on successful data. Connection */ - bool setValue( const QString& name, const QVariant& value ); + bool setValue( const TQString& name, const TQVariant& value ); /*! Sets \a caption for for property \a name. Usually it shouldn't be translated: trnaslation can be performed before displaying. */ - bool setCaption( const QString& name, const QString& caption ); + bool setCaption( const TQString& name, const TQString& caption ); //! \return property value for \a propeName available for this driver. - //! If there's no such property defined for driver, Null QVariant value is returned. - QVariant value( const QString& name ); + //! If there's no such property defined for driver, Null TQVariant value is returned. + TQVariant value( const TQString& name ); //! \return translated property caption for \a name. //! If there's no such property defined for driver, empty string value is returned. - QString caption( const QString& name ); + TQString caption( const TQString& name ); //! \return a list of available property names. - QStringList names(); + TQStringList names(); protected: DatabaseProperties(Connection *conn); ~DatabaseProperties(); - QGuardedPtr<Connection> m_conn; + TQGuardedPtr<Connection> m_conn; friend class Connection; }; } diff --git a/kexi/kexidb/driver.cpp b/kexi/kexidb/driver.cpp index 6e82c080..d192fe87 100644 --- a/kexi/kexidb/driver.cpp +++ b/kexi/kexidb/driver.cpp @@ -27,7 +27,7 @@ #include "connectiondata.h" #include "admin.h" -#include <qfileinfo.h> +#include <tqfileinfo.h> #include <klocale.h> #include <kdebug.h> @@ -38,7 +38,7 @@ using namespace KexiDB; /*! used when we do not have Driver instance yet, or when we cannot get one */ -QValueVector<QString> dflt_typeNames; +TQValueVector<TQString> dflt_typeNames; //--------------------------------------------- @@ -49,12 +49,12 @@ DriverBehaviour::DriverBehaviour() , AUTO_INCREMENT_FIELD_OPTION("AUTO_INCREMENT") , AUTO_INCREMENT_PK_FIELD_OPTION("AUTO_INCREMENT PRIMARY KEY") , SPECIAL_AUTO_INCREMENT_DEF(false) - , AUTO_INCREMENT_REQUIRES_PK(false) + , AUTO_INCREMENT_RETQUIRES_PK(false) , ROW_ID_FIELD_RETURNS_LAST_AUTOINCREMENTED_VALUE(false) - , QUOTATION_MARKS_FOR_IDENTIFIER('"') - , USING_DATABASE_REQUIRED_TO_CONNECT(true) - , _1ST_ROW_READ_AHEAD_REQUIRED_TO_KNOW_IF_THE_RESULT_IS_EMPTY(false) - , SELECT_1_SUBQUERY_SUPPORTED(false) + , TQUOTATION_MARKS_FOR_IDENTIFIER('"') + , USING_DATABASE_RETQUIRED_TO_CONNECT(true) + , _1ST_ROW_READ_AHEAD_RETQUIRED_TO_KNOW_IF_THE_RESULT_IS_EMPTY(false) + , SELECT_1_SUBTQUERY_SUPPORTED(false) , SQL_KEYWORDS(0) { } @@ -69,8 +69,8 @@ Driver::Info::Info() //--------------------------------------------- -Driver::Driver( QObject *parent, const char *name, const QStringList & ) - : QObject( parent, name ) +Driver::Driver( TQObject *tqparent, const char *name, const TQStringList & ) + : TQObject( tqparent, name ) , Object() , beh( new DriverBehaviour() ) , d( new DriverPrivate() ) @@ -88,7 +88,7 @@ Driver::~Driver() { DriverManagerInternal::self()->aboutDelete( this ); // KexiDBDbg << "Driver::~Driver()" << endl; - QPtrDictIterator<Connection> it( d->connections ); + TQPtrDictIterator<Connection> it( d->connections ); Connection *conn; while ( (conn = it.toFirst()) ) { delete conn; @@ -106,38 +106,38 @@ bool Driver::isValid() { setError(ERR_INCOMPAT_DRIVER_VERSION, i18n("Incompatible database driver's \"%1\" version: found version %2, expected version %3.") - .arg(name()) - .arg(QString("%1.%2").arg(version().major).arg(version().minor)) - .arg(QString("%1.%2").arg(KexiDB::version().major).arg(KexiDB::version().minor))); + .tqarg(name()) + .tqarg(TQString("%1.%2").tqarg(version().major).tqarg(version().minor)) + .tqarg(TQString("%1.%2").tqarg(KexiDB::version().major).tqarg(KexiDB::version().minor))); return false; } - QString inv_impl = i18n("Invalid database driver's \"%1\" implementation:\n").arg(name()); - QString not_init = i18n("Value of \"%1\" is not initialized for the driver."); + TQString inv_impl = i18n("Invalid database driver's \"%1\" implementation:\n").tqarg(name()); + TQString not_init = i18n("Value of \"%1\" is not initialized for the driver."); if (beh->ROW_ID_FIELD_NAME.isEmpty()) { - setError(ERR_INVALID_DRIVER_IMPL, inv_impl + not_init.arg("DriverBehaviour::ROW_ID_FIELD_NAME")); + setError(ERR_INVALID_DRIVER_IMPL, inv_impl + not_init.tqarg("DriverBehaviour::ROW_ID_FIELD_NAME")); return false; } return true; } -const QPtrList<Connection> Driver::connectionsList() const +const TQPtrList<Connection> Driver::connectionsList() const { - QPtrList<Connection> clist; - QPtrDictIterator<Connection> it( d->connections ); + TQPtrList<Connection> clist; + TQPtrDictIterator<Connection> it( d->connections ); for( ; it.current(); ++it ) clist.append( &(*it) ); return clist; } -QString Driver::fileDBDriverMimeType() const +TQString Driver::fileDBDriverMimeType() const { return d->fileDBDriverMimeType; } -QString Driver::defaultFileBasedDriverMimeType() -{ return QString::fromLatin1("application/x-kexiproject-sqlite3"); } +TQString Driver::defaultFileBasedDriverMimeType() +{ return TQString::tqfromLatin1("application/x-kexiproject-sqlite3"); } -QString Driver::defaultFileBasedDriverName() +TQString Driver::defaultFileBasedDriverName() { DriverManager dm; return dm.lookupByMime(Driver::defaultFileBasedDriverMimeType()).lower(); @@ -167,7 +167,7 @@ AdminTools* Driver::drv_createAdminTools() const return new AdminTools(); //empty impl. } -QString Driver::sqlTypeName(int id_t, int /*p*/) const +TQString Driver::sqlTypeName(int id_t, int /*p*/) const { if (id_t > Field::InvalidType && id_t <= Field::LastType) return d->typeNames[(id_t>0 && id_t<=Field::LastType) ? id_t : Field::InvalidType /*sanity*/]; @@ -203,7 +203,7 @@ Connection* Driver::removeConnection( Connection *conn ) return d->connections.take( conn ); } -QString Driver::defaultSQLTypeName(int id_t) +TQString Driver::defaultSQLTypeName(int id_t) { if (id_t>=Field::Null) return "Null"; @@ -227,35 +227,35 @@ QString Driver::defaultSQLTypeName(int id_t) return dflt_typeNames[id_t]; } -bool Driver::isSystemObjectName( const QString& n ) const +bool Driver::isSystemObjectName( const TQString& n ) const { return Driver::isKexiDBSystemObjectName(n); } -bool Driver::isKexiDBSystemObjectName( const QString& n ) +bool Driver::isKexiDBSystemObjectName( const TQString& n ) { if (!n.lower().startsWith("kexi__")) return false; - const QStringList list( Connection::kexiDBSystemTableNames() ); - return list.find(n.lower())!=list.constEnd(); + const TQStringList list( Connection::kexiDBSystemTableNames() ); + return list.tqfind(n.lower())!=list.constEnd(); } -bool Driver::isSystemFieldName( const QString& n ) const +bool Driver::isSystemFieldName( const TQString& n ) const { if (!beh->ROW_ID_FIELD_NAME.isEmpty() && n.lower()==beh->ROW_ID_FIELD_NAME.lower()) return true; return drv_isSystemFieldName(n); } -QString Driver::valueToSQL( uint ftype, const QVariant& v ) const +TQString Driver::valueToSQL( uint ftype, const TQVariant& v ) const { if (v.isNull()) return "NULL"; switch (ftype) { case Field::Text: case Field::LongText: { - QString s = v.toString(); - return escapeString(s); //QString("'")+s.replace( '"', "\\\"" ) + "'"; + TQString s = v.toString(); + return escapeString(s); //TQString("'")+s.tqreplace( '"', "\\\"" ) + "'"; } case Field::Byte: case Field::ShortInteger: @@ -264,26 +264,26 @@ QString Driver::valueToSQL( uint ftype, const QVariant& v ) const return v.toString(); case Field::Float: case Field::Double: { - if (v.type()==QVariant::String) { + if (v.type()==TQVariant::String) { //workaround for values stored as string that should be casted to floating-point - QString s(v.toString()); - return s.replace(',', "."); + TQString s(v.toString()); + return s.tqreplace(',', "."); } return v.toString(); } //TODO: here special encoding method needed case Field::Boolean: - return QString::number(v.toInt()?1:0); //0 or 1 + return TQString::number(v.toInt()?1:0); //0 or 1 case Field::Time: - return QString("\'")+v.toTime().toString(Qt::ISODate)+"\'"; + return TQString("\'")+v.toTime().toString(Qt::ISODate)+"\'"; case Field::Date: - return QString("\'")+v.toDate().toString(Qt::ISODate)+"\'"; + return TQString("\'")+v.toDate().toString(Qt::ISODate)+"\'"; case Field::DateTime: return dateTimeToSQL( v.toDateTime() ); case Field::BLOB: { if (v.toByteArray().isEmpty()) - return QString::fromLatin1("NULL"); - if (v.type()==QVariant::String) + return TQString::tqfromLatin1("NULL"); + if (v.type()==TQVariant::String) return escapeBLOB(v.toString().utf8()); return escapeBLOB(v.toByteArray()); } @@ -291,35 +291,35 @@ QString Driver::valueToSQL( uint ftype, const QVariant& v ) const return "!INVALIDTYPE!"; default: KexiDBDbg << "Driver::valueToSQL(): UNKNOWN!" << endl; - return QString::null; + return TQString(); } - return QString::null; + return TQString(); } -QVariant Driver::propertyValue( const QCString& propName ) const +TQVariant Driver::propertyValue( const TQCString& propName ) const { return d->properties[propName.lower()]; } -QString Driver::propertyCaption( const QCString& propName ) const +TQString Driver::propertyCaption( const TQCString& propName ) const { return d->propertyCaptions[propName.lower()]; } -QValueList<QCString> Driver::propertyNames() const +TQValueList<TQCString> Driver::propertyNames() const { - QValueList<QCString> names = d->properties.keys(); + TQValueList<TQCString> names = d->properties.keys(); qHeapSort(names); return names; } -QString Driver::escapeIdentifier(const QString& str, int options) const +TQString Driver::escapeIdentifier(const TQString& str, int options) const { - QCString cstr = str.latin1(); - return QString(escapeIdentifier(cstr, options)); + TQCString cstr = str.latin1(); + return TQString(escapeIdentifier(cstr, options)); } -QCString Driver::escapeIdentifier(const QCString& str, int options) const +TQCString Driver::escapeIdentifier(const TQCString& str, int options) const { bool needOuterQuotes = false; @@ -333,24 +333,24 @@ QCString Driver::escapeIdentifier(const QCString& str, int options) const needOuterQuotes = true; // ... or if it's a keyword in Kexi's SQL dialect, - else if(d->kexiSQLDict->find(str)) + else if(d->kexiSQLDict->tqfind(str)) needOuterQuotes = true; // ... or if it's a keyword in the backends SQL dialect, // (have already checked !d->driverSQLDict) - else if((options & EscapeDriver) && d->driverSQLDict->find(str)) + else if((options & EscapeDriver) && d->driverSQLDict->tqfind(str)) needOuterQuotes = true; // ... or if the identifier has a space in it... - else if(str.find(' ') != -1) + else if(str.tqfind(' ') != -1) needOuterQuotes = true; if(needOuterQuotes && (options & EscapeKexi)) { const char quote = '"'; - return quote + QCString(str).replace( quote, "\"\"" ) + quote; + return quote + TQCString(str).tqreplace( quote, "\"\"" ) + quote; } else if (needOuterQuotes) { - const char quote = beh->QUOTATION_MARKS_FOR_IDENTIFIER.latin1(); + const char quote = beh->TQUOTATION_MARKS_FOR_IDENTIFIER.latin1(); return quote + drv_escapeIdentifier(str) + quote; } else { return drv_escapeIdentifier(str); diff --git a/kexi/kexidb/driver.h b/kexi/kexidb/driver.h index ef946e65..c889d475 100644 --- a/kexi/kexidb/driver.h +++ b/kexi/kexidb/driver.h @@ -20,9 +20,9 @@ #ifndef KEXIDB_DRIVER_H #define KEXIDB_DRIVER_H -#include <qobject.h> -#include <qdatetime.h> -#include <qdict.h> +#include <tqobject.h> +#include <tqdatetime.h> +#include <tqdict.h> #include <kexidb/global.h> #include <kexidb/object.h> @@ -43,7 +43,7 @@ class DriverPrivate; //! Generic database abstraction. /*! This class is a prototype of the database driver for implementations. Driver allows new connections to be created, and groups - these as a parent. + these as a tqparent. Before destruction, all connections are destructed. Notes: @@ -63,16 +63,17 @@ class DriverPrivate; \sa SQLiteDriver MySqlDriver, pqxxSqlDriver */ -class KEXI_DB_EXPORT Driver : public QObject, public KexiDB::Object +class KEXI_DB_EXPORT Driver : public TQObject, public KexiDB::Object { Q_OBJECT + TQ_OBJECT public: /*! Helpful for retrieving info about driver from using KexiDB::DriverManager::driversInfo() without loading driver libraries. */ class Info { public: Info(); - QString name, caption, comment, fileDBMimeType; + TQString name, caption, comment, fileDBMimeType; //! true is the driver is for file-based database backend bool fileBased : 1; /*! true is the driver is for a backend that allows importing. @@ -80,7 +81,7 @@ class KEXI_DB_EXPORT Driver : public QObject, public KexiDB::Object Used for migration. */ bool allowImportingTo : 1; }; - typedef QMap<QString,Info> InfoMap; + typedef TQMap<TQString,Info> InfoMap; /*! Features supported by driver (sum of few Features enum items). */ enum Features { @@ -125,25 +126,25 @@ class KEXI_DB_EXPORT Driver : public QObject, public KexiDB::Object Connection *createConnection( ConnectionData &conn_data, int options = 0 ); /*! \return List of created connections. */ - const QPtrList<Connection> connectionsList() const; + const TQPtrList<Connection> connectionsList() const; // /*! \return a name equal to the service name (X-Kexi-DriverName) // stored in given service .desktop file. */ -// QString driverName() { return m_driverName; } +// TQString driverName() { return m_driverName; } /*! \return a name of MIME type of files handled by this driver if it is a file-based database's driver (equal X-Kexi-FileDBDriverMime service property) otherwise returns null string. \sa isFileDriver() */ - QString fileDBDriverMimeType() const; + TQString fileDBDriverMimeType() const; /*! \return default file-based driver mime type (typically something like "application/x-kexiproject-sqlite") */ - static QString defaultFileBasedDriverMimeType(); + static TQString defaultFileBasedDriverMimeType(); /*! \return default file-based driver name (currently, "sqlite3"). */ - static QString defaultFileBasedDriverName(); + static TQString defaultFileBasedDriverName(); /*! Info about the driver as a service. */ const KService* service() const; @@ -160,12 +161,12 @@ class KEXI_DB_EXPORT Driver : public QObject, public KexiDB::Object from your reimplementation. \sa isSystemFieldName(). */ - virtual bool isSystemObjectName( const QString& n ) const; + virtual bool isSystemObjectName( const TQString& n ) const; /*! \return true if \a n is a kexibd-related 'system' object's name, i.e. when \a n starts with "kexi__" prefix. */ - static bool isKexiDBSystemObjectName( const QString& n ); + static bool isKexiDBSystemObjectName( const TQString& n ); /*! \return true if \a n is a system database's name, eg. name of build-in, system database that cannot be used or created by a user, @@ -173,7 +174,7 @@ class KEXI_DB_EXPORT Driver : public QObject, public KexiDB::Object a given driver implementation. For implementation. \sa isSystemObjectName(). */ - virtual bool isSystemDatabaseName( const QString& n ) const = 0; + virtual bool isSystemDatabaseName( const TQString& n ) const = 0; /*! \return true if \a n is a system field's name, build-in system field that cannot be used or created by a user, @@ -181,7 +182,7 @@ class KEXI_DB_EXPORT Driver : public QObject, public KexiDB::Object a given driver implementation. \sa isSystemObjectName(). */ - bool isSystemFieldName( const QString& n ) const; + bool isSystemFieldName( const TQString& n ) const; /*! \return Driver's features that are combination of Driver::Features enum. */ @@ -197,10 +198,10 @@ class KEXI_DB_EXPORT Driver : public QObject, public KexiDB::Object AdminTools& adminTools() const; /*! SQL-implementation-dependent name of given type */ - virtual QString sqlTypeName(int id_t, int p=0) const; + virtual TQString sqlTypeName(int id_t, int p=0) const; /*! used when we do not have Driver instance yet */ - static QString defaultSQLTypeName(int id_t); + static TQString defaultSQLTypeName(int id_t); /*! \return true if this driver's implementation is valid. Just few constriants are checked to ensure that driver @@ -219,21 +220,21 @@ class KEXI_DB_EXPORT Driver : public QObject, public KexiDB::Object Reimplement this if you need other behaviour (eg. for 'date' type handling) This implementation return date, datetime and time values in ISO format, what seems to be accepted by SQL servers. - @see Qt::DateFormat */ - virtual QString valueToSQL( uint ftype, const QVariant& v ) const; + @see TQt::DateFormat */ + virtual TQString valueToSQL( uint ftype, const TQVariant& v ) const; //! Like above but with the fildtype as string. - inline QString valueToSQL( const QString& ftype, const QVariant& v ) const { + inline TQString valueToSQL( const TQString& ftype, const TQVariant& v ) const { return valueToSQL(Field::typeForString(ftype), v); } //! Like above method, for \a field. - inline QString valueToSQL( const Field *field, const QVariant& v ) const { + inline TQString valueToSQL( const Field *field, const TQVariant& v ) const { return valueToSQL( (field ? field->type() : Field::InvalidType), v ); } /*! not compatible with all drivers - reimplement */ - inline virtual QString dateTimeToSQL(const QDateTime& v) const { + inline virtual TQString dateTimeToSQL(const TQDateTime& v) const { /*! (was compatible with SQLite: http://www.sqlite.org/cvstrac/wiki?p=DateAndTimeFunctions) Now it's ISO 8601 DateTime format - with "T" delimiter: @@ -241,27 +242,27 @@ class KEXI_DB_EXPORT Driver : public QObject, public KexiDB::Object (e.g. "1994-11-05T13:15:30" not "1994-11-05 13:15:30") @todo add support for time zones? */ -//old const QDateTime dt( v.toDateTime() ); -//old return QString("\'")+dt.date().toString(Qt::ISODate)+" "+dt.time().toString(Qt::ISODate)+"\'"; - return QString("\'")+v.toString(Qt::ISODate)+"\'"; +//old const TQDateTime dt( v.toDateTime() ); +//old return TQString("\'")+dt.date().toString(Qt::ISODate)+" "+dt.time().toString(Qt::ISODate)+"\'"; + return TQString("\'")+v.toString(Qt::ISODate)+"\'"; } /*! Driver-specific SQL string escaping. Implement escaping for any character like " or ' as your database engine requires. Prepend and append quotation marks. */ - virtual QString escapeString( const QString& str ) const = 0; + virtual TQString escapeString( const TQString& str ) const = 0; - /*! This is overloaded version of escapeString( const QString& str ) + /*! This is overloaded version of escapeString( const TQString& str ) to be implemented in the same way. */ - virtual QCString escapeString( const QCString& str ) const = 0; + virtual TQCString escapeString( const TQCString& str ) const = 0; /*! Driver-specific SQL BLOB value escaping. Implement escaping for any character like " or ' and \\0 as your database engine requires. Prepend and append quotation marks. */ - virtual QString escapeBLOB(const QByteArray& array) const = 0; + virtual TQString escapeBLOB(const TQByteArray& array) const = 0; //todo enum EscapeType { EscapeDriver = 0x00, EscapeKexi = 0x01}; //todo enum EscapePolicy { EscapeAsNecessary = 0x00, EscapeAlways = 0x02 }; @@ -276,22 +277,22 @@ class KEXI_DB_EXPORT Driver : public QObject, public KexiDB::Object \a options is the union of the EscapeType and EscapePolicy types. If no escaping options are given, defaults to driver escaping as necessary. */ - QString escapeIdentifier( const QString& str, + TQString escapeIdentifier( const TQString& str, int options = EscapeDriver|EscapeAsNecessary) const; - QCString escapeIdentifier( const QCString& str, + TQCString escapeIdentifier( const TQCString& str, int options = EscapeDriver|EscapeAsNecessary) const; //! \return property value for \a propeName available for this driver. - //! If there's no such property defined for driver, Null QVariant value is returned. - QVariant propertyValue( const QCString& propName ) const; + //! If there's no such property defined for driver, Null TQVariant value is returned. + TQVariant propertyValue( const TQCString& propName ) const; //! \return translated property caption for \a propeName. //! If there's no such property defined for driver, empty string value is returned. - QString propertyCaption( const QCString& propName ) const; + TQString propertyCaption( const TQCString& propName ) const; //! \return a list of property names available for this driver. - QValueList<QCString> propertyNames() const; + TQValueList<TQCString> propertyNames() const; protected: /*! Used by DriverManager. @@ -304,7 +305,7 @@ class KEXI_DB_EXPORT Driver : public QObject, public KexiDB::Object You may also want to change options in DriverBehaviour *beh member. See drivers/mySQL/mysqldriver.cpp for usage example. */ - Driver( QObject *parent, const char *name, const QStringList &args = QStringList() ); + Driver( TQObject *tqparent, const char *name, const TQStringList &args = TQStringList() ); /*! For reimplemenation: creates and returns connection object with additional structures specific for a given driver. @@ -318,20 +319,20 @@ class KEXI_DB_EXPORT Driver : public QObject, public KexiDB::Object Implement escaping for any character like " or ' as your database engine requires. Do not append or prepend any quotation marks characters - it is automatically done by escapeIdentifier() using - DriverBehaviour::QUOTATION_MARKS_FOR_IDENTIFIER. + DriverBehaviour::TQUOTATION_MARKS_FOR_IDENTIFIER. */ - virtual QString drv_escapeIdentifier( const QString& str ) const = 0; + virtual TQString drv_escapeIdentifier( const TQString& str ) const = 0; - /*! This is overloaded version of drv_escapeIdentifier( const QString& str ) + /*! This is overloaded version of drv_escapeIdentifier( const TQString& str ) to be implemented in the same way. */ - virtual QCString drv_escapeIdentifier( const QCString& str ) const = 0; + virtual TQCString drv_escapeIdentifier( const TQCString& str ) const = 0; /*! \return true if \a n is a system field's name, build-in system field that cannot be used or created by a user, and in most cases user even shouldn't see this. The list is specific for a given driver implementation. For implementation.*/ - virtual bool drv_isSystemFieldName( const QString& n ) const = 0; + virtual bool drv_isSystemFieldName( const TQString& n ) const = 0; /* Creates admin tools object providing a number of database administration tools for the driver. This is called once per driver. @@ -366,7 +367,7 @@ class KEXI_DB_EXPORT Driver : public QObject, public KexiDB::Object } //namespace KexiDB /*! Driver's static version information, automatically impemented for KexiDB drivers. - Put this into driver class declaration just like Q_OBJECT macro. */ + Put this into driver class declaration just like TQ_OBJECT macro. */ #define KEXIDB_DRIVER \ public: \ virtual DatabaseVersionInfo version() const; diff --git a/kexi/kexidb/driver_p.cpp b/kexi/kexidb/driver_p.cpp index 2ad5f9ce..8c7f096a 100644 --- a/kexi/kexidb/driver_p.cpp +++ b/kexi/kexidb/driver_p.cpp @@ -19,16 +19,16 @@ */ #include <kdebug.h> -#include <qdict.h> -#include <qvaluevector.h> +#include <tqdict.h> +#include <tqvaluevector.h> #include "driver_p.h" using namespace KexiDB; namespace KexiDB { - QAsciiDict<bool>* DriverPrivate::kexiSQLDict = 0; + TQAsciiDict<bool>* DriverPrivate::kexiSQLDict = 0; - /*! QAsciiDict keys need to be a pointer to *something*. Used + /*! TQAsciiDict keys need to be a pointer to *something*. Used for SQL keyword dictionaries */ static bool _dummy; @@ -55,7 +55,7 @@ DriverPrivate::DriverPrivate() void DriverPrivate::initInternalProperties() { - properties["is_file_database"] = QVariant(isFileDriver, 1); + properties["is_file_database"] = TQVariant(isFileDriver, 1); propertyCaptions["is_file_database"] = i18n("File-based database driver"); if (isFileDriver) { properties["file_database_mimetype"] = fileDBDriverMimeType; @@ -63,7 +63,7 @@ void DriverPrivate::initInternalProperties() } #if 0 - QString str; + TQString str; if (features & Driver::SingleTransactions) str = i18n("Single transactions"); else if (features & Driver::MultipleTransactions) @@ -77,15 +77,15 @@ void DriverPrivate::initInternalProperties() #endif // properties["transaction_support"] = features & Driver::TransactionsMask; // propertyCaptions["transaction_support"] = i18n("Transaction support"); - properties["transaction_single"] = QVariant(features & Driver::SingleTransactions, 1); + properties["transaction_single"] = TQVariant(features & Driver::SingleTransactions, 1); propertyCaptions["transaction_single"] = i18n("Single transactions support"); - properties["transaction_multiple"] = QVariant(features & Driver::MultipleTransactions, 1); + properties["transaction_multiple"] = TQVariant(features & Driver::MultipleTransactions, 1); propertyCaptions["transaction_multiple"] = i18n("Multiple transactions support"); - properties["transaction_nested"] = QVariant(features & Driver::NestedTransactions, 1); + properties["transaction_nested"] = TQVariant(features & Driver::NestedTransactions, 1); propertyCaptions["transaction_nested"] = i18n("Nested transactions support"); properties["kexidb_driver_version"] = - QString("%1.%2").arg(version().major).arg(version().minor); + TQString("%1.%2").tqarg(version().major).tqarg(version().minor); propertyCaptions["kexidb_driver_version"] = i18n("KexiDB driver version"); } @@ -98,23 +98,23 @@ DriverPrivate::~DriverPrivate() void DriverPrivate::initKexiKeywords() { - // QAsciiDict constructor args: + // TQAsciiDict constructor args: // size (preferable prime) // case sensitive flag (false) // copy strings (false) if(!kexiSQLDict) { - kexiSQLDict = new QAsciiDict<bool>(79, false, false); + kexiSQLDict = new TQAsciiDict<bool>(79, false, false); initKeywords(kexiSQLKeywords, *kexiSQLDict); } } void DriverPrivate::initDriverKeywords(const char* keywords[], int hashSize) { - driverSQLDict = new QAsciiDict<bool>(hashSize, false, false); + driverSQLDict = new TQAsciiDict<bool>(hashSize, false, false); initKeywords(keywords, *driverSQLDict); } void DriverPrivate::initKeywords(const char* keywords[], - QAsciiDict<bool>& dict) { + TQAsciiDict<bool>& dict) { for(int i = 0; keywords[i] != 0; i++) { dict.insert(keywords[i], &_dummy); } diff --git a/kexi/kexidb/driver_p.h b/kexi/kexidb/driver_p.h index 44ecd617..7a9be4ee 100644 --- a/kexi/kexidb/driver_p.h +++ b/kexi/kexidb/driver_p.h @@ -24,12 +24,12 @@ # error "Do not include: this is KexiDB internal file" #endif -#include <qstring.h> -#include <qvariant.h> -#include <qmap.h> -#include <qptrdict.h> -#include <qasciidict.h> -#include <qvaluevector.h> +#include <tqstring.h> +#include <tqvariant.h> +#include <tqmap.h> +#include <tqptrdict.h> +#include <tqasciidict.h> +#include <tqvaluevector.h> #include <kgenericfactory.h> #include "connection.h" @@ -50,19 +50,19 @@ class KEXI_DB_EXPORT DriverBehaviour DriverBehaviour(); //! "UNSIGNED" by default - QString UNSIGNED_TYPE_KEYWORD; + TQString UNSIGNED_TYPE_KEYWORD; //! "AUTO_INCREMENT" by default, used as add-in word to field definition //! May be also used as full definition if SPECIAL_AUTO_INCREMENT_DEF is true. - QString AUTO_INCREMENT_FIELD_OPTION; + TQString AUTO_INCREMENT_FIELD_OPTION; //! "AUTO_INCREMENT PRIMARY KEY" by default, used as add-in word to field definition //! May be also used as full definition if SPECIAL_AUTO_INCREMENT_DEF is true. - QString AUTO_INCREMENT_PK_FIELD_OPTION; + TQString AUTO_INCREMENT_PK_FIELD_OPTION; //! "" by default, used as type string for autoinc. field definition //! pgsql defines it as "SERIAL", sqlite defines it as "INTEGER" - QString AUTO_INCREMENT_TYPE; + TQString AUTO_INCREMENT_TYPE; /*! True if autoincrement field has special definition e.g. like "INTEGER PRIMARY KEY" for SQLite. @@ -72,7 +72,7 @@ class KEXI_DB_EXPORT DriverBehaviour /*! True if autoincrement requires field to be declared as primary key. This is true for SQLite. False by default. */ - bool AUTO_INCREMENT_REQUIRES_PK : 1; + bool AUTO_INCREMENT_RETQUIRES_PK : 1; /*! Name of a field (or built-in function) with autoincremented unique value, typically returned by Connection::drv_lastInsertRowID(). @@ -81,7 +81,7 @@ class KEXI_DB_EXPORT DriverBehaviour - PostgreSQL and SQLite engines use 'OID' field - MySQL uses LAST_INSERT_ID() built-in function */ - QString ROW_ID_FIELD_NAME; + TQString ROW_ID_FIELD_NAME; /*! True if the value (fetched from field or function, defined by ROW_ID_FIELD_NAME member) is EXACTLY the value of autoincremented field, @@ -109,12 +109,12 @@ class KEXI_DB_EXPORT DriverBehaviour \sa Connection::SetAvailableDatabaseName() */ - QString ALWAYS_AVAILABLE_DATABASE_NAME; + TQString ALWAYS_AVAILABLE_DATABASE_NAME; /*! Quotation marks used for escaping identifier (see Driver::escapeIdentifier()). Default value is '"'. Change it for your driver. */ - QChar QUOTATION_MARKS_FOR_IDENTIFIER; + TQChar TQUOTATION_MARKS_FOR_IDENTIFIER; /*! True if using database is requied to perform real connection. This is true for may engines, e.g. for PostgreSQL, where connections @@ -122,16 +122,16 @@ class KEXI_DB_EXPORT DriverBehaviour This flag is unused for file-based db drivers, by default set to true and used for all other db drivers. */ - bool USING_DATABASE_REQUIRED_TO_CONNECT : 1; + bool USING_DATABASE_RETQUIRED_TO_CONNECT : 1; /*! True if before we know whether the fetched result of executed query is empty or not, we need to fetch first record. Particularly, it's true for SQLite. The flag is used in Cursor::open(). By default this flag is false. */ - bool _1ST_ROW_READ_AHEAD_REQUIRED_TO_KNOW_IF_THE_RESULT_IS_EMPTY : 1; + bool _1ST_ROW_READ_AHEAD_RETQUIRED_TO_KNOW_IF_THE_RESULT_IS_EMPTY : 1; /*! True if "SELECT 1 from (subquery)" is supported. False by default. Used in Connection::resultExists() for optimization. It's set to true for SQLite driver. */ - bool SELECT_1_SUBQUERY_SUPPORTED : 1; + bool SELECT_1_SUBTQUERY_SUPPORTED : 1; /*! Keywords that need to be escaped for the driver. Set this before calling Driver::initSQLKeywords. */ @@ -145,17 +145,17 @@ class DriverPrivate DriverPrivate(); virtual ~DriverPrivate(); - QPtrDict<Connection> connections; + TQPtrDict<Connection> connections; -//(js)now QObject::name() is reused: +//(js)now TQObject::name() is reused: // /*! The name equal to the service name (X-Kexi-DriverName) // stored in given service .desktop file. Set this in subclasses. */ -// QString m_driverName; +// TQString m_driverName; /*! Name of MIME type of files handled by this driver if it is a file-based database's driver (equal X-Kexi-FileDBDriverMime service property) */ - QString fileDBDriverMimeType; + TQString fileDBDriverMimeType; /*! Info about the driver as a service. */ KService *service; @@ -172,12 +172,12 @@ class DriverPrivate cannot be used by user, and in most cases user even shouldn't see these. The list contents is driver dependent (by default is empty) - fill this in subclass ctor. */ -// QStringList m_systemObjectNames; +// TQStringList m_systemObjectNames; /*! List of system fields names, build-in system fields that cannot be used by user, and in most cases user even shouldn't see these. The list contents is driver dependent (by default is empty) - fill this in subclass ctor. */ -// QStringList m_systemFieldNames; +// TQStringList m_systemFieldNames; /*! Features (like transactions, etc.) supported by this driver (sum of selected Features enum items). @@ -186,17 +186,17 @@ class DriverPrivate int features; //! real type names for this engine - QValueVector<QString> typeNames; + TQValueVector<TQString> typeNames; /*! Driver properties dictionary (indexed by name), useful for presenting properties to the user. Set available properties here in driver implementation. */ - QMap<QCString,QVariant> properties; + TQMap<TQCString,TQVariant> properties; /*! i18n'd captions for properties. You do not need to set predefined properties' caption in driver implementation -it's done automatically. */ - QMap<QCString,QString> propertyCaptions; + TQMap<TQCString,TQString> propertyCaptions; /*! Provides a number of database administration tools for the driver. */ AdminTools *adminTools; @@ -207,7 +207,7 @@ class DriverPrivate UI consistency and to allow DB migration without changing the queries. \sa DriverPrivate::initKexiKeywords(), KexiDB::kexiSQLKeywords. */ - static QAsciiDict<bool>* kexiSQLDict; + static TQAsciiDict<bool>* kexiSQLDict; static const char *kexiSQLKeywords[]; /*! Driver-specific SQL keywords that need to be escaped if used as an @@ -219,7 +219,7 @@ class DriverPrivate \sa DriverBehaviour::SQL_KEYWORDS. */ - QAsciiDict<bool>* driverSQLDict; + TQAsciiDict<bool>* driverSQLDict; /*! Initialise the dictionary of Kexi SQL keywords used for escaping. */ void initKexiKeywords(); @@ -234,7 +234,7 @@ class DriverPrivate void initInternalProperties(); private: - void initKeywords(const char* keywords[], QAsciiDict<bool>& dict); + void initKeywords(const char* keywords[], TQAsciiDict<bool>& dict); friend class DriverManagerInternal; }; diff --git a/kexi/kexidb/drivermanager.cpp b/kexi/kexidb/drivermanager.cpp index e7e5b2bb..1afcbd64 100644 --- a/kexi/kexidb/drivermanager.cpp +++ b/kexi/kexidb/drivermanager.cpp @@ -35,7 +35,7 @@ #include <assert.h> -#include <qapplication.h> +#include <tqapplication.h> //remove debug #undef KexiDBDbg @@ -47,7 +47,7 @@ DriverManagerInternal* DriverManagerInternal::s_self = 0L; DriverManagerInternal::DriverManagerInternal() /* protected */ - : QObject( 0, "KexiDB::DriverManager" ) + : TQObject( 0, "KexiDB::DriverManager" ) , Object() , m_drivers(17, false) , m_refCount(0) @@ -69,7 +69,7 @@ DriverManagerInternal::~DriverManagerInternal() void DriverManagerInternal::slotAppQuits() { - if (qApp->mainWidget() && qApp->mainWidget()->isVisible()) + if (tqApp->mainWidget() && tqApp->mainWidget()->isVisible()) return; //what a hack! - we give up when app is still there KexiDBDbg << "DriverManagerInternal::slotAppQuits(): let's clear drivers..." << endl; m_drivers.clear(); @@ -88,8 +88,8 @@ bool DriverManagerInternal::lookupDrivers() if (!lookupDriversNeeded) return true; - if (qApp) { - connect(qApp,SIGNAL(aboutToQuit()),this,SLOT(slotAppQuits())); + if (tqApp) { + connect(tqApp,TQT_SIGNAL(aboutToQuit()),this,TQT_SLOT(slotAppQuits())); } //TODO: for QT-only version check for KInstance wrapper // KexiDBWarn << "DriverManagerInternal::lookupDrivers(): cannot work without KInstance (KGlobal::instance()==0)!" << endl; @@ -108,21 +108,21 @@ bool DriverManagerInternal::lookupDrivers() << ": no \"kexidb_\" prefix -- skipped to avoid potential conflicts!" << endl; continue; } - QString srv_name = ptr->property("X-Kexi-DriverName").toString(); + TQString srv_name = ptr->property("X-Kexi-DriverName").toString(); if (srv_name.isEmpty()) { KexiDBWarn << "DriverManagerInternal::lookupDrivers():" " X-Kexi-DriverName must be set for KexiDB driver \"" << ptr->property("Name").toString() << "\" service!\n -- skipped!" << endl; continue; } - if (m_services_lcase.contains(srv_name.lower())) { + if (m_services_lcase.tqcontains(srv_name.lower())) { KexiDBWarn << "DriverManagerInternal::lookupDrivers(): more than one driver named '" << srv_name.lower() << "'\n -- skipping this one!" << endl; continue; } - QString srv_ver_str = ptr->property("X-Kexi-KexiDBVersion").toString(); - QStringList lst( QStringList::split(".", srv_ver_str) ); + TQString srv_ver_str = ptr->property("X-Kexi-KexiDBVersion").toString(); + TQStringList lst( TQStringList::split(".", srv_ver_str) ); uint minor_ver, major_ver; bool ok = (lst.count() == 2); if (ok) @@ -135,32 +135,32 @@ bool DriverManagerInternal::lookupDrivers() continue; } if (major_ver != KexiDB::version().major || minor_ver != KexiDB::version().minor) { - KexiDBWarn << QString("DriverManagerInternal::lookupDrivers(): '%1' driver" + KexiDBWarn << TQString("DriverManagerInternal::lookupDrivers(): '%1' driver" " has version '%2' but required KexiDB driver version is '%3.%4'\n" - " -- skipping this driver!").arg(srv_name.lower()).arg(srv_ver_str) - .arg(KexiDB::version().major).arg(KexiDB::version().minor) << endl; - possibleProblems += QString("\"%1\" database driver has version \"%2\" " + " -- skipping this driver!").tqarg(srv_name.lower()).tqarg(srv_ver_str) + .tqarg(KexiDB::version().major).tqarg(KexiDB::version().minor) << endl; + possibleProblems += TQString("\"%1\" database driver has version \"%2\" " "but required driver version is \"%3.%4\"") - .arg(srv_name.lower()).arg(srv_ver_str) - .arg(KexiDB::version().major).arg(KexiDB::version().minor); + .tqarg(srv_name.lower()).tqarg(srv_ver_str) + .tqarg(KexiDB::version().major).tqarg(KexiDB::version().minor); continue; } - QString drvType = ptr->property("X-Kexi-DriverType").toString().lower(); + TQString drvType = ptr->property("X-Kexi-DriverType").toString().lower(); if (drvType=="file") { //new property: a list of supported mime types - QStringList mimes( ptr->property("X-Kexi-FileDBDriverMimeList").toStringList() ); + TQStringList mimes( ptr->property("X-Kexi-FileDBDriverMimeList").toStringList() ); //single mime is obsolete, but we're handling it: { - QString mime( ptr->property("X-Kexi-FileDBDriverMime").toString().lower() ); + TQString mime( ptr->property("X-Kexi-FileDBDriverMime").toString().lower() ); if (!mime.isEmpty()) mimes.append( mime ); } //store association of this driver with all listed mime types - for (QStringList::ConstIterator mime_it = mimes.constBegin(); mime_it!=mimes.constEnd(); ++mime_it) { - QString mime( (*mime_it).lower() ); - if (!m_services_by_mimetype.contains(mime)) { + for (TQStringList::ConstIterator mime_it = mimes.constBegin(); mime_it!=mimes.constEnd(); ++mime_it) { + TQString mime( (*mime_it).lower() ); + if (!m_services_by_mimetype.tqcontains(mime)) { m_services_by_mimetype.insert(mime, ptr); } else { @@ -182,15 +182,15 @@ bool DriverManagerInternal::lookupDrivers() return true; } -KexiDB::Driver::Info DriverManagerInternal::driverInfo(const QString &name) +KexiDB::Driver::Info DriverManagerInternal::driverInfo(const TQString &name) { KexiDB::Driver::Info i = m_driversInfo[name.lower()]; if (!error() && i.name.isEmpty()) - setError(ERR_DRIVERMANAGER, i18n("Could not find database driver \"%1\".").arg(name) ); + setError(ERR_DRIVERMANAGER, i18n("Could not find database driver \"%1\".").tqarg(name) ); return i; } -Driver* DriverManagerInternal::driver(const QString& name) +Driver* DriverManagerInternal::driver(const TQString& name) { if (!lookupDrivers()) return 0; @@ -198,25 +198,25 @@ Driver* DriverManagerInternal::driver(const QString& name) clearError(); KexiDBDbg << "DriverManager::driver(): loading " << name << endl; - Driver *drv = name.isEmpty() ? 0 : m_drivers.find(name.latin1()); + Driver *drv = name.isEmpty() ? 0 : m_drivers.tqfind(name.latin1()); if (drv) return drv; //cached - if (!m_services_lcase.contains(name.lower())) { - setError(ERR_DRIVERMANAGER, i18n("Could not find database driver \"%1\".").arg(name) ); + if (!m_services_lcase.tqcontains(name.lower())) { + setError(ERR_DRIVERMANAGER, i18n("Could not find database driver \"%1\".").tqarg(name) ); return 0; } - KService::Ptr ptr= *(m_services_lcase.find(name.lower())); - QString srv_name = ptr->property("X-Kexi-DriverName").toString(); + KService::Ptr ptr= *(m_services_lcase.tqfind(name.lower())); + TQString srv_name = ptr->property("X-Kexi-DriverName").toString(); KexiDBDbg << "KexiDBInterfaceManager::load(): library: "<<ptr->library()<<endl; drv = KParts::ComponentFactory::createInstanceFromService<KexiDB::Driver>(ptr, - this, srv_name.latin1(), QStringList(),&m_serverResultNum); + this, srv_name.latin1(), TQStringList(),&m_serverResultNum); if (!drv) { setError(ERR_DRIVERMANAGER, i18n("Could not load database driver \"%1\".") - .arg(name) ); + .tqarg(name) ); if (m_componentLoadingErrors.isEmpty()) {//fill errtable on demand m_componentLoadingErrors[KParts::ComponentFactory::ErrNoServiceFound]="ErrNoServiceFound"; m_componentLoadingErrors[KParts::ComponentFactory::ErrServiceProvidesNoLibrary]="ErrServiceProvidesNoLibrary"; @@ -273,7 +273,7 @@ void DriverManagerInternal::aboutDelete( Driver* drv ) // --------------------------- DriverManager::DriverManager() - : QObject( 0, "KexiDB::DriverManager" ) + : TQObject( 0, "KexiDB::DriverManager" ) , Object() , d_int( DriverManagerInternal::self() ) { @@ -323,24 +323,24 @@ const KexiDB::Driver::InfoMap DriverManager::driversInfo() info.fileBased = (ptr->property("X-Kexi-DriverType").toString().lower()=="file"); if (info.fileBased) info.fileDBMimeType = ptr->property("X-Kexi-FileDBDriverMime").toString().lower(); - QVariant v = ptr->property("X-Kexi-DoNotAllowProjectImportingTo"); + TQVariant v = ptr->property("X-Kexi-DoNotAllowProjectImportingTo"); info.allowImportingTo = v.isNull() ? true : !v.toBool(); d_int->m_driversInfo.insert(info.name.lower(), info); } return d_int->m_driversInfo; } -const QStringList DriverManager::driverNames() +const TQStringList DriverManager::driverNames() { if (!d_int->lookupDrivers()) - return QStringList(); + return TQStringList(); if (d_int->m_services.isEmpty() && d_int->error()) - return QStringList(); + return TQStringList(); return d_int->m_services.keys(); } -KexiDB::Driver::Info DriverManager::driverInfo(const QString &name) +KexiDB::Driver::Info DriverManager::driverInfo(const TQString &name) { driversInfo(); KexiDB::Driver::Info i = d_int->driverInfo(name); @@ -349,7 +349,7 @@ KexiDB::Driver::Info DriverManager::driverInfo(const QString &name) return i; } -KService::Ptr DriverManager::serviceInfo(const QString &name) +KService::Ptr DriverManager::serviceInfo(const TQString &name) { if (!d_int->lookupDrivers()) { setError(d_int); @@ -357,10 +357,10 @@ KService::Ptr DriverManager::serviceInfo(const QString &name) } clearError(); - if (d_int->m_services_lcase.contains(name.lower())) { - return *d_int->m_services_lcase.find(name.lower()); + if (d_int->m_services_lcase.tqcontains(name.lower())) { + return *d_int->m_services_lcase.tqfind(name.lower()); } else { - setError(ERR_DRIVERMANAGER, i18n("No such driver service: \"%1\".").arg(name) ); + setError(ERR_DRIVERMANAGER, i18n("No such driver service: \"%1\".").tqarg(name) ); return KService::Ptr(); } } @@ -372,7 +372,7 @@ const DriverManager::ServicesMap& DriverManager::services() return d_int->m_services; } -QString DriverManager::lookupByMime(const QString &mimeType) +TQString DriverManager::lookupByMime(const TQString &mimeType) { if (!d_int->lookupDrivers()) { setError(d_int); @@ -381,11 +381,11 @@ QString DriverManager::lookupByMime(const QString &mimeType) KService::Ptr ptr = d_int->m_services_by_mimetype[mimeType.lower()]; if (!ptr) - return QString::null; + return TQString(); return ptr->property("X-Kexi-DriverName").toString(); } -Driver* DriverManager::driver(const QString& name) +Driver* DriverManager::driver(const TQString& name) { Driver *drv = d_int->driver(name); if (d_int->error()) @@ -393,7 +393,7 @@ Driver* DriverManager::driver(const QString& name) return drv; } -QString DriverManager::serverErrorMsg() +TQString DriverManager::serverErrorMsg() { return d_int->m_serverErrMsg; } @@ -403,29 +403,29 @@ int DriverManager::serverResult() return d_int->m_serverResultNum; } -QString DriverManager::serverResultName() +TQString DriverManager::serverResultName() { return d_int->m_serverResultName; } void DriverManager::drv_clearServerResult() { - d_int->m_serverErrMsg=QString::null; + d_int->m_serverErrMsg=TQString(); d_int->m_serverResultNum=0; - d_int->m_serverResultName=QString::null; + d_int->m_serverResultName=TQString(); } -QString DriverManager::possibleProblemsInfoMsg() const +TQString DriverManager::possibleProblemsInfoMsg() const { if (d_int->possibleProblems.isEmpty()) - return QString::null; - QString str; + return TQString(); + TQString str; str.reserve(1024); str = "<ul>"; - for (QStringList::ConstIterator it = d_int->possibleProblems.constBegin(); + for (TQStringList::ConstIterator it = d_int->possibleProblems.constBegin(); it!=d_int->possibleProblems.constEnd(); ++it) { - str += (QString::fromLatin1("<li>") + *it + QString::fromLatin1("</li>")); + str += (TQString::tqfromLatin1("<li>") + *it + TQString::tqfromLatin1("</li>")); } str += "</ul>"; return str; diff --git a/kexi/kexidb/drivermanager.h b/kexi/kexidb/drivermanager.h index fa78c841..67358993 100644 --- a/kexi/kexidb/drivermanager.h +++ b/kexi/kexidb/drivermanager.h @@ -22,10 +22,10 @@ #ifndef KEXIDB_DRIVER_MNGR_H #define KEXIDB_DRIVER_MNGR_H -#include <qobject.h> -#include <qcstring.h> -#include <qmap.h> -#include <qdict.h> +#include <tqobject.h> +#include <tqcstring.h> +#include <tqmap.h> +#include <tqdict.h> #include <klibloader.h> #include <kservice.h> @@ -39,10 +39,10 @@ class Connection; class ConnectionData; //! Database driver management, e.g. finding and loading drivers. -class KEXI_DB_EXPORT DriverManager : public QObject, public KexiDB::Object +class KEXI_DB_EXPORT DriverManager : public TQObject, public KexiDB::Object { public: - typedef QMap<QString, KService::Ptr> ServicesMap; + typedef TQMap<TQString, KService::Ptr> ServicesMap; DriverManager(); virtual ~DriverManager(); @@ -50,11 +50,11 @@ class KEXI_DB_EXPORT DriverManager : public QObject, public KexiDB::Object /*! Tries to load db driver with named name \a name. The name is case insensitive. \return db driver, or 0 if error (then error message is also set) */ - Driver* driver(const QString& name); + Driver* driver(const TQString& name); /*! returns list of available drivers names. That drivers can be loaded by first use of driver() method. */ - const QStringList driverNames(); + const TQStringList driverNames(); /*! returns information list of available drivers. That drivers can be loaded by first use of driver() method. */ @@ -64,12 +64,12 @@ class KEXI_DB_EXPORT DriverManager : public QObject, public KexiDB::Object The name is case insensitive. You can check if driver information is not found calling Info::name.isEmpty() (then error message is also set). */ - KexiDB::Driver::Info driverInfo(const QString &name); + KexiDB::Driver::Info driverInfo(const TQString &name); /*! \return service information about driver's named with \a name. The name is case insensitive. In most cases you can use driverInfo() instead. */ - KService::Ptr serviceInfo(const QString &name); + KService::Ptr serviceInfo(const TQString &name); /*! \return a map structure of the services. Not necessary for everyday use. */ const ServicesMap& services(); @@ -79,18 +79,18 @@ class KEXI_DB_EXPORT DriverManager : public QObject, public KexiDB::Object The lookup is case insensitive. \return driver name or null string if no driver found. */ - QString lookupByMime(const QString &mimeType); + TQString lookupByMime(const TQString &mimeType); //! server error is set if there is error at KService level (useful for debugging) - virtual QString serverErrorMsg(); + virtual TQString serverErrorMsg(); virtual int serverResult(); - virtual QString serverResultName(); + virtual TQString serverResultName(); /*! HTML information about possible problems encountered. It's displayed in 'details' section, if an error encountered. Currently it contains a list of incompatible db drivers. Used in KexiStartupHandler::detectDriverForFile(). */ - QString possibleProblemsInfoMsg() const; + TQString possibleProblemsInfoMsg() const; protected: virtual void drv_clearServerResult(); diff --git a/kexi/kexidb/drivermanager_p.h b/kexi/kexidb/drivermanager_p.h index ce92dd03..85388270 100644 --- a/kexi/kexidb/drivermanager_p.h +++ b/kexi/kexidb/drivermanager_p.h @@ -22,24 +22,25 @@ #include <kexidb/object.h> -#include <qobject.h> -#include <qasciidict.h> +#include <tqobject.h> +#include <tqasciidict.h> namespace KexiDB { /*! Internal class of driver manager. */ -class KEXI_DB_EXPORT DriverManagerInternal : public QObject, public KexiDB::Object +class KEXI_DB_EXPORT DriverManagerInternal : public TQObject, public KexiDB::Object { Q_OBJECT + TQ_OBJECT public: ~DriverManagerInternal(); /*! Tries to load db driver \a name. \return db driver, or 0 if error (then error message is also set) */ - KexiDB::Driver* driver(const QString& name); + KexiDB::Driver* driver(const TQString& name); - KexiDB::Driver::Info driverInfo(const QString &name); + KexiDB::Driver::Info driverInfo(const TQString &name); static DriverManagerInternal *self(); @@ -55,9 +56,9 @@ class KEXI_DB_EXPORT DriverManagerInternal : public QObject, public KexiDB::Obje void aboutDelete( Driver* drv ); protected slots: - /*! Used to destroy all drivers on QApplication quit, so even if there are + /*! Used to destroy all drivers on TQApplication quit, so even if there are DriverManager's static instances that are destroyed on program - "static destruction", drivers are not kept after QApplication death. + "static destruction", drivers are not kept after TQApplication death. */ void slotAppQuits(); @@ -73,16 +74,16 @@ class KEXI_DB_EXPORT DriverManagerInternal : public QObject, public KexiDB::Obje DriverManager::ServicesMap m_services_lcase; //! as above but service names in lowercase DriverManager::ServicesMap m_services_by_mimetype; Driver::InfoMap m_driversInfo; //! used to store drivers information - QAsciiDict<KexiDB::Driver> m_drivers; + TQAsciiDict<KexiDB::Driver> m_drivers; ulong m_refCount; - QString m_serverErrMsg; + TQString m_serverErrMsg; int m_serverResultNum; - QString m_serverResultName; + TQString m_serverResultName; //! result names for KParts::ComponentFactory::ComponentLoadingError - QMap<int,QString> m_componentLoadingErrors; + TQMap<int,TQString> m_componentLoadingErrors; - QStringList possibleProblems; + TQStringList possibleProblems; bool lookupDriversNeeded : 1; diff --git a/kexi/kexidb/drivers/mySQL/mySQL.pro b/kexi/kexidb/drivers/mySQL/mySQL.pro index cc6eddd6..6c443be3 100644 --- a/kexi/kexidb/drivers/mySQL/mySQL.pro +++ b/kexi/kexidb/drivers/mySQL/mySQL.pro @@ -2,11 +2,11 @@ include( ../common.pro ) INCLUDEPATH += $(MYSQL_INC) $(MYSQL_INC)/mysql -contains(CONFIG,debug) { +tqcontains(CONFIG,debug) { win32:LIBS += $(MYSQL_LIB)/debug/libmysql.lib win32:QMAKE_LFLAGS += /NODEFAULTLIB:LIBCMTD.LIB } -!contains(CONFIG,debug) { +!tqcontains(CONFIG,debug) { # win32:LIBS += $(MYSQL_LIB)/opt/mysqlclient.lib win32:LIBS += $(MYSQL_LIB)/opt/libmysql.lib # win32:QMAKE_LFLAGS += /NODEFAULTLIB:MSVCRT.LIB @@ -14,7 +14,7 @@ contains(CONFIG,debug) { TARGET = kexidb_mysqldriver$$KDELIBDEBUG -system( bash kmoc ) +system( bash ktqmoc ) SOURCES = \ mysqlconnection_p.cpp \ diff --git a/kexi/kexidb/drivers/mySQL/mysqlconnection.cpp b/kexi/kexidb/drivers/mySQL/mysqlconnection.cpp index 7417b698..18682a4f 100644 --- a/kexi/kexidb/drivers/mySQL/mysqlconnection.cpp +++ b/kexi/kexidb/drivers/mySQL/mysqlconnection.cpp @@ -20,10 +20,10 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ -#include <qvariant.h> -#include <qfile.h> -#include <qdict.h> -#include <qregexp.h> +#include <tqvariant.h> +#include <tqfile.h> +#include <tqdict.h> +#include <tqregexp.h> #include <kgenericfactory.h> #include <kdebug.h> @@ -68,9 +68,9 @@ bool MySqlConnection::drv_connect(KexiDB::ServerVersionInfo& version) version.release = v - version.major*10000 - version.minor*100; #else //better way to get the version info: use 'version' built-in variable: //! @todo this is hardcoded for now; define api for retrieving variables and use this API... - QString versionString; + TQString versionString; const tristate res = querySingleString("SELECT @@version", versionString, /*column*/0, false /*!addLimitTo1*/); - QRegExp versionRe("(\\d+)\\.(\\d+)\\.(\\d+)"); + TQRegExp versionRe("(\\d+)\\.(\\d+)\\.(\\d+)"); if (res==true && versionRe.exactMatch(versionString)) { // (if querySingleString failed, the version will be 0.0.0... version.major = versionRe.cap(1).toInt(); version.minor = versionRe.cap(2).toInt(); @@ -84,7 +84,7 @@ bool MySqlConnection::drv_disconnect() { return d->db_disconnect(); } -Cursor* MySqlConnection::prepareQuery(const QString& statement, uint cursor_options) { +Cursor* MySqlConnection::prepareQuery(const TQString& statement, uint cursor_options) { return new MySqlCursor(this,statement,cursor_options); } @@ -92,7 +92,7 @@ Cursor* MySqlConnection::prepareQuery( QuerySchema& query, uint cursor_options ) return new MySqlCursor( this, query, cursor_options ); } -bool MySqlConnection::drv_getDatabasesList( QStringList &list ) { +bool MySqlConnection::drv_getDatabasesList( TQStringList &list ) { KexiDBDrvDbg << "MySqlConnection::drv_getDatabasesList()" << endl; list.clear(); MYSQL_RES *res; @@ -100,7 +100,7 @@ bool MySqlConnection::drv_getDatabasesList( QStringList &list ) { if((res=mysql_list_dbs(d->mysql,0)) != 0) { MYSQL_ROW row; while ( (row = mysql_fetch_row(res))!=0) { - list<<QString(row[0]); + list<<TQString(row[0]); } mysql_free_result(res); return true; @@ -111,7 +111,7 @@ bool MySqlConnection::drv_getDatabasesList( QStringList &list ) { return false; } -bool MySqlConnection::drv_createDatabase( const QString &dbName) { +bool MySqlConnection::drv_createDatabase( const TQString &dbName) { KexiDBDrvDbg << "MySqlConnection::drv_createDatabase: " << dbName << endl; // mysql_create_db deprecated, use SQL here. if (drv_executeSQL("CREATE DATABASE " + (dbName))) @@ -120,7 +120,7 @@ bool MySqlConnection::drv_createDatabase( const QString &dbName) { return false; } -bool MySqlConnection::drv_useDatabase(const QString &dbName, bool *cancelled, MessageHandler* msgHandler) +bool MySqlConnection::drv_useDatabase(const TQString &dbName, bool *cancelled, MessageHandler* msgHandler) { Q_UNUSED(cancelled); Q_UNUSED(msgHandler); @@ -134,19 +134,19 @@ bool MySqlConnection::drv_closeDatabase() { return true; } -bool MySqlConnection::drv_dropDatabase( const QString &dbName) { +bool MySqlConnection::drv_dropDatabase( const TQString &dbName) { //TODO is here escaping needed return drv_executeSQL("drop database "+dbName); } -bool MySqlConnection::drv_executeSQL( const QString& statement ) { +bool MySqlConnection::drv_executeSQL( const TQString& statement ) { return d->executeSQL(statement); } -Q_ULLONG MySqlConnection::drv_lastInsertRowID() +TQ_ULLONG MySqlConnection::drv_lastInsertRowID() { //! @todo - return (Q_ULLONG)mysql_insert_id(d->mysql); + return (TQ_ULLONG)mysql_insert_id(d->mysql); } int MySqlConnection::serverResult() @@ -154,9 +154,9 @@ int MySqlConnection::serverResult() return d->res; } -QString MySqlConnection::serverResultName() +TQString MySqlConnection::serverResultName() { - return QString::null; + return TQString(); } void MySqlConnection::drv_clearServerResult() @@ -166,19 +166,19 @@ void MySqlConnection::drv_clearServerResult() d->res = 0; } -QString MySqlConnection::serverErrorMsg() +TQString MySqlConnection::serverErrorMsg() { return d->errmsg; } -bool MySqlConnection::drv_containsTable( const QString &tableName ) +bool MySqlConnection::drv_containsTable( const TQString &tableName ) { bool success; - return resultExists(QString("show tables like %1") - .arg(driver()->escapeString(tableName)), success) && success; + return resultExists(TQString("show tables like %1") + .tqarg(driver()->escapeString(tableName)), success) && success; } -bool MySqlConnection::drv_getTablesList( QStringList &list ) +bool MySqlConnection::drv_getTablesList( TQStringList &list ) { KexiDB::Cursor *cursor; m_sql = "show tables"; diff --git a/kexi/kexidb/drivers/mySQL/mysqlconnection.h b/kexi/kexidb/drivers/mySQL/mysqlconnection.h index bafb889d..e0fb4382 100644 --- a/kexi/kexidb/drivers/mySQL/mysqlconnection.h +++ b/kexi/kexidb/drivers/mySQL/mysqlconnection.h @@ -22,11 +22,11 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, #ifndef MYSQLCONNECTION_H #define MYSQLCONNECTION_H -#include <qstringlist.h> +#include <tqstringlist.h> #include <kexidb/connection.h> #include "mysqlcursor.h" -#include <qdict.h> +#include <tqdict.h> namespace KexiDB { @@ -40,11 +40,12 @@ class MySqlConnectionInternal; class MySqlConnection : public Connection { Q_OBJECT + TQ_OBJECT public: virtual ~MySqlConnection(); - virtual Cursor* prepareQuery( const QString& statement = QString::null, uint cursor_options = 0 ); + virtual Cursor* prepareQuery( const TQString& statement = TQString(), uint cursor_options = 0 ); virtual Cursor* prepareQuery( QuerySchema& query, uint cursor_options = 0 ); virtual PreparedStatement::Ptr prepareStatement(PreparedStatement::StatementType type, @@ -57,24 +58,24 @@ class MySqlConnection : public Connection virtual bool drv_connect(KexiDB::ServerVersionInfo& version); virtual bool drv_disconnect(); - virtual bool drv_getDatabasesList( QStringList &list ); - virtual bool drv_createDatabase( const QString &dbName = QString::null ); - virtual bool drv_useDatabase( const QString &dbName = QString::null, bool *cancelled = 0, + virtual bool drv_getDatabasesList( TQStringList &list ); + virtual bool drv_createDatabase( const TQString &dbName = TQString() ); + virtual bool drv_useDatabase( const TQString &dbName = TQString(), bool *cancelled = 0, MessageHandler* msgHandler = 0 ); virtual bool drv_closeDatabase(); - virtual bool drv_dropDatabase( const QString &dbName = QString::null ); - virtual bool drv_executeSQL( const QString& statement ); - virtual Q_ULLONG drv_lastInsertRowID(); + virtual bool drv_dropDatabase( const TQString &dbName = TQString() ); + virtual bool drv_executeSQL( const TQString& statement ); + virtual TQ_ULLONG drv_lastInsertRowID(); virtual int serverResult(); - virtual QString serverResultName(); - virtual QString serverErrorMsg(); + virtual TQString serverResultName(); + virtual TQString serverErrorMsg(); virtual void drv_clearServerResult(); //TODO: move this somewhere to low level class (MIGRATION?) - virtual bool drv_getTablesList( QStringList &list ); + virtual bool drv_getTablesList( TQStringList &list ); //TODO: move this somewhere to low level class (MIGRATION?) - virtual bool drv_containsTable( const QString &tableName ); + virtual bool drv_containsTable( const TQString &tableName ); MySqlConnectionInternal* d; diff --git a/kexi/kexidb/drivers/mySQL/mysqlconnection_p.cpp b/kexi/kexidb/drivers/mySQL/mysqlconnection_p.cpp index 9797ca96..50b94ae2 100644 --- a/kexi/kexidb/drivers/mySQL/mysqlconnection_p.cpp +++ b/kexi/kexidb/drivers/mySQL/mysqlconnection_p.cpp @@ -18,10 +18,10 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ -#include <qcstring.h> -#include <qstring.h> -#include <qstringlist.h> -#include <qfile.h> +#include <tqcstring.h> +#include <tqstring.h> +#include <tqstringlist.h> +#include <tqfile.h> #include <kdebug.h> @@ -67,37 +67,37 @@ void MySqlConnectionInternal::storeResult() none is specified). If the server is on a remote machine, then a port is the port that the remote server is listening on. */ -//bool MySqlConnectionInternal::db_connect(QCString host, QCString user, -// QCString password, unsigned short int port, QString socket) +//bool MySqlConnectionInternal::db_connect(TQCString host, TQCString user, +// TQCString password, unsigned short int port, TQString socket) bool MySqlConnectionInternal::db_connect(const KexiDB::ConnectionData& data) { if (!(mysql = mysql_init(mysql))) return false; KexiDBDrvDbg << "MySqlConnectionInternal::connect()" << endl; - QCString localSocket; - QString hostName = data.hostName; + TQCString localSocket; + TQString hostName = data.hostName; if (hostName.isEmpty() || hostName.lower()=="localhost") { if (data.useLocalSocketFile) { if (data.localSocketFileName.isEmpty()) { //! @todo move the list of default sockets to a generic method - QStringList sockets; - #ifndef Q_WS_WIN + TQStringList sockets; + #ifndef TQ_WS_WIN sockets.append("/var/lib/mysql/mysql.sock"); sockets.append("/var/run/mysqld/mysqld.sock"); sockets.append("/tmp/mysql.sock"); - for(QStringList::ConstIterator it = sockets.constBegin(); it != sockets.constEnd(); it++) + for(TQStringList::ConstIterator it = sockets.constBegin(); it != sockets.constEnd(); it++) { - if(QFile(*it).exists()) { - localSocket = ((QString)(*it)).local8Bit(); + if(TQFile(*it).exists()) { + localSocket = ((TQString)(*it)).local8Bit(); break; } } #endif } else - localSocket = QFile::encodeName(data.localSocketFileName); + localSocket = TQFile::encodeName(data.localSocketFileName); } else { //we're not using local socket @@ -131,17 +131,17 @@ bool MySqlConnectionInternal::db_disconnect() /* ************************************************************************** */ /*! Selects dbName as the active database so it can be used. */ -bool MySqlConnectionInternal::useDatabase(const QString &dbName) { +bool MySqlConnectionInternal::useDatabase(const TQString &dbName) { //TODO is here escaping needed? return executeSQL("USE " + dbName); } /*! Executes the given SQL statement on the server. */ -bool MySqlConnectionInternal::executeSQL(const QString& statement) { +bool MySqlConnectionInternal::executeSQL(const TQString& statement) { // KexiDBDrvDbg << "MySqlConnectionInternal::executeSQL: " // << statement << endl; - QCString queryStr=statement.utf8(); + TQCString queryStr=statement.utf8(); const char *query=queryStr; if(mysql_real_query(mysql, query, strlen(query)) == 0) { @@ -153,8 +153,8 @@ bool MySqlConnectionInternal::executeSQL(const QString& statement) { return false; } -QString MySqlConnectionInternal::escapeIdentifier(const QString& str) const { - return QString(str).replace('`', "'"); +TQString MySqlConnectionInternal::escapeIdentifier(const TQString& str) const { + return TQString(str).tqreplace('`', "'"); } //-------------------------------------- diff --git a/kexi/kexidb/drivers/mySQL/mysqlconnection_p.h b/kexi/kexidb/drivers/mySQL/mysqlconnection_p.h index 5bb77487..85d8c57b 100644 --- a/kexi/kexidb/drivers/mySQL/mysqlconnection_p.h +++ b/kexi/kexidb/drivers/mySQL/mysqlconnection_p.h @@ -22,7 +22,7 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, #include <kexidb/connection_p.h> -#ifdef Q_WS_WIN +#ifdef TQ_WS_WIN #include <my_global.h> #endif #include <mysql_version.h> @@ -31,8 +31,8 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, typedef struct st_mysql MYSQL; #undef bool -class QCString; -class QString; +class TQCString; +class TQString; #ifdef MYSQLMIGRATE_H #define NAMESPACE KexiMigration @@ -64,20 +64,20 @@ class MySqlConnectionInternal : public KexiDB::ConnectionInternal bool db_disconnect(); //! Selects a database that is about to be used - bool useDatabase(const QString &dbName = QString::null); + bool useDatabase(const TQString &dbName = TQString()); //! Execute SQL statement on the database - bool executeSQL( const QString& statement ); + bool executeSQL( const TQString& statement ); //! Stores last operation's result virtual void storeResult(); //! Escapes a table, database or column name - QString escapeIdentifier(const QString& str) const; + TQString escapeIdentifier(const TQString& str) const; MYSQL *mysql; bool mysql_owned; //!< true if mysql pointer should be freed on destruction - QString errmsg; //!< server-specific message of last operation + TQString errmsg; //!< server-specific message of last operation int res; //!< result code of last operation on server }; diff --git a/kexi/kexidb/drivers/mySQL/mysqlcursor.cpp b/kexi/kexidb/drivers/mySQL/mysqlcursor.cpp index 7897fa97..abfdb44f 100644 --- a/kexi/kexidb/drivers/mySQL/mysqlcursor.cpp +++ b/kexi/kexidb/drivers/mySQL/mysqlcursor.cpp @@ -31,7 +31,7 @@ using namespace KexiDB; -MySqlCursor::MySqlCursor(KexiDB::Connection* conn, const QString& statement, uint cursor_options) +MySqlCursor::MySqlCursor(KexiDB::Connection* conn, const TQString& statement, uint cursor_options) : Cursor(conn,statement,cursor_options) , d( new MySqlCursorData(conn) ) { @@ -72,7 +72,7 @@ bool MySqlCursor::drv_open() { } } - setError(ERR_DB_SPECIFIC,QString::fromUtf8(mysql_error(d->mysql))); + setError(ERR_DB_SPECIFIC,TQString::fromUtf8(mysql_error(d->mysql))); return false; } @@ -106,9 +106,9 @@ void MySqlCursor::drv_getNextRecord() { } // This isn't going to work right now as it uses d->mysqlrow -QVariant MySqlCursor::value(uint pos) { +TQVariant MySqlCursor::value(uint pos) { if (!d->mysqlrow || pos>=m_fieldCount || d->mysqlrow[pos]==0) - return QVariant(); + return TQVariant(); KexiDB::Field *f = (m_fieldsExpanded && pos<m_fieldsExpanded->count()) ? m_fieldsExpanded->at(pos)->field : 0; @@ -119,20 +119,20 @@ QVariant MySqlCursor::value(uint pos) { /* moved to cstringToVariant() //from most to least frequently used types: if (!f || f->isTextType()) - return QVariant( QString::fromUtf8((const char*)d->mysqlrow[pos], d->lengths[pos]) ); + return TQVariant( TQString::fromUtf8((const char*)d->mysqlrow[pos], d->lengths[pos]) ); else if (f->isIntegerType()) //! @todo support BigInteger - return QVariant( QCString((const char*)d->mysqlrow[pos], d->lengths[pos]).toInt() ); + return TQVariant( TQCString((const char*)d->mysqlrow[pos], d->lengths[pos]).toInt() ); else if (f->isFPNumericType()) - return QVariant( QCString((const char*)d->mysqlrow[pos], d->lengths[pos]).toDouble() ); + return TQVariant( TQCString((const char*)d->mysqlrow[pos], d->lengths[pos]).toDouble() ); //default - return QVariant(QString::fromUtf8((const char*)d->mysqlrow[pos], d->lengths[pos]));*/ + return TQVariant(TQString::fromUtf8((const char*)d->mysqlrow[pos], d->lengths[pos]));*/ } /* As with sqlite, the DB library returns all values (including numbers) as - strings. So just put that string in a QVariant and let KexiDB deal with it. + strings. So just put that string in a TQVariant and let KexiDB deal with it. */ void MySqlCursor::storeCurrentRow(RowData &data) const { @@ -145,7 +145,7 @@ void MySqlCursor::storeCurrentRow(RowData &data) const data.resize(m_fieldCount); const uint fieldsExpandedCount = m_fieldsExpanded ? m_fieldsExpanded->count() : UINT_MAX; - const uint realCount = QMIN(fieldsExpandedCount, m_fieldCount); + const uint realCount = TQMIN(fieldsExpandedCount, m_fieldCount); for( uint i=0; i<realCount; i++) { Field *f = m_fieldsExpanded ? m_fieldsExpanded->at(i)->field : 0; if (m_fieldsExpanded && !f) @@ -153,7 +153,7 @@ void MySqlCursor::storeCurrentRow(RowData &data) const data[i] = KexiDB::cstringToVariant(d->mysqlrow[i], f, d->lengths[i]); /* moved to cstringToVariant() if (f && f->type()==Field::BLOB) { - QByteArray ba; + TQByteArray ba; ba.duplicate(d->mysqlrow[i], d->lengths[i]); data[i] = ba; KexiDBDbg << data[i].toByteArray().size() << endl; @@ -161,7 +161,7 @@ void MySqlCursor::storeCurrentRow(RowData &data) const //! @todo more types! //! @todo look at what type mysql declares! else { - data[i] = QVariant(QString::fromUtf8((const char*)d->mysqlrow[i], d->lengths[i])); + data[i] = TQVariant(TQString::fromUtf8((const char*)d->mysqlrow[i], d->lengths[i])); }*/ } } @@ -183,7 +183,7 @@ void MySqlCursor::drv_bufferMovePointerPrev() { } -void MySqlCursor::drv_bufferMovePointerTo(Q_LLONG to) { +void MySqlCursor::drv_bufferMovePointerTo(TQ_LLONG to) { //MYSQL_ROW_OFFSET ro=mysql_row_tell(d->mysqlres); mysql_data_seek(d->mysqlres, to); d->mysqlrow=mysql_fetch_row(d->mysqlres); @@ -200,9 +200,9 @@ int MySqlCursor::serverResult() return d->res; } -QString MySqlCursor::serverResultName() +TQString MySqlCursor::serverResultName() { - return QString::null; + return TQString(); } void MySqlCursor::drv_clearServerResult() @@ -212,7 +212,7 @@ void MySqlCursor::drv_clearServerResult() d->res = 0; } -QString MySqlCursor::serverErrorMsg() +TQString MySqlCursor::serverErrorMsg() { return d->errmsg; } diff --git a/kexi/kexidb/drivers/mySQL/mysqlcursor.h b/kexi/kexidb/drivers/mySQL/mysqlcursor.h index 09ace22b..4f48d602 100644 --- a/kexi/kexidb/drivers/mySQL/mysqlcursor.h +++ b/kexi/kexidb/drivers/mySQL/mysqlcursor.h @@ -29,7 +29,7 @@ class MySqlCursorData; class MySqlCursor: public Cursor { public: - MySqlCursor(Connection* conn, const QString& statement = QString::null, uint cursor_options = NoOptions ); + MySqlCursor(Connection* conn, const TQString& statement = TQString(), uint cursor_options = NoOptions ); MySqlCursor(Connection* conn, QuerySchema& query, uint options = NoOptions ); virtual ~MySqlCursor(); virtual bool drv_open(); @@ -37,23 +37,23 @@ public: // virtual bool drv_moveFirst(); virtual void drv_getNextRecord(); //virtual bool drv_getPrevRecord(); - virtual QVariant value(uint); + virtual TQVariant value(uint); virtual void drv_clearServerResult(); virtual void drv_appendCurrentRecordToBuffer(); virtual void drv_bufferMovePointerNext(); virtual void drv_bufferMovePointerPrev(); - virtual void drv_bufferMovePointerTo(Q_LLONG to); + virtual void drv_bufferMovePointerTo(TQ_LLONG to); virtual const char** rowData() const; virtual void storeCurrentRow(RowData &data) const; // virtual bool save(RowData& data, RowEditBuffer& buf); virtual int serverResult(); - virtual QString serverResultName(); - virtual QString serverErrorMsg(); + virtual TQString serverResultName(); + virtual TQString serverErrorMsg(); protected: - QVariant pValue(uint pos) const; + TQVariant pValue(uint pos) const; // MYSQL_RES *m_res; // MYSQL_ROW m_row; // MYSQL *my_conn; diff --git a/kexi/kexidb/drivers/mySQL/mysqldriver.cpp b/kexi/kexidb/drivers/mySQL/mysqldriver.cpp index c27681c0..9a1213b0 100644 --- a/kexi/kexidb/drivers/mySQL/mysqldriver.cpp +++ b/kexi/kexidb/drivers/mySQL/mysqldriver.cpp @@ -19,16 +19,16 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ -#ifdef Q_WS_WIN +#ifdef TQ_WS_WIN # include <mysql/config-win.h> #endif #include <mysql_version.h> #include <mysql.h> #define BOOL bool -#include <qvariant.h> -#include <qfile.h> -#include <qdict.h> +#include <tqvariant.h> +#include <tqfile.h> +#include <tqdict.h> #include <kgenericfactory.h> #include <kdebug.h> @@ -54,7 +54,7 @@ KEXIDB_DRIVER_INFO( MySqlDriver, mysql ) * * See: http://dev.mysql.com/doc/mysql/en/Column_types.html */ -MySqlDriver::MySqlDriver(QObject *parent, const char *name, const QStringList &args) : Driver(parent, name,args) +MySqlDriver::MySqlDriver(TQObject *tqparent, const char *name, const TQStringList &args) : Driver(tqparent, name,args) { // KexiDBDrvDbg << "MySqlDriver::MySqlDriver()" << endl; @@ -63,9 +63,9 @@ MySqlDriver::MySqlDriver(QObject *parent, const char *name, const QStringList &a beh->ROW_ID_FIELD_NAME="LAST_INSERT_ID()"; beh->ROW_ID_FIELD_RETURNS_LAST_AUTOINCREMENTED_VALUE=true; - beh->_1ST_ROW_READ_AHEAD_REQUIRED_TO_KNOW_IF_THE_RESULT_IS_EMPTY=false; - beh->USING_DATABASE_REQUIRED_TO_CONNECT=false; - beh->QUOTATION_MARKS_FOR_IDENTIFIER='`'; + beh->_1ST_ROW_READ_AHEAD_RETQUIRED_TO_KNOW_IF_THE_RESULT_IS_EMPTY=false; + beh->USING_DATABASE_RETQUIRED_TO_CONNECT=false; + beh->TQUOTATION_MARKS_FOR_IDENTIFIER='`'; beh->SQL_KEYWORDS = keywords; initSQLKeywords(331); @@ -103,16 +103,16 @@ MySqlDriver::drv_createConnection( ConnectionData &conn_data ) return new MySqlConnection( this, conn_data ); } -bool MySqlDriver::isSystemDatabaseName(const QString &n) const +bool MySqlDriver::isSystemDatabaseName(const TQString &n) const { return n.lower()=="mysql" || Driver::isSystemObjectName(n); } -bool MySqlDriver::drv_isSystemFieldName(const QString&) const { +bool MySqlDriver::drv_isSystemFieldName(const TQString&) const { return false; } -QString MySqlDriver::escapeString(const QString& str) const +TQString MySqlDriver::escapeString(const TQString& str) const { //escape as in http://dev.mysql.com/doc/refman/5.0/en/string-syntax.html //! @todo support more characters, like %, _ @@ -120,20 +120,20 @@ QString MySqlDriver::escapeString(const QString& str) const const int old_length = str.length(); int i; for ( i = 0; i < old_length; i++ ) { //anything to escape? - const unsigned int ch = str[i].unicode(); + const unsigned int ch = str[i].tqunicode(); if (ch == '\\' || ch == '\'' || ch == '"' || ch == '\n' || ch == '\r' || ch == '\t' || ch == '\b' || ch == '\0') break; } if (i >= old_length) { //no characters to escape - return QString::fromLatin1("'") + str + QString::fromLatin1("'"); + return TQString::tqfromLatin1("'") + str + TQString::tqfromLatin1("'"); } - QChar *new_string = new QChar[ old_length * 3 + 1 ]; // a worst case approximation + TQChar *new_string = new TQChar[ old_length * 3 + 1 ]; // a worst case approximation //! @todo move new_string to Driver::m_new_string or so... int new_length = 0; new_string[new_length++] = '\''; //prepend ' for ( i = 0; i < old_length; i++, new_length++ ) { - const unsigned int ch = str[i].unicode(); + const unsigned int ch = str[i].tqunicode(); if (ch == '\\') { new_string[new_length++] = '\\'; new_string[new_length] = '\\'; @@ -175,37 +175,37 @@ QString MySqlDriver::escapeString(const QString& str) const } new_string[new_length++] = '\''; //append ' - QString result(new_string, new_length); + TQString result(new_string, new_length); delete [] new_string; return result; } -QString MySqlDriver::escapeBLOB(const QByteArray& array) const +TQString MySqlDriver::escapeBLOB(const TQByteArray& array) const { return KexiDB::escapeBLOB(array, KexiDB::BLOBEscape0xHex); } -QCString MySqlDriver::escapeString(const QCString& str) const +TQCString MySqlDriver::escapeString(const TQCString& str) const { //! @todo optimize using mysql_real_escape_string()? //! see http://dev.mysql.com/doc/refman/5.0/en/string-syntax.html - return QCString("'")+QCString(str) - .replace( '\\', "\\\\" ) - .replace( '\'', "\\''" ) - .replace( '"', "\\\"" ) - + QCString("'"); + return TQCString("'")+TQCString(str) + .tqreplace( '\\', "\\\\" ) + .tqreplace( '\'', "\\''" ) + .tqreplace( '"', "\\\"" ) + + TQCString("'"); } /*! Add back-ticks to an identifier, and replace any back-ticks within * the name with single quotes. */ -QString MySqlDriver::drv_escapeIdentifier( const QString& str) const { - return QString(str).replace('`', "'"); +TQString MySqlDriver::drv_escapeIdentifier( const TQString& str) const { + return TQString(str).tqreplace('`', "'"); } -QCString MySqlDriver::drv_escapeIdentifier( const QCString& str) const { - return QCString(str).replace('`', "'"); +TQCString MySqlDriver::drv_escapeIdentifier( const TQCString& str) const { + return TQCString(str).tqreplace('`', "'"); } #include "mysqldriver.moc" diff --git a/kexi/kexidb/drivers/mySQL/mysqldriver.h b/kexi/kexidb/drivers/mySQL/mysqldriver.h index 8282e215..7e6d5a35 100644 --- a/kexi/kexidb/drivers/mySQL/mysqldriver.h +++ b/kexi/kexidb/drivers/mySQL/mysqldriver.h @@ -30,26 +30,27 @@ namespace KexiDB { class MySqlDriver : public Driver { Q_OBJECT + TQ_OBJECT KEXIDB_DRIVER public: - MySqlDriver(QObject *parent, const char *name, const QStringList &args=QStringList()); + MySqlDriver(TQObject *tqparent, const char *name, const TQStringList &args=TQStringList()); virtual ~MySqlDriver(); - virtual bool isSystemDatabaseName( const QString &n ) const; + virtual bool isSystemDatabaseName( const TQString &n ) const; //! Escape a string for use as a value - virtual QString escapeString(const QString& str) const; - virtual QCString escapeString(const QCString& str) const; + virtual TQString escapeString(const TQString& str) const; + virtual TQCString escapeString(const TQCString& str) const; //! Escape BLOB value \a array - virtual QString escapeBLOB(const QByteArray& array) const; + virtual TQString escapeBLOB(const TQByteArray& array) const; protected: - virtual QString drv_escapeIdentifier( const QString& str) const; - virtual QCString drv_escapeIdentifier( const QCString& str) const; + virtual TQString drv_escapeIdentifier( const TQString& str) const; + virtual TQCString drv_escapeIdentifier( const TQCString& str) const; virtual Connection *drv_createConnection( ConnectionData &conn_data ); - virtual bool drv_isSystemFieldName( const QString& n ) const; + virtual bool drv_isSystemFieldName( const TQString& n ) const; private: static const char *keywords[]; diff --git a/kexi/kexidb/drivers/mySQL/mysqlkeywords.cpp b/kexi/kexidb/drivers/mySQL/mysqlkeywords.cpp index e06adb5e..89dd8d77 100644 --- a/kexi/kexidb/drivers/mySQL/mysqlkeywords.cpp +++ b/kexi/kexidb/drivers/mySQL/mysqlkeywords.cpp @@ -177,7 +177,7 @@ namespace KexiDB { "MASTER_SSL_KEY", "MASTER_USER", "MAX_CONNECTIONS_PER_HOUR", - "MAX_QUERIES_PER_HOUR", + "MAX_TQUERIES_PER_HOUR", "MAX_ROWS", "MAX_UPDATES_PER_HOUR", "MEDIUM", @@ -229,8 +229,8 @@ namespace KexiDB { "PROCESS", "PROCESSLIST", "PURGE", - "QUERY", - "QUICK", + "TQUERY", + "TQUICK", "RAID0", "RAID_CHUNKS", "RAID_CHUNKSIZE", @@ -246,7 +246,7 @@ namespace KexiDB { "REPAIR", "REPEATABLE", "REPLICATION", - "REQUIRE", + "RETQUIRE", "RESET", "RESTORE", "RETURNS", diff --git a/kexi/kexidb/drivers/mySQL/mysqlpreparedstatement.cpp b/kexi/kexidb/drivers/mySQL/mysqlpreparedstatement.cpp index 2702626a..7b245d9a 100644 --- a/kexi/kexidb/drivers/mySQL/mysqlpreparedstatement.cpp +++ b/kexi/kexidb/drivers/mySQL/mysqlpreparedstatement.cpp @@ -143,7 +143,7 @@ bool MySqlPreparedStatement::execute() else assert(0); //impl. error - for (QValueListConstIterator<QVariant> it = m_args.constBegin(); + for (TQValueListConstIterator<TQVariant> it = m_args.constBegin(); (field = itFields.current()) && arg < m_realParamCount; ++it, ++itFields, arg++) { if (it==m_args.constEnd() || (*it).isNull()) {//no value to bind or the value is null: bind NULL @@ -201,7 +201,7 @@ m_stringBuffer[ 1024 ]; ??? { //! @todo what about unsigned > LLONG_MAX ? bool ok; - Q_LLONG value = (*it).toLongLong(&ok); + TQ_LLONG value = (*it).toLongLong(&ok); if (ok) { res = sqlite3_bind_int64(prepared_st_handle, arg, value); if (SQLITE_OK != res) { @@ -220,7 +220,7 @@ m_stringBuffer[ 1024 ]; ??? } case KexiDB::Field::Boolean: res = sqlite3_bind_text(prepared_st_handle, arg, - QString::number((*it).toBool() ? 1 : 0).latin1(), + TQString::number((*it).toBool() ? 1 : 0).latin1(), 1, SQLITE_TRANSIENT /*??*/); if (SQLITE_OK != res) { //! @todo msg? @@ -256,7 +256,7 @@ m_stringBuffer[ 1024 ]; ??? break; case KexiDB::Field::BLOB: { - const QByteArray byteArray((*it).toByteArray()); + const TQByteArray byteArray((*it).toByteArray()); res = sqlite3_bind_blob(prepared_st_handle, arg, (const char*)byteArray, byteArray.size(), SQLITE_TRANSIENT /*??*/); if (SQLITE_OK != res) { diff --git a/kexi/kexidb/drivers/mySQL/mysqlpreparedstatement.h b/kexi/kexidb/drivers/mySQL/mysqlpreparedstatement.h index 01478e9e..14601a8b 100644 --- a/kexi/kexidb/drivers/mySQL/mysqlpreparedstatement.h +++ b/kexi/kexidb/drivers/mySQL/mysqlpreparedstatement.h @@ -39,7 +39,7 @@ class MySqlPreparedStatement : public PreparedStatement, public MySqlConnectionI virtual bool execute(); - QCString m_tempStatementString; + TQCString m_tempStatementString; #ifdef KEXI_USE_MYSQL_STMT int m_realParamCount; diff --git a/kexi/kexidb/drivers/odbc/odbcconnection.cpp b/kexi/kexidb/drivers/odbc/odbcconnection.cpp index ec5a7cdf..3ac6f082 100644 --- a/kexi/kexidb/drivers/odbc/odbcconnection.cpp +++ b/kexi/kexidb/drivers/odbc/odbcconnection.cpp @@ -23,8 +23,8 @@ #include <sqltypes.h> //QT Includes -#include <qfile.h> -#include <qdir.h> +#include <tqfile.h> +#include <tqdir.h> //KDE Includes #include <kgenericfactory.h> @@ -45,7 +45,7 @@ class ODBCConnectionPrivate { public: ConnectionData connData; - QString currentDB; + TQString currentDB; SQLHENV envHandle; SQLHDBC connectionHandle; }; @@ -57,19 +57,19 @@ ODBCConnection::ODBCConnection( Driver *driver, ConnectionData &conn_data ) //d->connData = conn_data; } -Cursor* ODBCConnection::prepareQuery(const QString& statement, uint cursor_options) +Cursor* ODBCConnection::prepareQuery(const TQString& statement, uint cursor_options) { Q_UNUSED( statement ); Q_UNUSED( cursor_options ); return 0; } -QString ODBCConnection::escapeString(const QString& str) const +TQString ODBCConnection::escapeString(const TQString& str) const { return str; } -QCString ODBCConnection::escapeString(const QCString& str) const +TQCString ODBCConnection::escapeString(const TQCString& str) const { return str; } @@ -112,17 +112,17 @@ bool ODBCConnection::drv_disconnect() return true; } -bool ODBCConnection::drv_getDatabasesList(QStringList &) +bool ODBCConnection::drv_getDatabasesList(TQStringList &) { return false; } -bool ODBCConnection::drv_createDatabase(const QString &) +bool ODBCConnection::drv_createDatabase(const TQString &) { return false; } -bool ODBCConnection::drv_useDatabase(const QString &) +bool ODBCConnection::drv_useDatabase(const TQString &) { return false; } @@ -132,12 +132,12 @@ bool ODBCConnection::drv_closeDatabase() return false; } -bool ODBCConnection::drv_dropDatabase(const QString &) +bool ODBCConnection::drv_dropDatabase(const TQString &) { return false; } -bool ODBCConnection::drv_executeSQL(const QString &) +bool ODBCConnection::drv_executeSQL(const TQString &) { return false; } diff --git a/kexi/kexidb/drivers/odbc/odbcconnection.h b/kexi/kexidb/drivers/odbc/odbcconnection.h index 8f551905..128eab61 100644 --- a/kexi/kexidb/drivers/odbc/odbcconnection.h +++ b/kexi/kexidb/drivers/odbc/odbcconnection.h @@ -20,7 +20,7 @@ #ifndef KEXIDB_CONN_ODBC_H #define KEXIDB_CONN_ODBC_H -#include <qstringlist.h> +#include <tqstringlist.h> #include <kexidb/connection.h> #include <kexidb/tableschema.h> @@ -39,13 +39,14 @@ class Driver; class ODBCConnection : public Connection { Q_OBJECT + TQ_OBJECT public: ~ODBCConnection(); - virtual Cursor* prepareQuery( const QString& statement = QString::null, uint cursor_options = 0 ); - virtual QString escapeString(const QString& str) const; - virtual QCString escapeString(const QCString& str) const; + virtual Cursor* prepareQuery( const TQString& statement = TQString(), uint cursor_options = 0 ); + virtual TQString escapeString(const TQString& str) const; + virtual TQCString escapeString(const TQCString& str) const; protected: /*! Used by driver */ @@ -55,29 +56,29 @@ class ODBCConnection : public Connection virtual bool drv_disconnect(); - virtual bool drv_getDatabasesList( QStringList &list ); + virtual bool drv_getDatabasesList( TQStringList &list ); /*! Creates new database using connection. Note: Do not pass \a dbName arg because for file-based engine (that has one database per connection) it is defined during connection. */ - virtual bool drv_createDatabase( const QString &dbName = QString::null ); + virtual bool drv_createDatabase( const TQString &dbName = TQString() ); /*! Opens existing database using connection. Do not pass \a dbName arg because for file-based engine (that has one database per connection) it is defined during connection. If you pass it, database file name will be changed. */ - virtual bool drv_useDatabase( const QString &dbName = QString::null ); + virtual bool drv_useDatabase( const TQString &dbName = TQString() ); virtual bool drv_closeDatabase(); /*! Drops database from the server using connection. After drop, database shouldn't be accessible anymore, so database file is just removed. See note from drv_useDatabase(). */ - virtual bool drv_dropDatabase( const QString &dbName = QString::null ); + virtual bool drv_dropDatabase( const TQString &dbName = TQString() ); //virtual bool drv_createTable( const KexiDB::Table& table ); - virtual bool drv_executeSQL( const QString& statement ); + virtual bool drv_executeSQL( const TQString& statement ); friend class ODBCDriver; diff --git a/kexi/kexidb/drivers/odbc/odbcdriver.cpp b/kexi/kexidb/drivers/odbc/odbcdriver.cpp index aac6a6c9..38e0796e 100644 --- a/kexi/kexidb/drivers/odbc/odbcdriver.cpp +++ b/kexi/kexidb/drivers/odbc/odbcdriver.cpp @@ -18,10 +18,10 @@ */ //QT Includes -#include <qfile.h> -#include <qdir.h> -#include <qstring.h> -#include <qcstring.h> +#include <tqfile.h> +#include <tqdir.h> +#include <tqstring.h> +#include <tqcstring.h> //KDE Includes #include <kdebug.h> @@ -39,8 +39,8 @@ using namespace KexiDB; KEXIDB_DRIVER_INFO( ODBCDriver, odbc ) -ODBCDriver::ODBCDriver( QObject *parent, const char *name, const QStringList &args ) - : Driver( parent, name, args ) +ODBCDriver::ODBCDriver( TQObject *tqparent, const char *name, const TQStringList &args ) + : Driver( tqparent, name, args ) { d->isFileDriver = false; d->isDBOpenedAfterCreate = true; @@ -76,30 +76,30 @@ KexiDB::Connection* ODBCDriver::drv_createConnection( ConnectionData &conn_data //return new ODBCConnection( this, conn_data ); } -bool ODBCDriver::isSystemDatabaseName( const QString& name ) const +bool ODBCDriver::isSystemDatabaseName( const TQString& name ) const { Q_UNUSED( name ); return false; } -bool ODBCDriver::isSystemObjectName( const QString& name ) +bool ODBCDriver::isSystemObjectName( const TQString& name ) { Q_UNUSED( name ); return false; } -bool ODBCDriver::isSystemFieldName( const QString& name ) const +bool ODBCDriver::isSystemFieldName( const TQString& name ) const { Q_UNUSED( name ); return false; } -QString ODBCDriver::escapeString( const QString& str ) const +TQString ODBCDriver::escapeString( const TQString& str ) const { return str; } -QCString ODBCDriver::escapeString( const QCString& str ) const +TQCString ODBCDriver::escapeString( const TQCString& str ) const { return str; } diff --git a/kexi/kexidb/drivers/odbc/odbcdriver.h b/kexi/kexidb/drivers/odbc/odbcdriver.h index 60681f21..c26af43f 100644 --- a/kexi/kexidb/drivers/odbc/odbcdriver.h +++ b/kexi/kexidb/drivers/odbc/odbcdriver.h @@ -23,8 +23,8 @@ //Kexi Includes #include <kexidb/driver.h> -class QCString; -class QString; +class TQCString; +class TQString; namespace KexiDB { @@ -41,27 +41,28 @@ class ODBCDriverPrivate; class ODBCDriver : public Driver { Q_OBJECT + TQ_OBJECT KEXIDB_DRIVER public: - ODBCDriver( QObject *parent, const char *name, const QStringList &args = QStringList() ); + ODBCDriver( TQObject *tqparent, const char *name, const TQStringList &args = TQStringList() ); ~ODBCDriver(); - virtual bool isSystemDatabaseName( const QString& name ) const; + virtual bool isSystemDatabaseName( const TQString& name ) const; /** \return true if n is a system object name; * \todo Find out what is a system object name and what isn't */ - virtual bool isSystemObjectName( const QString& name ); + virtual bool isSystemObjectName( const TQString& name ); /** * \return true if \a n is a system field name; * There aren't any system fields per tables, unless the table * is a system table */ - virtual bool isSystemFieldName( const QString& name ) const; + virtual bool isSystemFieldName( const TQString& name ) const; - virtual QString escapeString( const QString& str ) const; - virtual QCString escapeString( const QCString& str ) const; + virtual TQString escapeString( const TQString& str ) const; + virtual TQCString escapeString( const TQCString& str ) const; protected: virtual Connection *drv_createConnection( ConnectionData &conn_data ); diff --git a/kexi/kexidb/drivers/pqxx/pqxxconnection.cpp b/kexi/kexidb/drivers/pqxx/pqxxconnection.cpp index 8465bcf4..c81f04ad 100644 --- a/kexi/kexidb/drivers/pqxx/pqxxconnection.cpp +++ b/kexi/kexidb/drivers/pqxx/pqxxconnection.cpp @@ -18,8 +18,8 @@ */ #include "pqxxconnection.h" -#include <qvariant.h> -#include <qfile.h> +#include <tqvariant.h> +#include <tqfile.h> #include <kdebug.h> #include <kexidb/error.h> #include <kexidb/global.h> @@ -70,7 +70,7 @@ pqxxSqlConnection::~pqxxSqlConnection() //================================================================================== //Return a new query based on a query statment -Cursor* pqxxSqlConnection::prepareQuery( const QString& statement, uint cursor_options) +Cursor* pqxxSqlConnection::prepareQuery( const TQString& statement, uint cursor_options) { Q_UNUSED(cursor_options); return new pqxxSqlCursor(this, statement, 1); //Always used buffered cursor @@ -86,9 +86,9 @@ Cursor* pqxxSqlConnection::prepareQuery( QuerySchema& query, uint cursor_options //================================================================================== //Properly escaped a database object name -QString pqxxSqlConnection::escapeName(const QString &name) const +TQString pqxxSqlConnection::escapeName(const TQString &name) const { - return QString("\"" + name + "\""); + return TQString("\"" + name + "\""); } //================================================================================== @@ -116,7 +116,7 @@ bool pqxxSqlConnection::drv_disconnect() //================================================================================== //Return a list of database names -bool pqxxSqlConnection::drv_getDatabasesList( QStringList &list ) +bool pqxxSqlConnection::drv_getDatabasesList( TQStringList &list ) { // KexiDBDrvDbg << "pqxxSqlConnection::drv_getDatabaseList" << endl; @@ -128,7 +128,7 @@ bool pqxxSqlConnection::drv_getDatabasesList( QStringList &list ) // Read value of column 0 into a string N c[0].to(N); // Copy the result into the return list - list << QString::fromLatin1 (N.c_str()); + list << TQString::tqfromLatin1 (N.c_str()); } return true; } @@ -138,7 +138,7 @@ bool pqxxSqlConnection::drv_getDatabasesList( QStringList &list ) //================================================================================== //Create a new database -bool pqxxSqlConnection::drv_createDatabase( const QString &dbName ) +bool pqxxSqlConnection::drv_createDatabase( const TQString &dbName ) { KexiDBDrvDbg << "pqxxSqlConnection::drv_createDatabase: " << dbName << endl; @@ -150,16 +150,16 @@ bool pqxxSqlConnection::drv_createDatabase( const QString &dbName ) //================================================================================== //Use this as our connection instead of connect -bool pqxxSqlConnection::drv_useDatabase( const QString &dbName, bool *cancelled, +bool pqxxSqlConnection::drv_useDatabase( const TQString &dbName, bool *cancelled, MessageHandler* msgHandler ) { Q_UNUSED(cancelled); Q_UNUSED(msgHandler); KexiDBDrvDbg << "pqxxSqlConnection::drv_useDatabase: " << dbName << endl; - QString conninfo; - QString socket; - QStringList sockets; + TQString conninfo; + TQString socket; + TQStringList sockets; if (data()->hostName.isEmpty() || data()->hostName == "localhost") { @@ -167,9 +167,9 @@ bool pqxxSqlConnection::drv_useDatabase( const QString &dbName, bool *cancelled, { sockets.append("/tmp/.s.PGSQL.5432"); - for(QStringList::ConstIterator it = sockets.constBegin(); it != sockets.constEnd(); it++) + for(TQStringList::ConstIterator it = sockets.constBegin(); it != sockets.constEnd(); it++) { - if(QFile(*it).exists()) + if(TQFile(*it).exists()) { socket = (*it); break; @@ -190,15 +190,15 @@ bool pqxxSqlConnection::drv_useDatabase( const QString &dbName, bool *cancelled, if (data()->port == 0) data()->port = 5432; - conninfo += QString::fromLatin1(" port='%1'").arg(data()->port); + conninfo += TQString::tqfromLatin1(" port='%1'").tqarg(data()->port); - conninfo += QString::fromLatin1(" dbname='%1'").arg(dbName); + conninfo += TQString::tqfromLatin1(" dbname='%1'").tqarg(dbName); if (!data()->userName.isNull()) - conninfo += QString::fromLatin1(" user='%1'").arg(data()->userName); + conninfo += TQString::tqfromLatin1(" user='%1'").tqarg(data()->userName); if (!data()->password.isNull()) - conninfo += QString::fromLatin1(" password='%1'").arg(data()->password); + conninfo += TQString::tqfromLatin1(" password='%1'").tqarg(data()->password); try { @@ -213,7 +213,7 @@ bool pqxxSqlConnection::drv_useDatabase( const QString &dbName, bool *cancelled, catch(const std::exception &e) { KexiDBDrvDbg << "pqxxSqlConnection::drv_useDatabase:exception - " << e.what() << endl; - d->errmsg = QString::fromUtf8( e.what() ); + d->errmsg = TQString::fromUtf8( e.what() ); } catch(...) @@ -244,7 +244,7 @@ bool pqxxSqlConnection::drv_closeDatabase() //================================================================================== //Drops the given database -bool pqxxSqlConnection::drv_dropDatabase( const QString &dbName ) +bool pqxxSqlConnection::drv_dropDatabase( const TQString &dbName ) { KexiDBDrvDbg << "pqxxSqlConnection::drv_dropDatabase: " << dbName << endl; @@ -257,7 +257,7 @@ bool pqxxSqlConnection::drv_dropDatabase( const QString &dbName ) //================================================================================== //Execute an SQL statement -bool pqxxSqlConnection::drv_executeSQL( const QString& statement ) +bool pqxxSqlConnection::drv_executeSQL( const TQString& statement ) { // KexiDBDrvDbg << "pqxxSqlConnection::drv_executeSQL: " << statement << endl; bool ok = false; @@ -299,7 +299,7 @@ bool pqxxSqlConnection::drv_executeSQL( const QString& statement ) catch (const std::exception &e) { //If an error ocurred then put the error description into _dbError - d->errmsg = QString::fromUtf8( e.what() ); + d->errmsg = TQString::fromUtf8( e.what() ); KexiDBDrvDbg << "pqxxSqlConnection::drv_executeSQL:exception - " << e.what() << endl; } catch(...) @@ -323,7 +323,7 @@ bool pqxxSqlConnection::drv_isDatabaseUsed() const //================================================================================== //Return the oid of the last insert - only works if sql was insert of 1 row -Q_ULLONG pqxxSqlConnection::drv_lastInsertRowID() +TQ_ULLONG pqxxSqlConnection::drv_lastInsertRowID() { if (d->res) { @@ -331,7 +331,7 @@ Q_ULLONG pqxxSqlConnection::drv_lastInsertRowID() if (theOid != pqxx::oid_none) { - return (Q_ULLONG)theOid; + return (TQ_ULLONG)theOid; } else { @@ -342,14 +342,14 @@ Q_ULLONG pqxxSqlConnection::drv_lastInsertRowID() } //<queries taken from pqxxMigrate> -bool pqxxSqlConnection::drv_containsTable( const QString &tableName ) +bool pqxxSqlConnection::drv_containsTable( const TQString &tableName ) { bool success; - return resultExists(QString("select 1 from pg_class where relkind='r' and relname LIKE %1") - .arg(driver()->escapeString(tableName)), success) && success; + return resultExists(TQString("select 1 from pg_class where relkind='r' and relname LIKE %1") + .tqarg(driver()->escapeString(tableName)), success) && success; } -bool pqxxSqlConnection::drv_getTablesList( QStringList &list ) +bool pqxxSqlConnection::drv_getTablesList( TQStringList &list ) { KexiDB::Cursor *cursor; m_sql = "select lower(relname) from pg_class where relkind='r'"; @@ -385,7 +385,7 @@ bool pqxxSqlConnection::drv_commitTransaction(TransactionData *tdata) catch (const std::exception &e) { //If an error ocurred then put the error description into _dbError - d->errmsg = QString::fromUtf8( e.what() ); + d->errmsg = TQString::fromUtf8( e.what() ); result = false; } catch (...) { @@ -407,7 +407,7 @@ bool pqxxSqlConnection::drv_rollbackTransaction(TransactionData *tdata) catch (const std::exception &e) { //If an error ocurred then put the error description into _dbError - d->errmsg = QString::fromUtf8( e.what() ); + d->errmsg = TQString::fromUtf8( e.what() ); result = false; } @@ -425,9 +425,9 @@ int pqxxSqlConnection::serverResult() return d->resultCode; } -QString pqxxSqlConnection::serverResultName() +TQString pqxxSqlConnection::serverResultName() { - return QString::null; + return TQString(); } void pqxxSqlConnection::drv_clearServerResult() @@ -435,7 +435,7 @@ void pqxxSqlConnection::drv_clearServerResult() d->resultCode = 0; } -QString pqxxSqlConnection::serverErrorMsg() +TQString pqxxSqlConnection::serverErrorMsg() { return d->errmsg; } diff --git a/kexi/kexidb/drivers/pqxx/pqxxconnection.h b/kexi/kexidb/drivers/pqxx/pqxxconnection.h index 85bed42a..7e7cdf69 100644 --- a/kexi/kexidb/drivers/pqxx/pqxxconnection.h +++ b/kexi/kexidb/drivers/pqxx/pqxxconnection.h @@ -17,10 +17,10 @@ * Boston, MA 02110-1301, USA. */ -#ifndef PQXXCONNECTION_H -#define PQXXCONNECTION_H +#ifndef PTQXXCONNECTION_H +#define PTQXXCONNECTION_H -#include <qstringlist.h> +#include <tqstringlist.h> #include <kexidb/connection.h> #include "pqxxcursor.h" @@ -48,11 +48,12 @@ class pqxxTransactionData : public TransactionData class pqxxSqlConnection : public Connection { Q_OBJECT + TQ_OBJECT public: virtual ~pqxxSqlConnection(); - virtual Cursor* prepareQuery( const QString& statement = QString::null, uint cursor_options = 0 ); + virtual Cursor* prepareQuery( const TQString& statement = TQString(), uint cursor_options = 0 ); virtual Cursor* prepareQuery( QuerySchema& query, uint cursor_options = 0 ); virtual PreparedStatement::Ptr prepareStatement(PreparedStatement::StatementType type, FieldList& fields); @@ -63,19 +64,19 @@ class pqxxSqlConnection : public Connection virtual bool drv_isDatabaseUsed() const; virtual bool drv_connect(KexiDB::ServerVersionInfo& version); virtual bool drv_disconnect(); - virtual bool drv_getDatabasesList( QStringList &list ); - virtual bool drv_createDatabase( const QString &dbName = QString::null ); - virtual bool drv_useDatabase( const QString &dbName = QString::null, bool *cancelled = 0, + virtual bool drv_getDatabasesList( TQStringList &list ); + virtual bool drv_createDatabase( const TQString &dbName = TQString() ); + virtual bool drv_useDatabase( const TQString &dbName = TQString(), bool *cancelled = 0, MessageHandler* msgHandler = 0 ); virtual bool drv_closeDatabase(); - virtual bool drv_dropDatabase( const QString &dbName = QString::null ); - virtual bool drv_executeSQL( const QString& statement ); - virtual Q_ULLONG drv_lastInsertRowID(); + virtual bool drv_dropDatabase( const TQString &dbName = TQString() ); + virtual bool drv_executeSQL( const TQString& statement ); + virtual TQ_ULLONG drv_lastInsertRowID(); //TODO: move this somewhere to low level class (MIGRATION?) - virtual bool drv_getTablesList( QStringList &list ); + virtual bool drv_getTablesList( TQStringList &list ); //TODO: move this somewhere to low level class (MIGRATION?) - virtual bool drv_containsTable( const QString &tableName ); + virtual bool drv_containsTable( const TQString &tableName ); virtual TransactionData* drv_beginTransaction(); virtual bool drv_commitTransaction(TransactionData *); @@ -83,13 +84,13 @@ class pqxxSqlConnection : public Connection //Error reporting virtual int serverResult(); - virtual QString serverResultName(); + virtual TQString serverResultName(); virtual void drv_clearServerResult(); - virtual QString serverErrorMsg(); + virtual TQString serverErrorMsg(); pqxxSqlConnectionInternal *d; private: - QString escapeName(const QString &tn) const; + TQString escapeName(const TQString &tn) const; // pqxx::transaction_base* m_trans; //! temporary solution for executeSQL()... pqxxTransactionData *m_trans; diff --git a/kexi/kexidb/drivers/pqxx/pqxxconnection_p.h b/kexi/kexidb/drivers/pqxx/pqxxconnection_p.h index 0c78e583..2d33e410 100644 --- a/kexi/kexidb/drivers/pqxx/pqxxconnection_p.h +++ b/kexi/kexidb/drivers/pqxx/pqxxconnection_p.h @@ -27,8 +27,8 @@ // Copyright: See COPYING file that comes with this distribution // // -#ifndef PQXXSQLCONNECTIONINTERNAL_H -#define PQXXSQLCONNECTIONINTERNAL_H +#ifndef PTQXXSQLCONNECTIONINTERNAL_H +#define PTQXXSQLCONNECTIONINTERNAL_H #include <kexidb/connection_p.h> #include <pqxx/pqxx> @@ -56,7 +56,7 @@ class pqxxSqlConnectionInternal : public ConnectionInternal KexiDB::ServerVersionInfo *version; //!< this is set in drv_connect(), so we can use it in drv_useDatabase() //!< because pgsql really connects after "USE". - QString errmsg; //!< server-specific message of last operation + TQString errmsg; //!< server-specific message of last operation int resultCode; //!< result code of last operation on server }; } diff --git a/kexi/kexidb/drivers/pqxx/pqxxcursor.cpp b/kexi/kexidb/drivers/pqxx/pqxxcursor.cpp index 0004cf92..afcad047 100644 --- a/kexi/kexidb/drivers/pqxx/pqxxcursor.cpp +++ b/kexi/kexidb/drivers/pqxx/pqxxcursor.cpp @@ -34,17 +34,17 @@ using namespace KexiDB; unsigned int pqxxSqlCursor_trans_num=0; //!< debug helper -static QByteArray pgsqlByteaToByteArray(const pqxx::result::field& r) +static TQByteArray pgsqlByteaToByteArray(const pqxx::result::field& r) { return KexiDB::pgsqlByteaToByteArray(r.c_str(), r.size()); } //================================================================================== //Constructor based on query statement -pqxxSqlCursor::pqxxSqlCursor(KexiDB::Connection* conn, const QString& statement, uint options): +pqxxSqlCursor::pqxxSqlCursor(KexiDB::Connection* conn, const TQString& statement, uint options): Cursor(conn,statement, options) { -// KexiDBDrvDbg << "PQXXSQLCURSOR: constructor for query statement" << endl; +// KexiDBDrvDbg << "PTQXXSQLCURSOR: constructor for query statement" << endl; my_conn = static_cast<pqxxSqlConnection*>(conn)->d->pqxxsql; m_options = Buffered; m_res = 0; @@ -57,7 +57,7 @@ pqxxSqlCursor::pqxxSqlCursor(KexiDB::Connection* conn, const QString& statement, pqxxSqlCursor::pqxxSqlCursor(Connection* conn, QuerySchema& query, uint options ) : Cursor( conn, query, options ) { -// KexiDBDrvDbg << "PQXXSQLCURSOR: constructor for query schema" << endl; +// KexiDBDrvDbg << "PTQXXSQLCURSOR: constructor for query schema" << endl; my_conn = static_cast<pqxxSqlConnection*>(conn)->d->pqxxsql; m_options = Buffered; m_res = 0; @@ -86,7 +86,7 @@ bool pqxxSqlCursor::drv_open() return false; } - QCString cur_name; + TQCString cur_name; //Set up a transaction try { @@ -117,8 +117,8 @@ bool pqxxSqlCursor::drv_open() } catch (const std::exception &e) { - setError(ERR_DB_SPECIFIC, QString::fromUtf8( e.what()) ); - KexiDBDrvWarn << "pqxxSqlCursor::drv_open:exception - " << QString::fromUtf8( e.what() ) << endl; + setError(ERR_DB_SPECIFIC, TQString::fromUtf8( e.what()) ); + KexiDBDrvWarn << "pqxxSqlCursor::drv_open:exception - " << TQString::fromUtf8( e.what() ) << endl; } catch(...) { @@ -193,31 +193,31 @@ void pqxxSqlCursor::drv_getPrevRecord() //================================================================================== //Return the value for a given column for the current record -QVariant pqxxSqlCursor::value(uint pos) +TQVariant pqxxSqlCursor::value(uint pos) { if (pos < m_fieldCount) return pValue(pos); else - return QVariant(); + return TQVariant(); } //================================================================================== //Return the value for a given column for the current record - Private const version -QVariant pqxxSqlCursor::pValue(uint pos)const +TQVariant pqxxSqlCursor::pValue(uint pos)const { if (m_res->size() <= 0) { KexiDBDrvWarn << "pqxxSqlCursor::value - ERROR: result size not greater than 0" << endl; - return QVariant(); + return TQVariant(); } if (pos>=(m_fieldCount+(m_containsROWIDInfo ? 1 : 0))) { // KexiDBDrvWarn << "pqxxSqlCursor::value - ERROR: requested position is greater than the number of fields" << endl; - return QVariant(); + return TQVariant(); } - KexiDB::Field *f = (m_fieldsExpanded && pos<QMIN(m_fieldsExpanded->count(), m_fieldCount)) + KexiDB::Field *f = (m_fieldsExpanded && pos<TQMIN(m_fieldsExpanded->count(), m_fieldCount)) ? m_fieldsExpanded->at(pos)->field : 0; // KexiDBDrvDbg << "pqxxSqlCursor::value(" << pos << ")" << endl; @@ -231,7 +231,7 @@ QVariant pqxxSqlCursor::pValue(uint pos)const } else if (f->isTextType()) { - return QString::fromUtf8((*m_res)[at()][pos].c_str()); //utf8? + return TQString::fromUtf8((*m_res)[at()][pos].c_str()); //utf8? } else if (f->isFPNumericType()) { @@ -249,7 +249,7 @@ QVariant pqxxSqlCursor::pValue(uint pos)const return pgsqlCStrToVariant((*m_res)[at()][pos]); } - return QString::fromUtf8((*m_res)[at()][pos].c_str(), (*m_res)[at()][pos].size()); //utf8? + return TQString::fromUtf8((*m_res)[at()][pos].c_str(), (*m_res)[at()][pos].size()); //utf8? } //================================================================================== @@ -332,7 +332,7 @@ void pqxxSqlCursor::drv_bufferMovePointerPrev() //================================================================================== //Move internal pointer to internal buffer to N //Implementation required but no need in this driver -void pqxxSqlCursor::drv_bufferMovePointerTo(Q_LLONG to) +void pqxxSqlCursor::drv_bufferMovePointerTo(TQ_LLONG to) { Q_UNUSED(to); } diff --git a/kexi/kexidb/drivers/pqxx/pqxxcursor.h b/kexi/kexidb/drivers/pqxx/pqxxcursor.h index d596acca..637a33f3 100644 --- a/kexi/kexidb/drivers/pqxx/pqxxcursor.h +++ b/kexi/kexidb/drivers/pqxx/pqxxcursor.h @@ -17,8 +17,8 @@ * Boston, MA 02110-1301, USA. */ -#ifndef KEXIDB_CURSOR_PQXX_H -#define KEXIDB_CURSOR_PQXX_H +#ifndef KEXIDB_CURSOR_PTQXX_H +#define KEXIDB_CURSOR_PTQXX_H #include <kexidb/cursor.h> #include <kexidb/connection.h> @@ -39,7 +39,7 @@ class pqxxSqlCursor: public Cursor { public: virtual ~pqxxSqlCursor(); - virtual QVariant value(uint i); + virtual TQVariant value(uint i); virtual const char** rowData() const; virtual void storeCurrentRow(RowData &data) const; @@ -47,18 +47,18 @@ public: //TODO virtual int serverResult() const; -//TODO virtual QString serverResultName() const; +//TODO virtual TQString serverResultName() const; -//TODO virtual QString serverErrorMsg() const; +//TODO virtual TQString serverErrorMsg() const; protected: - pqxxSqlCursor(Connection* conn, const QString& statement = QString::null, uint options = NoOptions ); + pqxxSqlCursor(Connection* conn, const TQString& statement = TQString(), uint options = NoOptions ); pqxxSqlCursor(Connection* conn, QuerySchema& query, uint options = NoOptions ); virtual void drv_clearServerResult(); virtual void drv_appendCurrentRecordToBuffer(); virtual void drv_bufferMovePointerNext(); virtual void drv_bufferMovePointerPrev(); - virtual void drv_bufferMovePointerTo(Q_LLONG to); + virtual void drv_bufferMovePointerTo(TQ_LLONG to); virtual bool drv_open(); virtual bool drv_close(); virtual void drv_getNextRecord(); @@ -68,18 +68,18 @@ private: pqxx::result* m_res; // pqxx::nontransaction* m_tran; pqxx::connection* my_conn; - QVariant pValue(uint pos)const; + TQVariant pValue(uint pos)const; bool m_implicityStarted : 1; - //QByteArray processBinaryData(pqxx::binarystring*) const; + //TQByteArray processBinaryData(pqxx::binarystring*) const; friend class pqxxSqlConnection; }; -inline QVariant pgsqlCStrToVariant(const pqxx::result::field& r) +inline TQVariant pgsqlCStrToVariant(const pqxx::result::field& r) { switch(r.type()) { case BOOLOID: - return QString::fromLatin1(r.c_str(), r.size())=="true"; //TODO check formatting + return TQString::tqfromLatin1(r.c_str(), r.size())=="true"; //TODO check formatting case INT2OID: case INT4OID: case INT8OID: @@ -89,19 +89,19 @@ inline QVariant pgsqlCStrToVariant(const pqxx::result::field& r) case NUMERICOID: return r.as(double()); case DATEOID: - return QString::fromUtf8(r.c_str(), r.size()); //TODO check formatting + return TQString::fromUtf8(r.c_str(), r.size()); //TODO check formatting case TIMEOID: - return QString::fromUtf8(r.c_str(), r.size()); //TODO check formatting + return TQString::fromUtf8(r.c_str(), r.size()); //TODO check formatting case TIMESTAMPOID: - return QString::fromUtf8(r.c_str(), r.size()); //TODO check formatting + return TQString::fromUtf8(r.c_str(), r.size()); //TODO check formatting case BYTEAOID: return KexiDB::pgsqlByteaToByteArray(r.c_str(), r.size()); case BPCHAROID: case VARCHAROID: case TEXTOID: - return QString::fromUtf8(r.c_str(), r.size()); //utf8? + return TQString::fromUtf8(r.c_str(), r.size()); //utf8? default: - return QString::fromUtf8(r.c_str(), r.size()); //utf8? + return TQString::fromUtf8(r.c_str(), r.size()); //utf8? } } diff --git a/kexi/kexidb/drivers/pqxx/pqxxdriver.cpp b/kexi/kexidb/drivers/pqxx/pqxxdriver.cpp index d8e6216d..3d9162ca 100644 --- a/kexi/kexidb/drivers/pqxx/pqxxdriver.cpp +++ b/kexi/kexidb/drivers/pqxx/pqxxdriver.cpp @@ -33,8 +33,8 @@ KEXIDB_DRIVER_INFO( pqxxSqlDriver, pqxxsql ) //================================================================================== // -pqxxSqlDriver::pqxxSqlDriver( QObject *parent, const char *name, const QStringList &args ) - : Driver( parent, name, args ) +pqxxSqlDriver::pqxxSqlDriver( TQObject *tqparent, const char *name, const TQStringList &args ) + : Driver( tqparent, name, args ) { d->isFileDriver = false; d->features = SingleTransactions | CursorForward | CursorBackward; @@ -47,7 +47,7 @@ pqxxSqlDriver::pqxxSqlDriver( QObject *parent, const char *name, const QStringLi beh->AUTO_INCREMENT_FIELD_OPTION = ""; beh->AUTO_INCREMENT_PK_FIELD_OPTION = "PRIMARY KEY"; beh->ALWAYS_AVAILABLE_DATABASE_NAME = "template1"; - beh->QUOTATION_MARKS_FOR_IDENTIFIER = '"'; + beh->TQUOTATION_MARKS_FOR_IDENTIFIER = '"'; beh->SQL_KEYWORDS = keywords; initSQLKeywords(233); @@ -72,7 +72,7 @@ pqxxSqlDriver::pqxxSqlDriver( QObject *parent, const char *name, const QStringLi //================================================================================== //Override the default implementation to allow for NUMERIC type natively -QString pqxxSqlDriver::sqlTypeName(int id_t, int p) const +TQString pqxxSqlDriver::sqlTypeName(int id_t, int p) const { if (id_t==Field::Null) return "NULL"; @@ -110,69 +110,69 @@ pqxxSqlDriver::drv_createConnection( ConnectionData &conn_data ) //================================================================================== // -bool pqxxSqlDriver::isSystemObjectName( const QString& n ) const +bool pqxxSqlDriver::isSystemObjectName( const TQString& n ) const { return Driver::isSystemObjectName(n); } //================================================================================== // -bool pqxxSqlDriver::drv_isSystemFieldName( const QString& ) const +bool pqxxSqlDriver::drv_isSystemFieldName( const TQString& ) const { return false; } //================================================================================== // -bool pqxxSqlDriver::isSystemDatabaseName( const QString& n ) const +bool pqxxSqlDriver::isSystemDatabaseName( const TQString& n ) const { return n.lower()=="template1" || n.lower()=="template0"; } //================================================================================== // -QString pqxxSqlDriver::escapeString( const QString& str) const +TQString pqxxSqlDriver::escapeString( const TQString& str) const { - return QString::fromLatin1("'") - + QString::fromAscii( pqxx::sqlesc(std::string(str.utf8())).c_str() ) - + QString::fromLatin1("'"); + return TQString::tqfromLatin1("'") + + TQString::fromAscii( pqxx::sqlesc(std::string(str.utf8())).c_str() ) + + TQString::tqfromLatin1("'"); } //================================================================================== // -QCString pqxxSqlDriver::escapeString( const QCString& str) const +TQCString pqxxSqlDriver::escapeString( const TQCString& str) const { - return QCString("'") - + QCString( pqxx::sqlesc(QString(str).ascii()).c_str() ) - + QCString("'"); + return TQCString("'") + + TQCString( pqxx::sqlesc(TQString(str).ascii()).c_str() ) + + TQCString("'"); } //================================================================================== // -QString pqxxSqlDriver::drv_escapeIdentifier( const QString& str) const { - return QString(str).replace( '"', "\"\"" ); +TQString pqxxSqlDriver::drv_escapeIdentifier( const TQString& str) const { + return TQString(str).tqreplace( '"', "\"\"" ); } //================================================================================== // -QCString pqxxSqlDriver::drv_escapeIdentifier( const QCString& str) const { - return QCString(str).replace( '"', "\"\"" ); +TQCString pqxxSqlDriver::drv_escapeIdentifier( const TQCString& str) const { + return TQCString(str).tqreplace( '"', "\"\"" ); } //================================================================================== // -QString pqxxSqlDriver::escapeBLOB(const QByteArray& array) const +TQString pqxxSqlDriver::escapeBLOB(const TQByteArray& array) const { return KexiDB::escapeBLOB(array, KexiDB::BLOBEscapeOctal); } -QString pqxxSqlDriver::valueToSQL( uint ftype, const QVariant& v ) const +TQString pqxxSqlDriver::valueToSQL( uint ftype, const TQVariant& v ) const { if (ftype==Field::Boolean) { // use SQL compliant TRUE or FALSE as described here // http://www.postgresql.org/docs/8.0/interactive/datatype-boolean.html // 1 or 0 does not work - return v.toInt()==0 ? QString::fromLatin1("FALSE") : QString::fromLatin1("TRUE"); + return v.toInt()==0 ? TQString::tqfromLatin1("FALSE") : TQString::tqfromLatin1("TRUE"); } return Driver::valueToSQL(ftype, v); } diff --git a/kexi/kexidb/drivers/pqxx/pqxxdriver.h b/kexi/kexidb/drivers/pqxx/pqxxdriver.h index bbfdddc3..779c1368 100644 --- a/kexi/kexidb/drivers/pqxx/pqxxdriver.h +++ b/kexi/kexidb/drivers/pqxx/pqxxdriver.h @@ -17,10 +17,10 @@ * Boston, MA 02110-1301, USA. */ -#ifndef KEXIDB_DRIVER_PQXX_H -#define KEXIDB_DRIVER_PQXX_H +#ifndef KEXIDB_DRIVER_PTQXX_H +#define KEXIDB_DRIVER_PTQXX_H -#include <qstringlist.h> +#include <tqstringlist.h> #include <kexidb/driver.h> @@ -34,33 +34,34 @@ class DriverManager; class pqxxSqlDriver : public Driver { Q_OBJECT + TQ_OBJECT KEXIDB_DRIVER public: - pqxxSqlDriver( QObject *parent, const char *name, const QStringList &args = QStringList() ); + pqxxSqlDriver( TQObject *tqparent, const char *name, const TQStringList &args = TQStringList() ); ~pqxxSqlDriver(); - virtual bool isSystemObjectName( const QString& n )const; - virtual bool isSystemDatabaseName( const QString& n )const; + virtual bool isSystemObjectName( const TQString& n )const; + virtual bool isSystemDatabaseName( const TQString& n )const; //! Escape a string for use as a value - virtual QString escapeString( const QString& str) const; - virtual QCString escapeString( const QCString& str) const; - virtual QString sqlTypeName(int id_t, int p=0) const; + virtual TQString escapeString( const TQString& str) const; + virtual TQCString escapeString( const TQCString& str) const; + virtual TQString sqlTypeName(int id_t, int p=0) const; //! Escape BLOB value \a array - virtual QString escapeBLOB(const QByteArray& array) const; + virtual TQString escapeBLOB(const TQByteArray& array) const; /*! Escapes and converts value \a v (for type \a ftype) to string representation required by SQL commands. Reimplemented for boolean type only to use SQL compliant TRUE or FALSE */ - virtual QString valueToSQL( uint ftype, const QVariant& v ) const; + virtual TQString valueToSQL( uint ftype, const TQVariant& v ) const; protected: - virtual QString drv_escapeIdentifier( const QString& str) const; - virtual QCString drv_escapeIdentifier( const QCString& str) const; + virtual TQString drv_escapeIdentifier( const TQString& str) const; + virtual TQCString drv_escapeIdentifier( const TQCString& str) const; virtual Connection *drv_createConnection( ConnectionData &conn_data ); - virtual bool drv_isSystemFieldName( const QString& n )const; + virtual bool drv_isSystemFieldName( const TQString& n )const; private: static const char *keywords[]; diff --git a/kexi/kexidb/drivers/pqxx/pqxxpreparedstatement.h b/kexi/kexidb/drivers/pqxx/pqxxpreparedstatement.h index 232454d3..1421f5a4 100644 --- a/kexi/kexidb/drivers/pqxx/pqxxpreparedstatement.h +++ b/kexi/kexidb/drivers/pqxx/pqxxpreparedstatement.h @@ -22,8 +22,8 @@ // Description: // // -#ifndef PQXXPREPAREDSTATEMENT_H -#define PQXXPREPAREDSTATEMENT_H +#ifndef PTQXXPREPAREDSTATEMENT_H +#define PTQXXPREPAREDSTATEMENT_H #include <kexidb/preparedstatement.h> #include <kexidb/connection_p.h> diff --git a/kexi/kexidb/drivers/sqlite/sqlite_common.pro b/kexi/kexidb/drivers/sqlite/sqlite_common.pro index 81fb85b3..7770eb9d 100644 --- a/kexi/kexidb/drivers/sqlite/sqlite_common.pro +++ b/kexi/kexidb/drivers/sqlite/sqlite_common.pro @@ -2,7 +2,7 @@ include( ../common.pro ) DEFINES += MAKE_KEXIDB_SQLITE_DRIVER_LIB -system( bash kmoc ) +system( bash ktqmoc ) SOURCES = \ sqliteconnection.cpp \ diff --git a/kexi/kexidb/drivers/sqlite/sqliteadmin.cpp b/kexi/kexidb/drivers/sqlite/sqliteadmin.cpp index 8bd8085a..14d2217a 100644 --- a/kexi/kexidb/drivers/sqlite/sqliteadmin.cpp +++ b/kexi/kexidb/drivers/sqlite/sqliteadmin.cpp @@ -17,7 +17,7 @@ * Boston, MA 02110-1301, USA. */ -#include <qdir.h> +#include <tqdir.h> #include "sqliteadmin.h" #include <kexidb/drivermanager.h> @@ -36,7 +36,7 @@ SQLiteAdminTools::~SQLiteAdminTools() { } -bool SQLiteAdminTools::vacuum(const KexiDB::ConnectionData& data, const QString& databaseName) +bool SQLiteAdminTools::vacuum(const KexiDB::ConnectionData& data, const TQString& databaseName) { clearError(); #ifdef SQLITE2 @@ -46,12 +46,12 @@ bool SQLiteAdminTools::vacuum(const KexiDB::ConnectionData& data, const QString& #else KexiDB::DriverManager manager; KexiDB::Driver *drv = manager.driver(data.driverName); - QString title( i18n("Could not compact database \"%1\".").arg(QDir::convertSeparators(databaseName)) ); + TQString title( i18n("Could not compact database \"%1\".").tqarg(TQDir::convertSeparators(databaseName)) ); if (!drv) { setError(&manager, title); return false; } - SQLiteVacuum vacuum(data.dbPath()+QDir::separator()+databaseName); + SQLiteVacuum vacuum(data.dbPath()+TQDir::separator()+databaseName); tristate result = vacuum.run(); if (!result) { setError(title); diff --git a/kexi/kexidb/drivers/sqlite/sqliteadmin.h b/kexi/kexidb/drivers/sqlite/sqliteadmin.h index d9f8a6b6..2f9db6c9 100644 --- a/kexi/kexidb/drivers/sqlite/sqliteadmin.h +++ b/kexi/kexidb/drivers/sqlite/sqliteadmin.h @@ -30,7 +30,7 @@ class SQLiteAdminTools : public KexiDB::AdminTools virtual ~SQLiteAdminTools(); /*! Performs vacuum (compacting) for connection \a conn. */ - virtual bool vacuum(const KexiDB::ConnectionData& data, const QString& databaseName); + virtual bool vacuum(const KexiDB::ConnectionData& data, const TQString& databaseName); }; #endif diff --git a/kexi/kexidb/drivers/sqlite/sqlitealter.cpp b/kexi/kexidb/drivers/sqlite/sqlitealter.cpp index cc72e48a..c1903efa 100644 --- a/kexi/kexidb/drivers/sqlite/sqlitealter.cpp +++ b/kexi/kexidb/drivers/sqlite/sqlitealter.cpp @@ -24,7 +24,7 @@ #include <kstaticdeleter.h> -#include <qmap.h> +#include <tqmap.h> using namespace KexiDB; @@ -33,15 +33,15 @@ enum SQLiteTypeAffinity { //as defined here: 2.1 Determination Of Column Affinit }; //! helper for affinityForType() -static KStaticDeleter< QMap<int,int> > KexiDB_SQLite_affinityForType_deleter; -QMap<int,int> *KexiDB_SQLite_affinityForType = 0; +static KStaticDeleter< TQMap<int,int> > KexiDB_SQLite_affinityForType_deleter; +TQMap<int,int> *KexiDB_SQLite_affinityForType = 0; //! \return SQLite type affinity for \a type //! See doc/dev/alter_table_type_conversions.ods, page 2 for more info static SQLiteTypeAffinity affinityForType(Field::Type type) { if (!KexiDB_SQLite_affinityForType) { - KexiDB_SQLite_affinityForType_deleter.setObject( KexiDB_SQLite_affinityForType, new QMap<int,int>() ); + KexiDB_SQLite_affinityForType_deleter.setObject( KexiDB_SQLite_affinityForType, new TQMap<int,int>() ); KexiDB_SQLite_affinityForType->insert(Field::Byte, IntAffinity); KexiDB_SQLite_affinityForType->insert(Field::ShortInteger, IntAffinity); KexiDB_SQLite_affinityForType->insert(Field::Integer, IntAffinity); @@ -60,7 +60,7 @@ static SQLiteTypeAffinity affinityForType(Field::Type type) } tristate SQLiteConnection::drv_changeFieldProperty(TableSchema &table, Field& field, - const QString& propertyName, const QVariant& value) + const TQString& propertyName, const TQVariant& value) { /* if (propertyName=="name") { diff --git a/kexi/kexidb/drivers/sqlite/sqliteconnection.cpp b/kexi/kexidb/drivers/sqlite/sqliteconnection.cpp index 6de41c59..27f190b8 100644 --- a/kexi/kexidb/drivers/sqlite/sqliteconnection.cpp +++ b/kexi/kexidb/drivers/sqlite/sqliteconnection.cpp @@ -33,9 +33,9 @@ #include <kexidb/error.h> #include <kexiutils/utils.h> -#include <qfile.h> -#include <qdir.h> -#include <qregexp.h> +#include <tqfile.h> +#include <tqdir.h> +#include <tqregexp.h> #include <kgenericfactory.h> #include <kdebug.h> @@ -103,8 +103,8 @@ SQLiteConnection::~SQLiteConnection() bool SQLiteConnection::drv_connect(KexiDB::ServerVersionInfo& version) { KexiDBDrvDbg << "SQLiteConnection::connect()" << endl; - version.string = QString(SQLITE_VERSION); //defined in sqlite3.h - QRegExp re("(\\d+)\\.(\\d+)\\.(\\d+)"); + version.string = TQString(SQLITE_VERSION); //defined in sqlite3.h + TQRegExp re("(\\d+)\\.(\\d+)\\.(\\d+)"); if (re.exactMatch(version.string)) { version.major = re.cap(1).toUInt(); version.minor = re.cap(2).toUInt(); @@ -119,21 +119,21 @@ bool SQLiteConnection::drv_disconnect() return true; } -bool SQLiteConnection::drv_getDatabasesList( QStringList &list ) +bool SQLiteConnection::drv_getDatabasesList( TQStringList &list ) { //this is one-db-per-file database list.append( data()->fileName() ); //more consistent than dbFileName() ? return true; } -bool SQLiteConnection::drv_containsTable( const QString &tableName ) +bool SQLiteConnection::drv_containsTable( const TQString &tableName ) { bool success; - return resultExists(QString("select name from sqlite_master where type='table' and name LIKE %1") - .arg(driver()->escapeString(tableName)), success) && success; + return resultExists(TQString("select name from sqlite_master where type='table' and name LIKE %1") + .tqarg(driver()->escapeString(tableName)), success) && success; } -bool SQLiteConnection::drv_getTablesList( QStringList &list ) +bool SQLiteConnection::drv_getTablesList( TQStringList &list ) { KexiDB::Cursor *cursor; m_sql = "select lower(name) from sqlite_master where type='table'"; @@ -154,19 +154,19 @@ bool SQLiteConnection::drv_getTablesList( QStringList &list ) return deleteCursor(cursor); } -bool SQLiteConnection::drv_createDatabase( const QString &dbName ) +bool SQLiteConnection::drv_createDatabase( const TQString &dbName ) { // SQLite creates a new db is it does not exist return drv_useDatabase(dbName); #if 0 - d->data = sqlite_open( QFile::encodeName( data()->fileName() ), 0/*mode: unused*/, + d->data = sqlite_open( TQFile::encodeName( data()->fileName() ), 0/*mode: unused*/, &d->errmsg_p ); d->storeResult(); return d->data != 0; #endif } -bool SQLiteConnection::drv_useDatabase( const QString &dbName, bool *cancelled, +bool SQLiteConnection::drv_useDatabase( const TQString &dbName, bool *cancelled, MessageHandler* msgHandler ) { Q_UNUSED(dbName); @@ -174,7 +174,7 @@ bool SQLiteConnection::drv_useDatabase( const QString &dbName, bool *cancelled, #ifdef SQLITE2 Q_UNUSED(cancelled); Q_UNUSED(msgHandler); - d->data = sqlite_open( QFile::encodeName( data()->fileName() ), 0/*mode: unused*/, + d->data = sqlite_open( TQFile::encodeName( data()->fileName() ), 0/*mode: unused*/, &d->errmsg_p ); d->storeResult(); return d->data != 0; @@ -187,8 +187,8 @@ bool SQLiteConnection::drv_useDatabase( const QString &dbName, bool *cancelled, const bool wasReadOnly = Connection::isReadOnly(); d->res = sqlite3_open( - //QFile::encodeName( data()->fileName() ), - data()->fileName().utf8(), /* unicode expected since SQLite 3.1 */ + //TQFile::encodeName( data()->fileName() ), + data()->fileName().utf8(), /* tqunicode expected since SQLite 3.1 */ &d->data, exclusiveFlag, allowReadonly /* If 1 and locking fails, try opening in read-only mode */ @@ -200,7 +200,7 @@ bool SQLiteConnection::drv_useDatabase( const QString &dbName, bool *cancelled, if (KMessageBox::Continue != askQuestion( i18n("Do you want to open file \"%1\" as read-only?") - .arg(QDir::convertSeparators(data()->fileName())) + .tqarg(TQDir::convertSeparators(data()->fileName())) + "\n\n" + i18n("The file is probably already open on this or another computer.") + " " + i18n("Could not gain exclusive access for writing the file."), @@ -258,21 +258,21 @@ bool SQLiteConnection::drv_closeDatabase() #endif } -bool SQLiteConnection::drv_dropDatabase( const QString &dbName ) +bool SQLiteConnection::drv_dropDatabase( const TQString &dbName ) { Q_UNUSED(dbName); // Each database is one single SQLite file. - const QString filename = data()->fileName(); - if (QFile(filename).exists() && !QDir().remove(filename)) { + const TQString filename = data()->fileName(); + if (TQFile(filename).exists() && !TQDir().remove(filename)) { setError(ERR_ACCESS_RIGHTS, i18n("Could not remove file \"%1\".") - .arg(QDir::convertSeparators(filename)) + " " + .tqarg(TQDir::convertSeparators(filename)) + " " + i18n("Check the file's permissions and whether it is already opened and locked by another application.")); return false; } return true; } -//CursorData* SQLiteConnection::drv_createCursor( const QString& statement ) -Cursor* SQLiteConnection::prepareQuery( const QString& statement, uint cursor_options ) +//CursorData* SQLiteConnection::drv_createCursor( const TQString& statement ) +Cursor* SQLiteConnection::prepareQuery( const TQString& statement, uint cursor_options ) { return new SQLiteCursor( this, statement, cursor_options ); } @@ -282,10 +282,10 @@ Cursor* SQLiteConnection::prepareQuery( QuerySchema& query, uint cursor_options return new SQLiteCursor( this, query, cursor_options ); } -bool SQLiteConnection::drv_executeSQL( const QString& statement ) +bool SQLiteConnection::drv_executeSQL( const TQString& statement ) { // KexiDBDrvDbg << "SQLiteConnection::drv_executeSQL(" << statement << ")" <<endl; -// QCString st(statement.length()*2); +// TQCString st(statement.length()*2); // st = escapeString( statement.local8Bit() ); //? #ifdef SQLITE_UTF8 d->temp_st = statement.utf8(); @@ -294,7 +294,7 @@ bool SQLiteConnection::drv_executeSQL( const QString& statement ) #endif #ifdef KEXI_DEBUG_GUI - KexiUtils::addKexiDBDebug(QString("ExecuteSQL (SQLite): ")+statement); + KexiUtils::addKexiDBDebug(TQString("ExecuteSQL (SQLite): ")+statement); #endif d->res = sqlite_exec( @@ -310,9 +310,9 @@ bool SQLiteConnection::drv_executeSQL( const QString& statement ) return d->res==SQLITE_OK; } -Q_ULLONG SQLiteConnection::drv_lastInsertRowID() +TQ_ULLONG SQLiteConnection::drv_lastInsertRowID() { - return (Q_ULLONG)sqlite_last_insert_rowid(d->data); + return (TQ_ULLONG)sqlite_last_insert_rowid(d->data); } int SQLiteConnection::serverResult() @@ -320,13 +320,13 @@ int SQLiteConnection::serverResult() return d->res==0 ? Connection::serverResult() : d->res; } -QString SQLiteConnection::serverResultName() +TQString SQLiteConnection::serverResultName() { - QString r = + TQString r = #ifdef SQLITE2 - QString::fromLatin1( sqlite_error_string(d->res) ); + TQString::tqfromLatin1( sqlite_error_string(d->res) ); #else //SQLITE3 - QString::null; //fromLatin1( d->result_name ); + TQString(); //tqfromLatin1( d->result_name ); #endif return r.isEmpty() ? Connection::serverResultName() : r; } @@ -343,7 +343,7 @@ void SQLiteConnection::drv_clearServerResult() #endif } -QString SQLiteConnection::serverErrorMsg() +TQString SQLiteConnection::serverErrorMsg() { return d->errmsg.isEmpty() ? Connection::serverErrorMsg() : d->errmsg; } @@ -366,14 +366,14 @@ bool SQLiteConnection::isReadOnly() const } #ifdef SQLITE2 -bool SQLiteConnection::drv_alterTableName(TableSchema& tableSchema, const QString& newName, bool replace) +bool SQLiteConnection::drv_alterTableName(TableSchema& tableSchema, const TQString& newName, bool tqreplace) { - const QString oldTableName = tableSchema.name(); + const TQString oldTableName = tableSchema.name(); const bool destTableExists = this->tableSchema( newName ) != 0; //1. drop the table if (destTableExists) { - if (!replace) + if (!tqreplace) return false; if (!drv_dropTable( newName )) return false; @@ -395,8 +395,8 @@ bool SQLiteConnection::drv_alterTableName(TableSchema& tableSchema, const QStrin //TODO indices, etc.??? // 3. copy all rows to the new table - if (!executeSQL(QString::fromLatin1("INSERT INTO %1 SELECT * FROM %2") - .arg(escapeIdentifier(tableSchema.name())).arg(escapeIdentifier(oldTableName)))) + if (!executeSQL(TQString::tqfromLatin1("INSERT INTO %1 SELECT * FROM %2") + .tqarg(escapeIdentifier(tableSchema.name())).tqarg(escapeIdentifier(oldTableName)))) { drv_alterTableName_ERR; return false; diff --git a/kexi/kexidb/drivers/sqlite/sqliteconnection.h b/kexi/kexidb/drivers/sqlite/sqliteconnection.h index ba0d3b5a..922e8447 100644 --- a/kexi/kexidb/drivers/sqlite/sqliteconnection.h +++ b/kexi/kexidb/drivers/sqlite/sqliteconnection.h @@ -20,7 +20,7 @@ #ifndef KEXIDB_CONN_SQLITE_H #define KEXIDB_CONN_SQLITE_H -#include <qstringlist.h> +#include <tqstringlist.h> #include <kexidb/connection.h> @@ -37,11 +37,12 @@ class Driver; class SQLiteConnection : public Connection { Q_OBJECT + TQ_OBJECT public: virtual ~SQLiteConnection(); - virtual Cursor* prepareQuery( const QString& statement, uint cursor_options = 0 ); + virtual Cursor* prepareQuery( const TQString& statement, uint cursor_options = 0 ); virtual Cursor* prepareQuery( QuerySchema& query, uint cursor_options = 0 ); //#ifndef SQLITE2 //TEMP IFDEF! @@ -57,24 +58,24 @@ class SQLiteConnection : public Connection virtual bool drv_connect(KexiDB::ServerVersionInfo& version); virtual bool drv_disconnect(); - virtual bool drv_getDatabasesList( QStringList &list ); + virtual bool drv_getDatabasesList( TQStringList &list ); //TODO: move this somewhere to low level class (MIGRATION?) - virtual bool drv_getTablesList( QStringList &list ); + virtual bool drv_getTablesList( TQStringList &list ); //TODO: move this somewhere to low level class (MIGRATION?) - virtual bool drv_containsTable( const QString &tableName ); + virtual bool drv_containsTable( const TQString &tableName ); /*! Creates new database using connection. Note: Do not pass \a dbName arg because for file-based engine (that has one database per connection) it is defined during connection. */ - virtual bool drv_createDatabase( const QString &dbName = QString::null ); + virtual bool drv_createDatabase( const TQString &dbName = TQString() ); /*! Opens existing database using connection. Do not pass \a dbName arg because for file-based engine (that has one database per connection) it is defined during connection. If you pass it, database file name will be changed. */ - virtual bool drv_useDatabase( const QString &dbName = QString::null, bool *cancelled = 0, + virtual bool drv_useDatabase( const TQString &dbName = TQString(), bool *cancelled = 0, MessageHandler* msgHandler = 0 ); virtual bool drv_closeDatabase(); @@ -82,21 +83,21 @@ class SQLiteConnection : public Connection /*! Drops database from the server using connection. After drop, database shouldn't be accessible anymore, so database file is just removed. See note from drv_useDatabase(). */ - virtual bool drv_dropDatabase( const QString &dbName = QString::null ); + virtual bool drv_dropDatabase( const TQString &dbName = TQString() ); //virtual bool drv_createTable( const KexiDB::Table& table ); - virtual bool drv_executeSQL( const QString& statement ); -// virtual bool drv_executeQuery( const QString& statement ); + virtual bool drv_executeSQL( const TQString& statement ); +// virtual bool drv_executeQuery( const TQString& statement ); - virtual Q_ULLONG drv_lastInsertRowID(); + virtual TQ_ULLONG drv_lastInsertRowID(); virtual int serverResult(); - virtual QString serverResultName(); - virtual QString serverErrorMsg(); + virtual TQString serverResultName(); + virtual TQString serverErrorMsg(); virtual void drv_clearServerResult(); virtual tristate drv_changeFieldProperty(TableSchema &table, Field& field, - const QString& propertyName, const QVariant& value); + const TQString& propertyName, const TQVariant& value); #ifdef SQLITE2 /*! Alters table's described \a tableSchema name to \a newName. @@ -108,7 +109,7 @@ class SQLiteConnection : public Connection \return true on success. More advanced server backends implement this using "ALTER TABLE .. RENAME TO". */ - virtual bool drv_alterTableName(TableSchema& tableSchema, const QString& newName, bool replace = false); + virtual bool drv_alterTableName(TableSchema& tableSchema, const TQString& newName, bool tqreplace = false); #endif //! for drv_changeFieldProperty() diff --git a/kexi/kexidb/drivers/sqlite/sqliteconnection_p.h b/kexi/kexidb/drivers/sqlite/sqliteconnection_p.h index f295573d..4918c759 100644 --- a/kexi/kexidb/drivers/sqlite/sqliteconnection_p.h +++ b/kexi/kexidb/drivers/sqlite/sqliteconnection_p.h @@ -58,11 +58,11 @@ class SQLiteConnectionInternal : public ConnectionInternal sqlite_struct *data; bool data_owned; //!< true if data pointer should be freed on destruction - QString errmsg; //<! server-specific message of last operation + TQString errmsg; //<! server-specific message of last operation char *errmsg_p; //<! temporary: server-specific message of last operation int res; //<! result code of last operation on server - QCString temp_st; + TQCString temp_st; #ifdef SQLITE3 const char *result_name; #endif diff --git a/kexi/kexidb/drivers/sqlite/sqlitecursor.cpp b/kexi/kexidb/drivers/sqlite/sqlitecursor.cpp index 4b18b437..5239127c 100644 --- a/kexi/kexidb/drivers/sqlite/sqlitecursor.cpp +++ b/kexi/kexidb/drivers/sqlite/sqlitecursor.cpp @@ -33,13 +33,13 @@ #include <kdebug.h> #include <klocale.h> -#include <qptrvector.h> -#include <qdatetime.h> +#include <tqptrvector.h> +#include <tqdatetime.h> using namespace KexiDB; //! safer interpretations of boolean values for SQLite -static bool sqliteStringToBool(const QString& s) +static bool sqliteStringToBool(const TQString& s) { return s.lower()=="yes" || (s.lower()!="no" && s!="0"); } @@ -84,7 +84,7 @@ class KexiDB::SQLiteCursorData : public SQLiteConnectionInternal } #endif*/ - QCString st; + TQCString st; //for sqlite: // sqlite_struct *data; //! taken from SQLiteConnection #ifdef SQLITE2 @@ -95,7 +95,7 @@ class KexiDB::SQLiteCursorData : public SQLiteConnectionInternal char *utail; -// QString errmsg; //<! server-specific message of last operation +// TQString errmsg; //<! server-specific message of last operation // char *errmsg_p; //<! temporary: server-specific message of last operation // int res; //<! result code of last operation on server @@ -112,7 +112,7 @@ class KexiDB::SQLiteCursorData : public SQLiteConnectionInternal uint cols_pointers_mem_size; //! size of record's array of pointers to values int records_in_buf; //! number of records currently stored in the buffer bool buffering_completed; //! true if we have already all records stored in the buffer - QPtrVector<const char*> records; //buffer data + TQPtrVector<const char*> records; //buffer data bool at_buffer; //! true if we already point to the buffer with curr_coldata */ @@ -121,39 +121,39 @@ class KexiDB::SQLiteCursorData : public SQLiteConnectionInternal const char **prev_colname;*/ uint cols_pointers_mem_size; //! size of record's array of pointers to values - QPtrVector<const char*> records;//! buffer data + TQPtrVector<const char*> records;//! buffer data //#ifdef SQLITE3 // bool rowDataReadyToFetch : 1; //#endif #ifdef SQLITE3 - inline QVariant getValue(Field *f, int i) + inline TQVariant getValue(Field *f, int i) { int type = sqlite3_column_type(prepared_st_handle, i); if (type==SQLITE_NULL) { - return QVariant(); + return TQVariant(); } else if (!f || type==SQLITE_TEXT) { //TODO: support for UTF-16 -#define GET_sqlite3_column_text QString::fromUtf8( (const char*)sqlite3_column_text(prepared_st_handle, i) ) +#define GET_sqlite3_column_text TQString::fromUtf8( (const char*)sqlite3_column_text(prepared_st_handle, i) ) if (!f || f->isTextType()) return GET_sqlite3_column_text; else { switch (f->type()) { case Field::Date: - return QDate::fromString( GET_sqlite3_column_text, Qt::ISODate ); + return TQDate::fromString( GET_sqlite3_column_text, Qt::ISODate ); case Field::Time: - //QDateTime - a hack needed because QVariant(QTime) has broken isNull() - return KexiUtils::stringToHackedQTime(GET_sqlite3_column_text); + //TQDateTime - a hack needed because TQVariant(TQTime) has broken isNull() + return KexiUtils::stringToHackedTQTime(GET_sqlite3_column_text); case Field::DateTime: { - QString tmp( GET_sqlite3_column_text ); + TQString tmp( GET_sqlite3_column_text ); tmp[10] = 'T'; //for ISODate compatibility - return QDateTime::fromString( tmp, Qt::ISODate ); + return TQDateTime::fromString( tmp, Qt::ISODate ); } case Field::Boolean: - return QVariant(sqliteStringToBool(GET_sqlite3_column_text), 1); + return TQVariant(sqliteStringToBool(GET_sqlite3_column_text), 1); default: - return QVariant(); //TODO + return TQVariant(); //TODO } } } @@ -162,42 +162,42 @@ class KexiDB::SQLiteCursorData : public SQLiteConnectionInternal case Field::Byte: case Field::ShortInteger: case Field::Integer: - return QVariant( sqlite3_column_int(prepared_st_handle, i) ); + return TQVariant( sqlite3_column_int(prepared_st_handle, i) ); case Field::BigInteger: - return QVariant( (Q_LLONG)sqlite3_column_int64(prepared_st_handle, i) ); + return TQVariant( (TQ_LLONG)sqlite3_column_int64(prepared_st_handle, i) ); case Field::Boolean: - return QVariant( sqlite3_column_int(prepared_st_handle, i)!=0, 1 ); + return TQVariant( sqlite3_column_int(prepared_st_handle, i)!=0, 1 ); default:; } if (f->isFPNumericType()) //WEIRD, YEAH? - return QVariant( (double)sqlite3_column_int(prepared_st_handle, i) ); + return TQVariant( (double)sqlite3_column_int(prepared_st_handle, i) ); else - return QVariant(); //TODO + return TQVariant(); //TODO } else if (type==SQLITE_FLOAT) { if (f && f->isFPNumericType()) - return QVariant( sqlite3_column_double(prepared_st_handle, i) ); + return TQVariant( sqlite3_column_double(prepared_st_handle, i) ); else if (!f || f->isIntegerType()) - return QVariant( (double)sqlite3_column_double(prepared_st_handle, i) ); + return TQVariant( (double)sqlite3_column_double(prepared_st_handle, i) ); else - return QVariant(); //TODO + return TQVariant(); //TODO } else if (type==SQLITE_BLOB) { if (f && f->type()==Field::BLOB) { - QByteArray ba; + TQByteArray ba; //! @todo efficient enough? ba.duplicate((const char*)sqlite3_column_blob(prepared_st_handle, i), sqlite3_column_bytes(prepared_st_handle, i)); return ba; } else - return QVariant(); //TODO + return TQVariant(); //TODO } - return QVariant(); + return TQVariant(); } #endif //SQLITE3 }; -SQLiteCursor::SQLiteCursor(Connection* conn, const QString& statement, uint options) +SQLiteCursor::SQLiteCursor(Connection* conn, const TQString& statement, uint options) : Cursor( conn, statement, options ) , d( new SQLiteCursorData(conn) ) { @@ -328,7 +328,7 @@ void SQLiteCursor::drv_getNextRecord() if (m_result == FetchOK && d->curr_coldata) { for (uint i=0;i<m_fieldCount;i++) { KexiDBDrvDbg<<"col."<< i<<": "<< d->curr_colname[i]<<" "<< d->curr_colname[m_fieldCount+i] - << " = " << (d->curr_coldata[i] ? QString::fromLocal8Bit(d->curr_coldata[i]) : "(NULL)") <<endl; + << " = " << (d->curr_coldata[i] ? TQString::fromLocal8Bit(d->curr_coldata[i]) : "(NULL)") <<endl; } // KexiDBDrvDbg << "SQLiteCursor::drv_getNextRecord(): "<<m_fieldCount<<" col(s) fetched"<<endl; }*/ @@ -363,7 +363,7 @@ void SQLiteCursor::drv_bufferMovePointerPrev() //compute a place in the buffer that contain next record's data //and move internal buffer pointer to that place -void SQLiteCursor::drv_bufferMovePointerTo(Q_LLONG at) +void SQLiteCursor::drv_bufferMovePointerTo(TQ_LLONG at) { d->curr_coldata = d->records.at(at); } @@ -432,17 +432,17 @@ void SQLiteCursor::storeCurrentRow(RowData &data) const if (!m_fieldsExpanded) {//simple version: without types for( uint i=0; i<m_fieldCount; i++ ) { #ifdef SQLITE2 - data[i] = QVariant( *col ); + data[i] = TQVariant( *col ); col++; #else //SQLITE3 - data[i] = QString::fromUtf8( (const char*)sqlite3_column_text(d->prepared_st_handle, i) ); + data[i] = TQString::fromUtf8( (const char*)sqlite3_column_text(d->prepared_st_handle, i) ); #endif } return; } //const uint fieldsExpandedCount = m_fieldsExpanded->count(); - const uint maxCount = QMIN(m_fieldCount, m_fieldsExpanded->count()); + const uint maxCount = TQMIN(m_fieldCount, m_fieldsExpanded->count()); // i - visible field's index, j - physical index for( uint i=0, j=0; i<m_fieldCount; i++, j++ ) { // while (j < m_detailedVisibility.count() && !m_detailedVisibility[j]) //!m_query->isColumnVisible(j)) @@ -459,42 +459,42 @@ void SQLiteCursor::storeCurrentRow(RowData &data) const #ifdef SQLITE2 if (!*col) - data[i] = QVariant(); + data[i] = TQVariant(); else if (f && f->isTextType()) # ifdef SQLITE_UTF8 - data[i] = QString::fromUtf8( *col ); + data[i] = TQString::fromUtf8( *col ); # else - data[i] = QVariant( *col ); //only latin1 + data[i] = TQVariant( *col ); //only latin1 # endif else if (f && f->isFPNumericType()) - data[i] = QVariant( QCString(*col).toDouble() ); + data[i] = TQVariant( TQCString(*col).toDouble() ); else { switch (f ? f->type() : Field::Integer/*ROWINFO*/) { //todo: use short, etc. case Field::Byte: case Field::ShortInteger: case Field::Integer: - data[i] = QVariant( QCString(*col).toInt() ); + data[i] = TQVariant( TQCString(*col).toInt() ); case Field::BigInteger: - data[i] = QVariant( QString::fromLatin1(*col).toLongLong() ); + data[i] = TQVariant( TQString::tqfromLatin1(*col).toLongLong() ); case Field::Boolean: - data[i] = QVariant( sqliteStringToBool(QString::fromLatin1(*col)), 1 ); + data[i] = TQVariant( sqliteStringToBool(TQString::tqfromLatin1(*col)), 1 ); break; case Field::Date: - data[i] = QDate::fromString( QString::fromLatin1(*col), Qt::ISODate ); + data[i] = TQDate::fromString( TQString::tqfromLatin1(*col), Qt::ISODate ); break; case Field::Time: - //QDateTime - a hack needed because QVariant(QTime) has broken isNull() - data[i] = KexiUtils::stringToHackedQTime(QString::fromLatin1(*col)); + //TQDateTime - a hack needed because TQVariant(TQTime) has broken isNull() + data[i] = KexiUtils::stringToHackedTQTime(TQString::tqfromLatin1(*col)); break; case Field::DateTime: { - QString tmp( QString::fromLatin1(*col) ); + TQString tmp( TQString::tqfromLatin1(*col) ); tmp[10] = 'T'; - data[i] = QDateTime::fromString( tmp, Qt::ISODate ); + data[i] = TQDateTime::fromString( tmp, Qt::ISODate ); break; } default: - data[i] = QVariant( *col ); + data[i] = TQVariant( *col ); } } @@ -505,11 +505,11 @@ void SQLiteCursor::storeCurrentRow(RowData &data) const } } -QVariant SQLiteCursor::value(uint i) +TQVariant SQLiteCursor::value(uint i) { // if (i > (m_fieldCount-1+(m_containsROWIDInfo?1:0))) //range checking if (i > (m_fieldCount-1)) //range checking - return QVariant(); + return TQVariant(); //TODO: allow disable range checking! - performance reasons // const KexiDB::Field *f = m_query ? m_query->field(i) : 0; KexiDB::Field *f = (m_fieldsExpanded && i<m_fieldsExpanded->count()) @@ -518,13 +518,13 @@ QVariant SQLiteCursor::value(uint i) //from most to least frequently used types: //(m_logicalFieldCount introduced) if (i==m_fieldCount || f && f->isIntegerType()) if (!f || f->isIntegerType()) - return QVariant( QCString(d->curr_coldata[i]).toInt() ); + return TQVariant( TQCString(d->curr_coldata[i]).toInt() ); else if (!f || f->isTextType()) - return QVariant( d->curr_coldata[i] ); + return TQVariant( d->curr_coldata[i] ); else if (f->isFPNumericType()) - return QVariant( QCString(d->curr_coldata[i]).toDouble() ); + return TQVariant( TQCString(d->curr_coldata[i]).toDouble() ); - return QVariant( d->curr_coldata[i] ); //default + return TQVariant( d->curr_coldata[i] ); //default #else return d->getValue(f, i); //, i==m_logicalFieldCount/*ROWID*/); #endif @@ -532,7 +532,7 @@ QVariant SQLiteCursor::value(uint i) /*! Stores string value taken from field number \a i to \a str. \return false when range checking failed. -bool SQLiteCursor::storeStringValue(uint i, QString &str) +bool SQLiteCursor::storeStringValue(uint i, TQString &str) { if (i > (m_fieldCount-1)) //range checking return false; @@ -545,16 +545,16 @@ int SQLiteCursor::serverResult() return d->res; } -QString SQLiteCursor::serverResultName() +TQString SQLiteCursor::serverResultName() { #ifdef SQLITE2 - return QString::fromLatin1( sqlite_error_string(d->res) ); + return TQString::tqfromLatin1( sqlite_error_string(d->res) ); #else //SQLITE3 - return QString::fromLatin1( d->result_name ); + return TQString::tqfromLatin1( d->result_name ); #endif } -QString SQLiteCursor::serverErrorMsg() +TQString SQLiteCursor::serverErrorMsg() { return d->errmsg; } diff --git a/kexi/kexidb/drivers/sqlite/sqlitecursor.h b/kexi/kexidb/drivers/sqlite/sqlitecursor.h index b7170f67..d5e7c05e 100644 --- a/kexi/kexidb/drivers/sqlite/sqlitecursor.h +++ b/kexi/kexidb/drivers/sqlite/sqlitecursor.h @@ -20,7 +20,7 @@ #ifndef KEXIDB_SQLITECURSOR_H #define KEXIDB_SQLITECURSOR_H -#include <qstring.h> +#include <tqstring.h> #include <kexidb/cursor.h> #include "connection.h" @@ -36,7 +36,7 @@ class SQLiteCursor : public Cursor { public: virtual ~SQLiteCursor(); - virtual QVariant value(uint i); + virtual TQVariant value(uint i); /*! [PROTOTYPE] \return internal buffer data. */ //TODO virtual const char *** bufferData() @@ -48,12 +48,12 @@ class SQLiteCursor : public Cursor // virtual bool save(RowData& data, RowEditBuffer& buf); virtual int serverResult(); - virtual QString serverResultName(); - virtual QString serverErrorMsg(); + virtual TQString serverResultName(); + virtual TQString serverErrorMsg(); protected: /*! Cursor will operate on \a conn, raw \a statement will be used to execute query. */ - SQLiteCursor(Connection* conn, const QString& statement, uint options = NoOptions ); + SQLiteCursor(Connection* conn, const TQString& statement, uint options = NoOptions ); /*! Cursor will operate on \a conn, \a query schema will be used to execute query. */ SQLiteCursor(Connection* conn, QuerySchema& query, @@ -69,7 +69,7 @@ class SQLiteCursor : public Cursor virtual void drv_appendCurrentRecordToBuffer(); virtual void drv_bufferMovePointerNext(); virtual void drv_bufferMovePointerPrev(); - virtual void drv_bufferMovePointerTo(Q_LLONG at); + virtual void drv_bufferMovePointerTo(TQ_LLONG at); //TODO virtual void drv_storeCurrentRecord(); diff --git a/kexi/kexidb/drivers/sqlite/sqlitedriver.cpp b/kexi/kexidb/drivers/sqlite/sqlitedriver.cpp index e2abc246..c5128b63 100644 --- a/kexi/kexidb/drivers/sqlite/sqlitedriver.cpp +++ b/kexi/kexidb/drivers/sqlite/sqlitedriver.cpp @@ -48,9 +48,9 @@ class KexiDB::SQLiteDriverPrivate } }; -//PgSqlDB::PgSqlDB(QObject *parent, const char *name, const QStringList &) -SQLiteDriver::SQLiteDriver( QObject *parent, const char *name, const QStringList &args ) - : Driver( parent, name, args ) +//PgSqlDB::PgSqlDB(TQObject *tqparent, const char *name, const TQStringList &) +SQLiteDriver::SQLiteDriver( TQObject *tqparent, const char *name, const TQStringList &args ) + : Driver( tqparent, name, args ) ,dp( new SQLiteDriverPrivate() ) { d->isFileDriver = true; @@ -66,11 +66,11 @@ SQLiteDriver::SQLiteDriver( QObject *parent, const char *name, const QStringList beh->AUTO_INCREMENT_FIELD_OPTION = ""; //not available beh->AUTO_INCREMENT_TYPE = "INTEGER"; beh->AUTO_INCREMENT_PK_FIELD_OPTION = "PRIMARY KEY"; - beh->AUTO_INCREMENT_REQUIRES_PK = true; + beh->AUTO_INCREMENT_RETQUIRES_PK = true; beh->ROW_ID_FIELD_NAME = "OID"; - beh->_1ST_ROW_READ_AHEAD_REQUIRED_TO_KNOW_IF_THE_RESULT_IS_EMPTY=true; - beh->QUOTATION_MARKS_FOR_IDENTIFIER='"'; - beh->SELECT_1_SUBQUERY_SUPPORTED = true; + beh->_1ST_ROW_READ_AHEAD_RETQUIRED_TO_KNOW_IF_THE_RESULT_IS_EMPTY=true; + beh->TQUOTATION_MARKS_FOR_IDENTIFIER='"'; + beh->SELECT_1_SUBTQUERY_SUPPORTED = true; beh->SQL_KEYWORDS = keywords; initSQLKeywords(29); @@ -110,41 +110,41 @@ SQLiteDriver::drv_createConnection( ConnectionData &conn_data ) return new SQLiteConnection( this, conn_data ); } -bool SQLiteDriver::isSystemObjectName( const QString& n ) const +bool SQLiteDriver::isSystemObjectName( const TQString& n ) const { return Driver::isSystemObjectName(n) || n.lower().startsWith("sqlite_"); } -bool SQLiteDriver::drv_isSystemFieldName( const QString& n ) const +bool SQLiteDriver::drv_isSystemFieldName( const TQString& n ) const { return n.lower()=="_rowid_" || n.lower()=="rowid" || n.lower()=="oid"; } -QString SQLiteDriver::escapeString(const QString& str) const +TQString SQLiteDriver::escapeString(const TQString& str) const { - return QString("'")+QString(str).replace( '\'', "''" ) + "'"; + return TQString("'")+TQString(str).tqreplace( '\'', "''" ) + "'"; } -QCString SQLiteDriver::escapeString(const QCString& str) const +TQCString SQLiteDriver::escapeString(const TQCString& str) const { - return QCString("'")+QCString(str).replace( '\'', "''" )+"'"; + return TQCString("'")+TQCString(str).tqreplace( '\'', "''" )+"'"; } -QString SQLiteDriver::escapeBLOB(const QByteArray& array) const +TQString SQLiteDriver::escapeBLOB(const TQByteArray& array) const { return KexiDB::escapeBLOB(array, KexiDB::BLOBEscapeXHex); } -QString SQLiteDriver::drv_escapeIdentifier( const QString& str) const +TQString SQLiteDriver::drv_escapeIdentifier( const TQString& str) const { - return QString(str).replace( '"', "\"\"" ); + return TQString(str).tqreplace( '"', "\"\"" ); } -QCString SQLiteDriver::drv_escapeIdentifier( const QCString& str) const +TQCString SQLiteDriver::drv_escapeIdentifier( const TQCString& str) const { - return QCString(str).replace( '"', "\"\"" ); + return TQCString(str).tqreplace( '"', "\"\"" ); } AdminTools* SQLiteDriver::drv_createAdminTools() const diff --git a/kexi/kexidb/drivers/sqlite/sqlitedriver.h b/kexi/kexidb/drivers/sqlite/sqlitedriver.h index 66d4d4d2..a388d823 100644 --- a/kexi/kexidb/drivers/sqlite/sqlitedriver.h +++ b/kexi/kexidb/drivers/sqlite/sqlitedriver.h @@ -20,7 +20,7 @@ #ifndef KEXIDB_DRIVER_SQLITE_H #define KEXIDB_DRIVER_SQLITE_H -#include <qstringlist.h> +#include <tqstringlist.h> #include <kexidb/driver.h> @@ -35,31 +35,32 @@ class SQLiteDriverPrivate; class SQLiteDriver : public Driver { Q_OBJECT + TQ_OBJECT KEXIDB_DRIVER public: - SQLiteDriver( QObject *parent, const char *name, const QStringList &args = QStringList() ); + SQLiteDriver( TQObject *tqparent, const char *name, const TQStringList &args = TQStringList() ); virtual ~SQLiteDriver(); /*! \return true if \a n is a system object name; for this driver any object with name prefixed with "sqlite_" is considered as system object. */ - virtual bool isSystemObjectName( const QString& n ) const; + virtual bool isSystemObjectName( const TQString& n ) const; /*! \return false for this driver. */ - virtual bool isSystemDatabaseName( const QString& ) const { return false; } + virtual bool isSystemDatabaseName( const TQString& ) const { return false; } //! Escape a string for use as a value - virtual QString escapeString(const QString& str) const; - virtual QCString escapeString(const QCString& str) const; + virtual TQString escapeString(const TQString& str) const; + virtual TQCString escapeString(const TQCString& str) const; //! Escape BLOB value \a array - virtual QString escapeBLOB(const QByteArray& array) const; + virtual TQString escapeBLOB(const TQByteArray& array) const; protected: - virtual QString drv_escapeIdentifier( const QString& str) const; - virtual QCString drv_escapeIdentifier( const QCString& str) const; + virtual TQString drv_escapeIdentifier( const TQString& str) const; + virtual TQCString drv_escapeIdentifier( const TQCString& str) const; virtual Connection *drv_createConnection( ConnectionData &conn_data ); virtual AdminTools* drv_createAdminTools() const; @@ -67,7 +68,7 @@ class SQLiteDriver : public Driver for this driver fields with name equal "_ROWID_" is considered as system field. */ - virtual bool drv_isSystemFieldName( const QString& n ) const; + virtual bool drv_isSystemFieldName( const TQString& n ) const; SQLiteDriverPrivate *dp; diff --git a/kexi/kexidb/drivers/sqlite/sqlitepreparedstatement.cpp b/kexi/kexidb/drivers/sqlite/sqlitepreparedstatement.cpp index 9103b131..bccfd11b 100644 --- a/kexi/kexidb/drivers/sqlite/sqlitepreparedstatement.cpp +++ b/kexi/kexidb/drivers/sqlite/sqlitepreparedstatement.cpp @@ -93,7 +93,7 @@ bool SQLitePreparedStatement::execute() else assert(0); //impl. error - for (QValueListConstIterator<QVariant> it = m_args.constBegin(); + for (TQValueListConstIterator<TQVariant> it = m_args.constBegin(); (field = itFields.current()); ++it, ++itFields, arg++) { if (it==m_args.constEnd() || (*it).isNull()) {//no value to bind or the value is null: bind NULL @@ -106,7 +106,7 @@ bool SQLitePreparedStatement::execute() } if (field->isTextType()) { //! @todo optimize: make a static copy so SQLITE_STATIC can be used - QCString utf8String((*it).toString().utf8()); + TQCString utf8String((*it).toString().utf8()); res = sqlite3_bind_text(prepared_st_handle, arg, (const char*)utf8String, utf8String.length(), SQLITE_TRANSIENT /*??*/); if (SQLITE_OK != res) { @@ -150,7 +150,7 @@ bool SQLitePreparedStatement::execute() { //! @todo what about unsigned > LLONG_MAX ? bool ok; - Q_LLONG value = (*it).toLongLong(&ok); + TQ_LLONG value = (*it).toLongLong(&ok); if (ok) { res = sqlite3_bind_int64(prepared_st_handle, arg, value); if (SQLITE_OK != res) { @@ -169,7 +169,7 @@ bool SQLitePreparedStatement::execute() } case KexiDB::Field::Boolean: res = sqlite3_bind_text(prepared_st_handle, arg, - QString::number((*it).toBool() ? 1 : 0).latin1(), + TQString::number((*it).toBool() ? 1 : 0).latin1(), 1, SQLITE_TRANSIENT /*??*/); if (SQLITE_OK != res) { //! @todo msg? @@ -178,7 +178,7 @@ bool SQLitePreparedStatement::execute() break; case KexiDB::Field::Time: res = sqlite3_bind_text(prepared_st_handle, arg, - (*it).toTime().toString(Qt::ISODate).latin1(), + TQString((*it).toTime().toString(Qt::ISODate)).latin1(), sizeof("HH:MM:SS"), SQLITE_TRANSIENT /*??*/); if (SQLITE_OK != res) { //! @todo msg? @@ -187,7 +187,7 @@ bool SQLitePreparedStatement::execute() break; case KexiDB::Field::Date: res = sqlite3_bind_text(prepared_st_handle, arg, - (*it).toDate().toString(Qt::ISODate).latin1(), + TQString((*it).toDate().toString(Qt::ISODate)).latin1(), sizeof("YYYY-MM-DD"), SQLITE_TRANSIENT /*??*/); if (SQLITE_OK != res) { //! @todo msg? @@ -205,7 +205,7 @@ bool SQLitePreparedStatement::execute() break; case KexiDB::Field::BLOB: { - const QByteArray byteArray((*it).toByteArray()); + const TQByteArray byteArray((*it).toByteArray()); res = sqlite3_bind_blob(prepared_st_handle, arg, (const char*)byteArray, byteArray.size(), SQLITE_TRANSIENT /*??*/); if (SQLITE_OK != res) { diff --git a/kexi/kexidb/drivers/sqlite/sqlitevacuum.cpp b/kexi/kexidb/drivers/sqlite/sqlitevacuum.cpp index adf8709a..d24d906d 100644 --- a/kexi/kexidb/drivers/sqlite/sqlitevacuum.cpp +++ b/kexi/kexidb/drivers/sqlite/sqlitevacuum.cpp @@ -28,15 +28,15 @@ #include <kmessagebox.h> #include <kio/global.h> -#include <qfileinfo.h> -#include <qdir.h> -#include <qapplication.h> -#include <qprocess.h> -#include <qcursor.h> +#include <tqfileinfo.h> +#include <tqdir.h> +#include <tqapplication.h> +#include <tqprocess.h> +#include <tqcursor.h> #include <unistd.h> -SQLiteVacuum::SQLiteVacuum(const QString& filePath) +SQLiteVacuum::SQLiteVacuum(const TQString& filePath) : m_filePath(filePath) { m_process = 0; @@ -55,35 +55,35 @@ SQLiteVacuum::~SQLiteVacuum() tristate SQLiteVacuum::run() { - const QString ksqlite_app = KStandardDirs::findExe( "ksqlite" ); + const TQString ksqlite_app = KStandardDirs::findExe( "ksqlite" ); if (ksqlite_app.isEmpty()) { m_result = false; return m_result; } - QFileInfo fi(m_filePath); + TQFileInfo fi(m_filePath); if (!fi.isReadable()) { KexiDBDrvWarn << "SQLiteVacuum::run(): No such file" << m_filePath << endl; return false; } const uint origSize = fi.size(); - QStringList args; + TQStringList args; args << ksqlite_app << "-verbose-vacuum" << m_filePath << "vacuum"; - m_process = new QProcess(args, this, "process"); - m_process->setWorkingDirectory( QFileInfo(m_filePath).dir(true) ); - connect( m_process, SIGNAL(readyReadStdout()), this, SLOT(readFromStdout()) ); - connect( m_process, SIGNAL(processExited()), this, SLOT(processExited()) ); + m_process = new TQProcess(args, this, "process"); + m_process->setWorkingDirectory( TQFileInfo(m_filePath).dir(true) ); + connect( m_process, TQT_SIGNAL(readyReadStdout()), this, TQT_SLOT(readFromStdout()) ); + connect( m_process, TQT_SIGNAL(processExited()), this, TQT_SLOT(processExited()) ); if (!m_process->start()) { m_result = false; return m_result; } m_dlg = new KProgressDialog(0, 0, i18n("Compacting database"), "<qt>"+i18n("Compacting database \"%1\"...") - .arg("<nobr>"+QDir::convertSeparators(QFileInfo(m_filePath).fileName())+"</nobr>") + .tqarg("<nobr>"+TQDir::convertSeparators(TQFileInfo(m_filePath).fileName())+"</nobr>") ); m_dlg->adjustSize(); m_dlg->resize(300, m_dlg->height()); - connect(m_dlg, SIGNAL(cancelClicked()), this, SLOT(cancelClicked())); + connect(m_dlg, TQT_SIGNAL(cancelClicked()), this, TQT_SLOT(cancelClicked())); m_dlg->setMinimumDuration(1000); m_dlg->setAutoClose(true); m_dlg->progressBar()->setTotalSteps(100); @@ -95,10 +95,10 @@ tristate SQLiteVacuum::run() delete m_process; m_process = 0; if (m_result == true) { - const uint newSize = QFileInfo(m_filePath).size(); + const uint newSize = TQFileInfo(m_filePath).size(); const uint decrease = 100-100*newSize/origSize; KMessageBox::information(0, i18n("The database has been compacted. Current size decreased by %1% to %2.") - .arg(decrease).arg(KIO::convertSize(newSize))); + .tqarg(decrease).tqarg(KIO::convertSize(newSize))); } return m_result; } @@ -106,7 +106,7 @@ tristate SQLiteVacuum::run() void SQLiteVacuum::readFromStdout() { while (true) { - QString s( m_process->readLineStdout() ); //readStdout(); + TQString s( m_process->readLineStdout() ); //readStdout(); if (s.isEmpty()) break; m_dlg->progressBar()->setProgress(m_percent); @@ -118,7 +118,7 @@ void SQLiteVacuum::readFromStdout() if (s.mid(8,4)=="100%") { m_percent = 100; m_dlg->setAllowCancel(false); - m_dlg->setCursor(QCursor(Qt::WaitCursor)); + m_dlg->setCursor(TQCursor(TQt::WaitCursor)); } else if (s.mid(9,1)=="%") { m_percent = s.mid(8,1).toInt(); @@ -126,7 +126,7 @@ void SQLiteVacuum::readFromStdout() else if (s.mid(10,1)=="%") { m_percent = s.mid(8,2).toInt(); } - m_process->writeToStdin(" "); + m_process->writeToStdin(TQString(" ")); } } } @@ -142,7 +142,7 @@ void SQLiteVacuum::processExited() void SQLiteVacuum::cancelClicked() { if (!m_process->normalExit()) { - m_process->writeToStdin("q"); //quit + m_process->writeToStdin(TQString("q")); //quit m_result = cancelled; } } diff --git a/kexi/kexidb/drivers/sqlite/sqlitevacuum.h b/kexi/kexidb/drivers/sqlite/sqlitevacuum.h index 4424b7fc..27bcc7ef 100644 --- a/kexi/kexidb/drivers/sqlite/sqlitevacuum.h +++ b/kexi/kexidb/drivers/sqlite/sqlitevacuum.h @@ -20,12 +20,12 @@ #ifndef SQLITE_VACUUM_H #define SQLITE_VACUUM_H -#include <qobject.h> -#include <qstring.h> +#include <tqobject.h> +#include <tqstring.h> #include <kexiutils/tristate.h> -class QProcess; +class TQProcess; class KTempFile; class KProgressDialog; @@ -42,11 +42,12 @@ class KProgressDialog; creates a copy of the original database file, and replaces the orginal with the new only on success. */ -class SQLiteVacuum : public QObject +class SQLiteVacuum : public TQObject { Q_OBJECT + TQ_OBJECT public: - SQLiteVacuum(const QString& filePath); + SQLiteVacuum(const TQString& filePath); ~SQLiteVacuum(); /*! Performs compacting procedure. @@ -60,8 +61,8 @@ class SQLiteVacuum : public QObject void cancelClicked(); protected: - QString m_filePath; - QProcess *m_process; + TQString m_filePath; + TQProcess *m_process; KProgressDialog* m_dlg; int m_percent; tristate m_result; diff --git a/kexi/kexidb/drivers/sqlite2/sqlite2.pro b/kexi/kexidb/drivers/sqlite2/sqlite2.pro index e9597ebd..b3ac6156 100644 --- a/kexi/kexidb/drivers/sqlite2/sqlite2.pro +++ b/kexi/kexidb/drivers/sqlite2/sqlite2.pro @@ -2,9 +2,9 @@ include( ../sqlite/sqlite_common.pro ) LIBS += $$KDELIBDESTDIR/kexisql2$$KDELIBDEBUGLIB -INCLUDEPATH += $(KEXI)/3rdparty/kexisql/src ../sqlite/moc +INCLUDEPATH += $(KEXI)/3rdparty/kexisql/src ../sqlite/tqmoc -system( bash kmoc ../sqlite ) +system( bash ktqmoc ../sqlite ) DEFINES += SQLITE2 diff --git a/kexi/kexidb/error.h b/kexi/kexidb/error.h index 01ab8052..0485ce53 100644 --- a/kexi/kexidb/error.h +++ b/kexi/kexidb/error.h @@ -21,7 +21,7 @@ #ifndef _KEXI_ERROR_H_ #define _KEXI_ERROR_H_ -#include <qstring.h> +#include <tqstring.h> #include "kexidb/kexidb_export.h" @@ -121,14 +121,14 @@ class KEXI_DB_EXPORT ResultInfo success = true; allowToDiscardChanges = false; column = -1; - msg = QString::null; - desc = QString::null; + msg = TQString(); + desc = TQString(); } bool success : 1; //!< result of the operation, true by default bool allowToDiscardChanges : 1; //!< True if changes can be discarded, false by default //!< If true, additional "Discard changes" messagebox //!< button can be displayed. - QString msg, desc; //!< error message and detailed description, both empty by default + TQString msg, desc; //!< error message and detailed description, both empty by default int column; //!< faulty column, -1 (the default) means: there is no faulty column }; diff --git a/kexi/kexidb/expression.cpp b/kexi/kexidb/expression.cpp index 49bb231a..0428fdcf 100644 --- a/kexi/kexidb/expression.cpp +++ b/kexi/kexidb/expression.cpp @@ -30,9 +30,9 @@ #include <kdebug.h> #include <klocale.h> -#include <qdatetime.h> +#include <tqdatetime.h> -KEXI_DB_EXPORT QString KexiDB::exprClassName(int c) +KEXI_DB_EXPORT TQString KexiDB::exprClassName(int c) { if (c==KexiDBExpr_Unary) return "Unary"; @@ -80,9 +80,9 @@ Field::Type BaseExpr::type() return Field::InvalidType; } -QString BaseExpr::debugString() +TQString BaseExpr::debugString() { - return QString("BaseExpr(%1,type=%1)").arg(m_token).arg(Driver::defaultSQLTypeName(type())); + return TQString("BaseExpr(%1,type=%1)").tqarg(m_token).tqarg(Driver::defaultSQLTypeName(type())); } bool BaseExpr::validate(ParseInfo& /*parseInfo*/) @@ -93,22 +93,22 @@ bool BaseExpr::validate(ParseInfo& /*parseInfo*/) extern const char * const tname(int offset); #define safe_tname(token) ((token>=255 && token<=__LAST_TOKEN) ? tname(token-255) : "") -QString BaseExpr::tokenToDebugString(int token) +TQString BaseExpr::tokenToDebugString(int token) { if (token < 254) { if (isprint(token)) - return QString(QChar(uchar(token))); + return TQString(TQChar(uchar(token))); else - return QString::number(token); + return TQString::number(token); } - return QString(safe_tname(token)); + return TQString(safe_tname(token)); } -QString BaseExpr::tokenToString() +TQString BaseExpr::tokenToString() { if (m_token < 255 && isprint(m_token)) return tokenToDebugString(); - return QString::null; + return TQString(); } NArgExpr* BaseExpr::toNArg() { return dynamic_cast<NArgExpr*>(this); } @@ -144,9 +144,9 @@ NArgExpr* NArgExpr::copy() const return new NArgExpr(*this); } -QString NArgExpr::debugString() +TQString NArgExpr::debugString() { - QString s = QString("NArgExpr(") + TQString s = TQString("NArgExpr(") + "class=" + exprClassName(m_cl); for ( BaseExpr::ListIterator it(list); it.current(); ++it ) { s+=", "; @@ -156,9 +156,9 @@ QString NArgExpr::debugString() return s; } -QString NArgExpr::toString( QuerySchemaParameterValueListIterator* params ) +TQString NArgExpr::toString( QuerySchemaParameterValueListIterator* params ) { - QString s; + TQString s; s.reserve(256); foreach_list( BaseExpr::ListIterator, it, list) { if (!s.isEmpty()) @@ -236,17 +236,17 @@ UnaryExpr* UnaryExpr::copy() const return new UnaryExpr(*this); } -QString UnaryExpr::debugString() +TQString UnaryExpr::debugString() { return "UnaryExpr('" + tokenToDebugString() + "', " - + (m_arg ? m_arg->debugString() : QString("<NONE>")) - + QString(",type=%1)").arg(Driver::defaultSQLTypeName(type())); + + (m_arg ? m_arg->debugString() : TQString("<NONE>")) + + TQString(",type=%1)").tqarg(Driver::defaultSQLTypeName(type())); } -QString UnaryExpr::toString(QuerySchemaParameterValueListIterator* params) +TQString UnaryExpr::toString(QuerySchemaParameterValueListIterator* params) { - if (m_token=='(') //parentheses (special case) + if (m_token=='(') //tqparentheses (special case) return "(" + (m_arg ? m_arg->toString(params) : "<NULL>") + ")"; if (m_token < 255 && isprint(m_token)) return tokenToDebugString() + (m_arg ? m_arg->toString(params) : "<NULL>"); @@ -256,7 +256,7 @@ QString UnaryExpr::toString(QuerySchemaParameterValueListIterator* params) return (m_arg ? m_arg->toString(params) : "<NULL>") + " IS NULL"; if (m_token==SQL_IS_NOT_NULL) return (m_arg ? m_arg->toString(params) : "<NULL>") + " IS NOT NULL"; - return QString("{INVALID_OPERATOR#%1} ").arg(m_token) + (m_arg ? m_arg->toString(params) : "<NULL>"); + return TQString("{INVALID_OPERATOR#%1} ").tqarg(m_token) + (m_arg ? m_arg->toString(params) : "<NULL>"); } void UnaryExpr::getQueryParameters(QuerySchemaParameterList& params) @@ -319,7 +319,7 @@ bool UnaryExpr::validate(ParseInfo& parseInfo) } else { ERR("Niepoprawny argument typu '%s' dla operatora '%s'", - n->nodeTypeName(),is(NOT)?QString("not"):QChar(typ())); + n->nodeTypeName(),is(NOT)?TQString("not"):TQChar(typ())); } #endif } @@ -412,17 +412,17 @@ Field::Type BinaryExpr::type() return Field::Boolean; } -QString BinaryExpr::debugString() +TQString BinaryExpr::debugString() { - return QString("BinaryExpr(") + return TQString("BinaryExpr(") + "class=" + exprClassName(m_cl) - + "," + (m_larg ? m_larg->debugString() : QString("<NONE>")) + + "," + (m_larg ? m_larg->debugString() : TQString("<NONE>")) + ",'" + tokenToDebugString() + "'," - + (m_rarg ? m_rarg->debugString() : QString("<NONE>")) - + QString(",type=%1)").arg(Driver::defaultSQLTypeName(type())); + + (m_rarg ? m_rarg->debugString() : TQString("<NONE>")) + + TQString(",type=%1)").tqarg(Driver::defaultSQLTypeName(type())); } -QString BinaryExpr::tokenToString() +TQString BinaryExpr::tokenToString() { if (m_token < 255 && isprint(m_token)) return tokenToDebugString(); @@ -449,10 +449,10 @@ QString BinaryExpr::tokenToString() /* not handled here */ default:; } - return QString("{INVALID_BINARY_OPERATOR#%1} ").arg(m_token); + return TQString("{INVALID_BINARY_OPERATOR#%1} ").tqarg(m_token); } -QString BinaryExpr::toString(QuerySchemaParameterValueListIterator* params) +TQString BinaryExpr::toString(QuerySchemaParameterValueListIterator* params) { #define INFIX(a) \ (m_larg ? m_larg->toString(params) : "<NULL>") + " " + a + " " + (m_rarg ? m_rarg->toString(params) : "<NULL>") @@ -468,7 +468,7 @@ void BinaryExpr::getQueryParameters(QuerySchemaParameterList& params) } //========================================= -ConstExpr::ConstExpr( int token, const QVariant& val) +ConstExpr::ConstExpr( int token, const TQVariant& val) : BaseExpr( token ) , value(val) { @@ -497,8 +497,8 @@ Field::Type ConstExpr::type() else if (m_token==INTEGER_CONST) { //TODO ok? //TODO: add sign info? - if (value.type() == QVariant::Int || value.type() == QVariant::UInt) { - Q_LLONG v = value.toInt(); + if (value.type() == TQVariant::Int || value.type() == TQVariant::UInt) { + TQ_LLONG v = value.toInt(); if (v <= 0xff && v > -0x80) return Field::Byte; if (v <= 0xffff && v > -0x8000) @@ -526,13 +526,13 @@ Field::Type ConstExpr::type() return Field::InvalidType; } -QString ConstExpr::debugString() +TQString ConstExpr::debugString() { - return QString("ConstExpr('") + tokenToDebugString() +"'," + toString() - + QString(",type=%1)").arg(Driver::defaultSQLTypeName(type())); + return TQString("ConstExpr('") + tokenToDebugString() +"'," + toString() + + TQString(",type=%1)").tqarg(Driver::defaultSQLTypeName(type())); } -QString ConstExpr::toString(QuerySchemaParameterValueListIterator* params) +TQString ConstExpr::toString(QuerySchemaParameterValueListIterator* params) { Q_UNUSED(params); if (m_token==SQL_NULL) @@ -541,7 +541,7 @@ QString ConstExpr::toString(QuerySchemaParameterValueListIterator* params) //TODO: better escaping! return "'" + value.toString() + "'"; else if (m_token==REAL_CONST) - return QString::number(value.toPoint().x())+"."+QString::number(value.toPoint().y()); + return TQString::number(value.toPoint().x())+"."+TQString::number(value.toPoint().y()); else if (m_token==DATE_CONST) return "'" + value.toDate().toString(Qt::ISODate) + "'"; else if (m_token==DATETIME_CONST) @@ -567,8 +567,8 @@ bool ConstExpr::validate(ParseInfo& parseInfo) } //========================================= -QueryParameterExpr::QueryParameterExpr(const QString& message) -: ConstExpr( QUERY_PARAMETER, message ) +QueryParameterExpr::QueryParameterExpr(const TQString& message) +: ConstExpr( TQUERY_PARAMETER, message ) , m_type(Field::Text) { m_cl = KexiDBExpr_QueryParameter; @@ -599,15 +599,15 @@ void QueryParameterExpr::setType(Field::Type type) m_type = type; } -QString QueryParameterExpr::debugString() +TQString QueryParameterExpr::debugString() { - return QString("QueryParameterExpr('") + QString::fromLatin1("[%2]").arg(value.toString()) - + QString("',type=%1)").arg(Driver::defaultSQLTypeName(type())); + return TQString("QueryParameterExpr('") + TQString::tqfromLatin1("[%2]").tqarg(value.toString()) + + TQString("',type=%1)").tqarg(Driver::defaultSQLTypeName(type())); } -QString QueryParameterExpr::toString(QuerySchemaParameterValueListIterator* params) +TQString QueryParameterExpr::toString(QuerySchemaParameterValueListIterator* params) { - return params ? params->getPreviousValueAsString(type()) : QString::fromLatin1("[%2]").arg(value.toString()); + return params ? params->getPreviousValueAsString(type()) : TQString::tqfromLatin1("[%2]").tqarg(value.toString()); } void QueryParameterExpr::getQueryParameters(QuerySchemaParameterList& params) @@ -625,7 +625,7 @@ bool QueryParameterExpr::validate(ParseInfo& parseInfo) } //========================================= -VariableExpr::VariableExpr(const QString& _name) +VariableExpr::VariableExpr(const TQString& _name) : BaseExpr( 0/*undefined*/ ) , name(_name) , field(0) @@ -653,13 +653,13 @@ VariableExpr* VariableExpr::copy() const return new VariableExpr(*this); } -QString VariableExpr::debugString() +TQString VariableExpr::debugString() { - return QString("VariableExpr(") + name - + QString(",type=%1)").arg(field ? Driver::defaultSQLTypeName(type()) : QString("FIELD NOT DEFINED YET")); + return TQString("VariableExpr(") + name + + TQString(",type=%1)").tqarg(field ? Driver::defaultSQLTypeName(type()) : TQString("FIELD NOT DEFINED YET")); } -QString VariableExpr::toString(QuerySchemaParameterValueListIterator* params) +TQString VariableExpr::toString(QuerySchemaParameterValueListIterator* params) { Q_UNUSED(params); return name; @@ -692,8 +692,8 @@ bool VariableExpr::validate(ParseInfo& parseInfo) /* taken from parser's addColumn(): */ KexiDBDbg << "checking variable name: " << name << endl; - int dotPos = name.find('.'); - QString tableName, fieldName; + int dotPos = name.tqfind('.'); + TQString tableName, fieldName; //TODO: shall we also support db name? if (dotPos>0) { tableName = name.left(dotPos); @@ -719,15 +719,15 @@ bool VariableExpr::validate(ParseInfo& parseInfo) parseInfo.errMsg = i18n("Ambiguous field name"); parseInfo.errDescr = 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) { parseInfo.errMsg = i18n("Field not found"); - parseInfo.errDescr = i18n("Table containing \"%1\" field not found").arg(fieldName); + parseInfo.errDescr = i18n("Table containing \"%1\" field not found").tqarg(fieldName); return false; } //ok @@ -741,9 +741,9 @@ bool VariableExpr::validate(ParseInfo& parseInfo) 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); @@ -754,8 +754,8 @@ bool VariableExpr::validate(ParseInfo& parseInfo) if (covered) { parseInfo.errMsg = i18n("Could not access the table directly using its name"); parseInfo.errDescr = 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(TQString(tableName+"."+fieldName)).tqarg(TQString(tableAlias+"."+fieldName.latin1())); return false; } } @@ -773,11 +773,11 @@ bool VariableExpr::validate(ParseInfo& parseInfo) if (!ts) { parseInfo.errMsg = i18n("Table not found"); - parseInfo.errDescr = i18n("Unknown table \"%1\"").arg(tableName); + parseInfo.errDescr = i18n("Unknown table \"%1\"").tqarg(tableName); return false; } - QValueList<int> *positionsList = parseInfo.repeatedTablesAndAliases[ tableName ]; + TQValueList<int> *positionsList = parseInfo.repeatedTablesAndAliases[ tableName ]; if (!positionsList) { //for sanity IMPL_ERROR(tableName + "." + fieldName + ", !positionsList "); return false; @@ -786,8 +786,8 @@ bool VariableExpr::validate(ParseInfo& parseInfo) //it's a table.* if (fieldName=="*") { if (positionsList->count()>1) { - parseInfo.errMsg = i18n("Ambiguous \"%1.*\" expression").arg(tableName); - parseInfo.errDescr = i18n("More than one \"%1\" table or alias defined").arg(tableName); + parseInfo.errMsg = i18n("Ambiguous \"%1.*\" expression").tqarg(tableName); + parseInfo.errDescr = i18n("More than one \"%1\" table or alias defined").tqarg(tableName); return false; } tableForQueryAsterisk = ts; @@ -800,14 +800,14 @@ bool VariableExpr::validate(ParseInfo& parseInfo) if (!realField) { parseInfo.errMsg = i18n("Field not found"); parseInfo.errDescr = i18n("Table \"%1\" has no \"%2\" field") - .arg(tableName).arg(fieldName); + .tqarg(tableName).tqarg(fieldName); return false; } // 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); @@ -815,9 +815,9 @@ bool VariableExpr::validate(ParseInfo& parseInfo) numberOfTheSameFields++; if (numberOfTheSameFields>1) { parseInfo.errMsg = i18n("Ambiguous \"%1.%2\" expression") - .arg(tableName).arg(fieldName); + .tqarg(tableName).tqarg(fieldName); parseInfo.errDescr = i18n("More than one \"%1\" table or alias defined containing \"%2\" field") - .arg(tableName).arg(fieldName); + .tqarg(tableName).tqarg(fieldName); return false; } } @@ -829,11 +829,11 @@ bool VariableExpr::validate(ParseInfo& parseInfo) } //========================================= -static QValueList<QCString> FunctionExpr_builtIns; +static TQValueList<TQCString> FunctionExpr_builtIns; static const char* FunctionExpr_builtIns_[] = {"SUM", "MIN", "MAX", "AVG", "COUNT", "STD", "STDDEV", "VARIANCE", 0 }; -QValueList<QCString> FunctionExpr::builtInAggregates() +TQValueList<TQCString> FunctionExpr::builtInAggregates() { if (FunctionExpr_builtIns.isEmpty()) { for (const char **p = FunctionExpr_builtIns_; *p; p++) @@ -842,7 +842,7 @@ QValueList<QCString> FunctionExpr::builtInAggregates() return FunctionExpr_builtIns; } -FunctionExpr::FunctionExpr( const QString& _name, NArgExpr* args_ ) +FunctionExpr::FunctionExpr( const TQString& _name, NArgExpr* args_ ) : BaseExpr( 0/*undefined*/ ) , name(_name) , args(args_) @@ -874,19 +874,19 @@ FunctionExpr* FunctionExpr::copy() const return new FunctionExpr(*this); } -QString FunctionExpr::debugString() +TQString FunctionExpr::debugString() { - QString res; - res.append( QString("FunctionExpr(") + name ); + TQString res; + res.append( TQString("FunctionExpr(") + name ); if (args) - res.append(QString(",") + args->debugString()); - res.append(QString(",type=%1)").arg(Driver::defaultSQLTypeName(type()))); + res.append(TQString(",") + args->debugString()); + res.append(TQString(",type=%1)").tqarg(Driver::defaultSQLTypeName(type()))); return res; } -QString FunctionExpr::toString(QuerySchemaParameterValueListIterator* params) +TQString FunctionExpr::toString(QuerySchemaParameterValueListIterator* params) { - return name + "(" + (args ? args->toString(params) : QString::null) + ")"; + return name + "(" + (args ? args->toString(params) : TQString()) + ")"; } void FunctionExpr::getQueryParameters(QuerySchemaParameterList& params) @@ -908,7 +908,7 @@ bool FunctionExpr::validate(ParseInfo& parseInfo) return args ? args->validate(parseInfo) : true; } -bool FunctionExpr::isBuiltInAggregate(const QCString& fname) +bool FunctionExpr::isBuiltInAggregate(const TQCString& fname) { - return builtInAggregates().find(fname.upper())!=FunctionExpr_builtIns.end(); + return builtInAggregates().tqfind(fname.upper())!=FunctionExpr_builtIns.end(); } diff --git a/kexi/kexidb/expression.h b/kexi/kexidb/expression.h index 6ee98f32..ee2c9810 100644 --- a/kexi/kexidb/expression.h +++ b/kexi/kexidb/expression.h @@ -49,7 +49,7 @@ namespace KexiDB { //#define KEXIDB_CUSTOM_TOKEN 0x1000 //! \return class name of class \a c -KEXI_DB_EXPORT QString exprClassName(int c); +KEXI_DB_EXPORT TQString exprClassName(int c); class ParseInfo; class NArgExpr; @@ -66,8 +66,8 @@ class QuerySchemaParameterValueListIterator; class KEXI_DB_EXPORT BaseExpr { public: - typedef QPtrList<BaseExpr> List; - typedef QPtrListIterator<BaseExpr> ListIterator; + typedef TQPtrList<BaseExpr> List; + typedef TQPtrListIterator<BaseExpr> ListIterator; BaseExpr(int token); virtual ~BaseExpr(); @@ -80,7 +80,7 @@ public: virtual Field::Type type(); - BaseExpr* parent() const { return m_par; } + BaseExpr* tqparent() const { return m_par; } virtual void setParent(BaseExpr *p) { m_par = p; } @@ -89,7 +89,7 @@ public: /*! \return string as a representation of this expression element by running recursive calls. \a param, if not 0, points to a list item containing value of a query parameter (used in QueryParameterExpr). */ - virtual QString toString(QuerySchemaParameterValueListIterator* params = 0) = 0; + virtual TQString toString(QuerySchemaParameterValueListIterator* params = 0) = 0; /*! Collects query parameters (messages and types) reculsively and saves them to params. The leaf nodes are objects of QueryParameterExpr class. */ @@ -97,16 +97,16 @@ public: inline void debug() { KexiDBDbg << debugString() << endl; } - virtual QString debugString(); + virtual TQString debugString(); /*! \return single character if the token is < 256 or token name, e.g. LESS_OR_EQUAL (for debugging). */ - inline QString tokenToDebugString() { return tokenToDebugString(m_token); } + inline TQString tokenToDebugString() { return tokenToDebugString(m_token); } - static QString tokenToDebugString(int token); + static TQString tokenToDebugString(int token); /*! \return string for token, like "<=" or ">" */ - virtual QString tokenToString(); + virtual TQString tokenToString(); int exprClass() const { return m_cl; } @@ -121,7 +121,7 @@ public: protected: int m_cl; //!< class - BaseExpr *m_par; //!< parent expression + BaseExpr *m_par; //!< tqparent expression int m_token; }; @@ -138,8 +138,8 @@ public: void prepend(BaseExpr *expr); BaseExpr *arg(int n); int args(); - virtual QString debugString(); - virtual QString toString(QuerySchemaParameterValueListIterator* params = 0); + virtual TQString debugString(); + virtual TQString toString(QuerySchemaParameterValueListIterator* params = 0); virtual void getQueryParameters(QuerySchemaParameterList& params); virtual bool validate(ParseInfo& parseInfo); BaseExpr::List list; @@ -155,8 +155,8 @@ public: //! \return a deep copy of this object. virtual UnaryExpr* copy() const; virtual Field::Type type(); - virtual QString debugString(); - virtual QString toString(QuerySchemaParameterValueListIterator* params = 0); + virtual TQString debugString(); + virtual TQString toString(QuerySchemaParameterValueListIterator* params = 0); virtual void getQueryParameters(QuerySchemaParameterList& params); BaseExpr *arg() const { return m_arg; } virtual bool validate(ParseInfo& parseInfo); @@ -181,13 +181,13 @@ public: //! \return a deep copy of this object. virtual BinaryExpr* copy() const; virtual Field::Type type(); - virtual QString debugString(); - virtual QString toString(QuerySchemaParameterValueListIterator* params = 0); + virtual TQString debugString(); + virtual TQString toString(QuerySchemaParameterValueListIterator* params = 0); virtual void getQueryParameters(QuerySchemaParameterList& params); BaseExpr *left() const { return m_larg; } BaseExpr *right() const { return m_rarg; } virtual bool validate(ParseInfo& parseInfo); - virtual QString tokenToString(); + virtual TQString tokenToString(); BaseExpr *m_larg; BaseExpr *m_rarg; @@ -199,17 +199,17 @@ public: class KEXI_DB_EXPORT ConstExpr : public BaseExpr { public: - ConstExpr(int token, const QVariant& val); + ConstExpr(int token, const TQVariant& val); ConstExpr(const ConstExpr& expr); virtual ~ConstExpr(); //! \return a deep copy of this object. virtual ConstExpr* copy() const; virtual Field::Type type(); - virtual QString debugString(); - virtual QString toString(QuerySchemaParameterValueListIterator* params = 0); + virtual TQString debugString(); + virtual TQString toString(QuerySchemaParameterValueListIterator* params = 0); virtual void getQueryParameters(QuerySchemaParameterList& params); virtual bool validate(ParseInfo& parseInfo); - QVariant value; + TQVariant value; }; //! Query parameter used to getting user input of constant values. @@ -217,14 +217,14 @@ public: class KEXI_DB_EXPORT QueryParameterExpr : public ConstExpr { public: - QueryParameterExpr(const QString& message); + QueryParameterExpr(const TQString& message); QueryParameterExpr(const QueryParameterExpr& expr); virtual ~QueryParameterExpr(); //! \return a deep copy of this object. virtual QueryParameterExpr* copy() const; virtual Field::Type type(); /*! Sets expected type of the parameter. The default is String. - This method is called from parent's expression validate(). + This method is called from tqparent's expression validate(). This depends on the type of the related expression. For instance: query "SELECT * FROM cars WHERE name=[enter name]", "[enter name]" has parameter of the same type as "name" field. @@ -232,8 +232,8 @@ public: of the expression and then the right side will have type set to String. */ void setType(Field::Type type); - virtual QString debugString(); - virtual QString toString(QuerySchemaParameterValueListIterator* params = 0); + virtual TQString debugString(); + virtual TQString toString(QuerySchemaParameterValueListIterator* params = 0); virtual void getQueryParameters(QuerySchemaParameterList& params); virtual bool validate(ParseInfo& parseInfo); protected: @@ -244,14 +244,14 @@ protected: class KEXI_DB_EXPORT VariableExpr : public BaseExpr { public: - VariableExpr(const QString& _name); + VariableExpr(const TQString& _name); VariableExpr(const VariableExpr& expr); virtual ~VariableExpr(); //! \return a deep copy of this object. virtual VariableExpr* copy() const; virtual Field::Type type(); - virtual QString debugString(); - virtual QString toString(QuerySchemaParameterValueListIterator* params = 0); + virtual TQString debugString(); + virtual TQString toString(QuerySchemaParameterValueListIterator* params = 0); virtual void getQueryParameters(QuerySchemaParameterList& params); /*! Validation. Sets field, tablePositionForField @@ -260,7 +260,7 @@ public: virtual bool validate(ParseInfo& parseInfo); /*! Verbatim name as returned by scanner. */ - QString name; + TQString name; /* NULL by default. After successful validate() it will point to a field, if the variable is of a form "tablename.fieldname" or "fieldname", @@ -288,21 +288,21 @@ public: class KEXI_DB_EXPORT FunctionExpr : public BaseExpr { public: - FunctionExpr(const QString& _name, NArgExpr* args_ = 0); + FunctionExpr(const TQString& _name, NArgExpr* args_ = 0); FunctionExpr(const FunctionExpr& expr); virtual ~FunctionExpr(); //! \return a deep copy of this object. virtual FunctionExpr* copy() const; virtual Field::Type type(); - virtual QString debugString(); - virtual QString toString(QuerySchemaParameterValueListIterator* params = 0); + virtual TQString debugString(); + virtual TQString toString(QuerySchemaParameterValueListIterator* params = 0); virtual void getQueryParameters(QuerySchemaParameterList& params); virtual bool validate(ParseInfo& parseInfo); - static QValueList<QCString> builtInAggregates(); - static bool isBuiltInAggregate(const QCString& fname); + static TQValueList<TQCString> builtInAggregates(); + static bool isBuiltInAggregate(const TQCString& fname); - QString name; + TQString name; NArgExpr* args; }; diff --git a/kexi/kexidb/field.cpp b/kexi/kexidb/field.cpp index 88233272..97c4ae58 100644 --- a/kexi/kexidb/field.cpp +++ b/kexi/kexidb/field.cpp @@ -29,7 +29,7 @@ #include <kdebug.h> #include <klocale.h> -#include <qdatetime.h> +#include <tqdatetime.h> #include <assert.h> @@ -63,9 +63,9 @@ Field::Field(QuerySchema *querySchema, BaseExpr* expr) setExpression(expr); } -Field::Field(const QString& name, Type ctype, +Field::Field(const TQString& name, Type ctype, uint cconst, uint options, uint length, uint precision, - QVariant defaultValue, const QString& caption, const QString& description, + TQVariant defaultValue, const TQString& caption, const TQString& description, uint width) : m_parent(0) ,m_name(name.lower()) @@ -124,7 +124,7 @@ void Field::init() m_precision = 0; m_visibleDecimalPlaces = -1; m_options = NoOptions; - m_defaultValue = QVariant(QString::null); + m_defaultValue = TQVariant(TQString()); m_order = -1; m_width = 0; m_expr = 0; @@ -138,7 +138,7 @@ Field::Type Field::type() const return m_type; } -QVariant::Type Field::variantType(uint type) +TQVariant::Type Field::variantType(uint type) { switch(type) { @@ -146,67 +146,67 @@ QVariant::Type Field::variantType(uint type) case ShortInteger: case Integer: case BigInteger: - return QVariant::Int; + return TQVariant::Int; case Boolean: - return QVariant::Bool; + return TQVariant::Bool; case Date: - return QVariant::Date; + return TQVariant::Date; case DateTime: - return QVariant::DateTime; + return TQVariant::DateTime; case Time: - return QVariant::Time; + return TQVariant::Time; case Float: case Double: - return QVariant::Double; + return TQVariant::Double; case Text: case LongText: - return QVariant::String; + return TQVariant::String; case BLOB: - return QVariant::ByteArray; + return TQVariant::ByteArray; default: - return QVariant::Invalid; + return TQVariant::Invalid; } - return QVariant::Invalid; + return TQVariant::Invalid; } -QString Field::typeName(uint type) +TQString Field::typeName(uint type) { m_typeNames.init(); - return (type <= LastType) ? m_typeNames.at(type) : QString::number(type); + return (type <= LastType) ? m_typeNames.at(type) : TQString::number(type); } -QString Field::typeString(uint type) +TQString Field::typeString(uint type) { m_typeNames.init(); - return (type <= LastType) ? m_typeNames.at((int)LastType+1 + type) : QString("Type%1").arg(type); + return (type <= LastType) ? m_typeNames.at((int)LastType+1 + type) : TQString("Type%1").tqarg(type); } -QString Field::typeGroupName(uint typeGroup) +TQString Field::typeGroupName(uint typeGroup) { m_typeGroupNames.init(); return (typeGroup <= LastTypeGroup) ? m_typeGroupNames.at(typeGroup) : typeGroupString(typeGroup); } -QString Field::typeGroupString(uint typeGroup) +TQString Field::typeGroupString(uint typeGroup) { m_typeGroupNames.init(); - return (typeGroup <= LastTypeGroup) ? m_typeGroupNames.at((int)LastTypeGroup+1 + typeGroup) : QString("TypeGroup%1").arg(typeGroup); + return (typeGroup <= LastTypeGroup) ? m_typeGroupNames.at((int)LastTypeGroup+1 + typeGroup) : TQString("TypeGroup%1").tqarg(typeGroup); } -Field::Type Field::typeForString(const QString& typeString) +Field::Type Field::typeForString(const TQString& typeString) { m_typeNames.init(); - QMap<QString,Type>::ConstIterator it = m_typeNames.str2num.find(typeString.lower()); + TQMap<TQString,Type>::ConstIterator it = m_typeNames.str2num.tqfind(typeString.lower()); if (it==m_typeNames.str2num.end()) return InvalidType; return it.data(); } -Field::TypeGroup Field::typeGroupForString(const QString& typeGroupString) +Field::TypeGroup Field::typeGroupForString(const TQString& typeGroupString) { m_typeGroupNames.init(); - QMap<QString,TypeGroup>::ConstIterator it = m_typeGroupNames.str2num.find(typeGroupString.lower()); + TQMap<TQString,TypeGroup>::ConstIterator it = m_typeGroupNames.str2num.tqfind(typeGroupString.lower()); if (it==m_typeGroupNames.str2num.end()) return InvalidGroup; return it.data(); @@ -321,7 +321,7 @@ Field::setQuery(QuerySchema *querySchema) } void -Field::setName(const QString& n) +Field::setName(const TQString& n) { m_name = n.lower(); } @@ -330,7 +330,7 @@ void Field::setType(Type t) { if (m_expr) { - KexiDBWarn << QString("Field::setType(%1)").arg(t) + KexiDBWarn << TQString("Field::setType(%1)").tqarg(t) << " could not set type because the field has expression assigned!" << endl; return; } @@ -393,16 +393,16 @@ Field::setUnsigned(bool u) } void -Field::setDefaultValue(const QVariant& def) +Field::setDefaultValue(const TQVariant& def) { m_defaultValue = def; } bool -Field::setDefaultValue(const QCString& def) +Field::setDefaultValue(const TQCString& def) { if (def.isNull()) { - m_defaultValue = QVariant(); + m_defaultValue = TQVariant(); return true; } @@ -412,101 +412,101 @@ Field::setDefaultValue(const QCString& def) case Byte: { unsigned int v = def.toUInt(&ok); if (!ok || v > 255) - m_defaultValue = QVariant(); + m_defaultValue = TQVariant(); else - m_defaultValue = QVariant(v); + m_defaultValue = TQVariant(v); break; }case ShortInteger: { int v = def.toInt(&ok); if (!ok || (!(m_options & Unsigned) && (v < -32768 || v > 32767)) || ((m_options & Unsigned) && (v < 0 || v > 65535))) - m_defaultValue = QVariant(); + m_defaultValue = TQVariant(); else - m_defaultValue = QVariant(v); + m_defaultValue = TQVariant(v); break; }case Integer: {//4 bytes long v = def.toLong(&ok); //js: FIXME if (!ok || (!(m_options & Unsigned) && (-v > 0x080000000 || v > (0x080000000-1))) || ((m_options & Unsigned) && (v < 0 || v > 0x100000000))) if (!ok || (!(m_options & Unsigned) && (-v > (int)0x07FFFFFFF || v > (int)(0x080000000-1)))) - m_defaultValue = QVariant(); + m_defaultValue = TQVariant(); else - m_defaultValue = QVariant((Q_LLONG)v); + m_defaultValue = TQVariant((TQ_LLONG)v); break; }case BigInteger: {//8 bytes //! @todo BigInteger support /* - Q_LLONG long v = def.toLongLong(&ok); + TQ_LLONG long v = def.toLongLong(&ok); //TODO: 2-part decoding if (!ok || (!(m_options & Unsigned) && (-v > 0x080000000 || v > (0x080000000-1)))) - m_defaultValue = QVariant(); + m_defaultValue = TQVariant(); else if (m_options & Unsigned) - m_defaultValue=QVariant((Q_ULLONG) v); + m_defaultValue=TQVariant((TQ_ULLONG) v); else - m_defaultValue = QVariant((Q_LLONG)v);*/ + m_defaultValue = TQVariant((TQ_LLONG)v);*/ break; }case Boolean: { unsigned short v = def.toUShort(&ok); if (!ok || v > 1) - m_defaultValue = QVariant(); + m_defaultValue = TQVariant(); else - m_defaultValue = QVariant((bool)v); + m_defaultValue = TQVariant((bool)v); break; }case Date: {//YYYY-MM-DD - QDate date = QDate::fromString( def, Qt::ISODate ); + TQDate date = TQDate::fromString( def, Qt::ISODate ); if (!date.isValid()) - m_defaultValue = QVariant(); + m_defaultValue = TQVariant(); else - m_defaultValue = QVariant(date); + m_defaultValue = TQVariant(date); break; }case DateTime: {//YYYY-MM-DDTHH:MM:SS - QDateTime dt = QDateTime::fromString( def, Qt::ISODate ); + TQDateTime dt = TQDateTime::fromString( def, Qt::ISODate ); if (!dt.isValid()) - m_defaultValue = QVariant(); + m_defaultValue = TQVariant(); else - m_defaultValue = QVariant(dt); + m_defaultValue = TQVariant(dt); break; }case Time: {//HH:MM:SS - QTime time = QTime::fromString( def, Qt::ISODate ); + TQTime time = TQTime::fromString( def, Qt::ISODate ); if (!time.isValid()) - m_defaultValue = QVariant(); + m_defaultValue = TQVariant(); else - m_defaultValue = QVariant(time); + m_defaultValue = TQVariant(time); break; }case Float: { float v = def.toFloat(&ok); if (!ok || ((m_options & Unsigned) && (v < 0.0))) - m_defaultValue = QVariant(); + m_defaultValue = TQVariant(); else - m_defaultValue = QVariant(v); + m_defaultValue = TQVariant(v); break; }case Double: { double v = def.toDouble(&ok); if (!ok || ((m_options & Unsigned) && (v < 0.0))) - m_defaultValue = QVariant(); + m_defaultValue = TQVariant(); else - m_defaultValue = QVariant(v); + m_defaultValue = TQVariant(v); break; }case Text: { if (def.isNull() || (def.length() > 255)) - m_defaultValue = QVariant(); + m_defaultValue = TQVariant(); else - m_defaultValue = QVariant((QString)def); + m_defaultValue = TQVariant((TQString)def); break; }case LongText: { if (def.isNull()) - m_defaultValue = QVariant(); + m_defaultValue = TQVariant(); else - m_defaultValue = QVariant((QString)def); + m_defaultValue = TQVariant((TQString)def); break; }case BLOB: { //TODO if (def.isNull()) - m_defaultValue = QVariant(); + m_defaultValue = TQVariant(); else - m_defaultValue = QVariant(def); + m_defaultValue = TQVariant(def); break; }default: - m_defaultValue = QVariant(); + m_defaultValue = TQVariant(); } return m_defaultValue.isNull(); } @@ -580,25 +580,25 @@ void Field::setIndexed(bool s) } -QString Field::debugString() const +TQString Field::debugString() const { KexiDB::Connection *conn = table() ? table()->connection() : 0; - QString dbg = (m_name.isEmpty() ? "<NONAME> " : m_name + " "); + TQString dbg = (m_name.isEmpty() ? "<NONAME> " : m_name + " "); if (m_options & Field::Unsigned) dbg += " UNSIGNED "; dbg += (conn && conn->driver()) ? conn->driver()->sqlTypeName(type()) : Driver::defaultSQLTypeName(type()); if (isFPNumericType() && m_precision>0) { if (scale()>0) - dbg += QString::fromLatin1("(%1,%2)").arg(m_precision).arg(scale()); + dbg += TQString::tqfromLatin1("(%1,%2)").tqarg(m_precision).tqarg(scale()); else - dbg += QString::fromLatin1("(%1)").arg(m_precision); + dbg += TQString::tqfromLatin1("(%1)").tqarg(m_precision); } else if (m_type==Field::Text && m_length>0) - dbg += QString::fromLatin1("(%1)").arg(m_length); + dbg += TQString::tqfromLatin1("(%1)").tqarg(m_length); if (m_constraints & Field::AutoInc) dbg += " AUTOINC"; if (m_constraints & Field::Unique) - dbg += " UNIQUE"; + dbg += " UNITQUE"; if (m_constraints & Field::PrimaryKey) dbg += " PKEY"; if (m_constraints & Field::ForeignKey) @@ -608,18 +608,18 @@ QString Field::debugString() const if (m_constraints & Field::NotEmpty) dbg += " NOTEMPTY"; if (!m_defaultValue.isNull()) - dbg += QString(" DEFAULT=[%1]").arg(m_defaultValue.typeName()) + KexiDB::variantToString(m_defaultValue); + dbg += TQString(" DEFAULT=[%1]").tqarg(m_defaultValue.typeName()) + KexiDB::variantToString(m_defaultValue); if (m_expr) dbg += " EXPRESSION=" + m_expr->debugString(); if (m_customProperties && !m_customProperties->isEmpty()) { - dbg += QString(" CUSTOM PROPERTIES (%1): ").arg(m_customProperties->count()); + dbg += TQString(" CUSTOM PROPERTIES (%1): ").tqarg(m_customProperties->count()); bool first = true; foreach (CustomPropertiesMap::ConstIterator, it, *m_customProperties) { if (first) first = false; else dbg += ", "; - dbg += QString("%1 = %2 (%3)").arg(it.key()).arg(it.data().toString()).arg(it.data().typeName()); + dbg += TQString("%1 = %2 (%3)").tqarg(TQString(it.key())).tqarg(TQString(it.data().toString())).tqarg(TQString(it.data().typeName())); } } return dbg; @@ -641,18 +641,18 @@ void Field::setExpression(KexiDB::BaseExpr *expr) m_expr = expr; } -QVariant Field::customProperty(const QCString& propertyName, - const QVariant& defaultValue) const +TQVariant Field::customProperty(const TQCString& propertyName, + const TQVariant& defaultValue) const { if (!m_customProperties) return defaultValue; - CustomPropertiesMap::ConstIterator it(m_customProperties->find(propertyName)); + CustomPropertiesMap::ConstIterator it(m_customProperties->tqfind(propertyName)); if (it==m_customProperties->constEnd()) return defaultValue; return it.data(); } -void Field::setCustomProperty(const QCString& propertyName, const QVariant& value) +void Field::setCustomProperty(const TQCString& propertyName, const TQVariant& value) { if (propertyName.isEmpty()) return; @@ -664,13 +664,13 @@ void Field::setCustomProperty(const QCString& propertyName, const QVariant& valu //------------------------------------------------------- #define ADDTYPE(type, i18, str) this->at(Field::type) = i18; \ this->at(Field::type+Field::LastType+1) = str; \ - str2num.insert(QString::fromLatin1(str).lower(), type) + str2num.insert(TQString::tqfromLatin1(str).lower(), type) #define ADDGROUP(type, i18, str) this->at(Field::type) = i18; \ this->at(Field::type+Field::LastTypeGroup+1) = str; \ - str2num.insert(QString::fromLatin1(str).lower(), type) + str2num.insert(TQString::tqfromLatin1(str).lower(), type) Field::FieldTypeNames::FieldTypeNames() - : QValueVector<QString>() + : TQValueVector<TQString>() , m_initialized(false) { } @@ -701,7 +701,7 @@ void Field::FieldTypeNames::init() //------------------------------------------------------- Field::FieldTypeGroupNames::FieldTypeGroupNames() - : QValueVector<QString>() + : TQValueVector<TQString>() , m_initialized(false) { } diff --git a/kexi/kexidb/field.h b/kexi/kexidb/field.h index 1fec04f6..9e0c9480 100644 --- a/kexi/kexidb/field.h +++ b/kexi/kexidb/field.h @@ -22,11 +22,11 @@ #ifndef KEXIDB_FIELD_H #define KEXIDB_FIELD_H -#include <qvariant.h> -#include <qstring.h> -#include <qpair.h> -#include <qvaluevector.h> -#include <qptrvector.h> +#include <tqvariant.h> +#include <tqstring.h> +#include <tqpair.h> +#include <tqvaluevector.h> +#include <tqptrvector.h> #include "kexidb/kexidb_export.h" namespace KexiDB { @@ -57,8 +57,8 @@ class BaseExpr; Note that aliases for fields are defined within query, not in Field object, because the same field can be used in different queries with different alias. - Notes for advanced use: Field obeject is designed to be owned by a parent object. - Such a parent object can be KexiDB::TableSchema, if the field defines single table column, + Notes for advanced use: Field obeject is designed to be owned by a tqparent object. + Such a tqparent object can be KexiDB::TableSchema, if the field defines single table column, or KexiDB::QuerySchema, if the field defines an expression (KexiDB::BaseExpr class). Using expression class for fields allos to define expressions within queries like @@ -72,11 +72,11 @@ class BaseExpr; class KEXI_DB_EXPORT Field { public: - typedef QPtrList<Field> List; //!< list of fields - typedef QPtrVector<Field> Vector; //!< vector of fields - typedef QPtrListIterator<Field> ListIterator; //!< iterator for list of fields - typedef QPair<Field*,Field*> Pair; //!< fields pair - typedef QPtrList<Pair> PairList; //!< list of fields pair + typedef TQPtrList<Field> List; //!< list of fields + typedef TQPtrVector<Field> Vector; //!< vector of fields + typedef TQPtrListIterator<Field> ListIterator; //!< iterator for list of fields + typedef TQPair<Field*,Field*> Pair; //!< fields pair + typedef TQPtrList<Pair> PairList; //!< list of fields pair /*! Unified (most common used) types of fields. */ enum Type @@ -154,13 +154,13 @@ class KEXI_DB_EXPORT Field Field(); /*! Creates a database field with specified properties. */ - Field(const QString& name, Type ctype, + Field(const TQString& name, Type ctype, uint cconst=NoConstraints, uint options = NoOptions, uint length=0, uint precision=0, - QVariant defaultValue=QVariant(), - const QString& caption = QString::null, - const QString& description = QString::null, + TQVariant defaultValue=TQVariant(), + const TQString& caption = TQString(), + const TQString& description = TQString(), uint width = 0); /*! Copy constructor. */ @@ -168,38 +168,38 @@ class KEXI_DB_EXPORT Field virtual ~Field(); - //! Converts type \a type to QVariant equivalent as accurate as possible - static QVariant::Type variantType(uint type); + //! Converts type \a type to TQVariant equivalent as accurate as possible + static TQVariant::Type variantType(uint type); /*! \return a i18n'd type name for \a type (\a type has to be an element from Field::Type, not greater than Field::LastType) */ - static QString typeName(uint type); + static TQString typeName(uint type); /*! \return type string for \a type, e.g. "Integer" for Integer type (not-i18n'd, \a type has to be an element from Field::Type, not greater than Field::LastType) */ - static QString typeString(uint type); + static TQString typeString(uint type); /*! \return type for a given \a typeString */ - static Type typeForString(const QString& typeString); + static Type typeForString(const TQString& typeString); /*! \return type group for a given \a typeGroupString */ - static TypeGroup typeGroupForString(const QString& typeGroupString); + static TypeGroup typeGroupForString(const TQString& typeGroupString); /*! \return group for \a type */ static TypeGroup typeGroup(uint type); /*! \return a i18n'd group name for \a typeGroup (\a typeGroup has to be an element from Field::TypeGroup) */ - static QString typeGroupName(uint typeGroup); + static TQString typeGroupName(uint typeGroup); /*! \return type group string for \a typeGroup, e.g. "IntegerGroup" for IntegerGroup type (not-i18n'd, \a type has to be an element from Field::Type, not greater than Field::LastType) */ - static QString typeGroupString(uint typeGroup); + static TQString typeGroupString(uint typeGroup); /* ! \return the name of this field */ - inline QString name() const { return m_name; } + inline TQString name() const { return m_name; } /*! \return table schema of table that owns this field or null if it has no table assigned. @@ -287,43 +287,43 @@ class KEXI_DB_EXPORT Field void setOptions(uint options) { m_options = options; } - //! Converts field's type to QVariant equivalent as accurate as possible - inline QVariant::Type variantType() const { return variantType(type()); } + //! Converts field's type to TQVariant equivalent as accurate as possible + inline TQVariant::Type variantType() const { return variantType(type()); } /*! \return a type for this field. If there's expression assigned, type of the expression is returned instead. */ Type type() const; //! \return a i18n'd type name for this field - inline QString typeName() const { return Field::typeName(type()); } + inline TQString typeName() const { return Field::typeName(type()); } //! \return type group for this field inline TypeGroup typeGroup() const { return Field::typeGroup(type()); } //! \return a i18n'd type group name for this field - inline QString typeGroupName() const { return Field::typeGroupName(type()); } + inline TQString typeGroupName() const { return Field::typeGroupName(type()); } //! \return a type string for this field, //! for example "Integer" string for Field::Integer type. - inline QString typeString() const { return Field::typeString(type()); } + inline TQString typeString() const { return Field::typeString(type()); } //! \return a type group string for this field, //! for example "Integer" string for Field::IntegerGroup. - inline QString typeGroupString() const { return Field::typeGroupString(type()); } + inline TQString typeGroupString() const { return Field::typeGroupString(type()); } /*! \return (optional) subtype for this field. Subtype is a string providing additional hint for field's type. - E.g. for BLOB type, it can be a MIME type or certain QVariant type name, - for example: "QPixmap", "QColor" or "QFont" */ - inline QString subType() const { return m_subType; } + E.g. for BLOB type, it can be a MIME type or certain TQVariant type name, + for example: TQPIXMAP_OBJECT_NAME_STRING, "TQColor" or "TQFont" */ + inline TQString subType() const { return m_subType; } /*! Sets (optional) subtype for this field. \sa subType() */ - inline void setSubType(const QString& subType) { m_subType = subType; } + inline void setSubType(const TQString& subType) { m_subType = subType; } //! \return default value for this field. Null value means there //! is no default value declared. The variant value is compatible with field's type. - inline QVariant defaultValue() const { return m_defaultValue; } + inline TQVariant defaultValue() const { return m_defaultValue; } /*! \return length of text, only meaningful if the field type is text. 0 means "default length". */ @@ -342,7 +342,7 @@ class KEXI_DB_EXPORT Field of 6 and a scale of 4. Integers can be considered to have a scale of zero. */ inline uint scale() const { return m_length; } -//! @todo should we keep extended properties here or move them to a QVariant dictionary? +//! @todo should we keep extended properties here or move them to a TQVariant dictionary? /*! \return number of decimal places that should be visible to the user, e.g. within table view widget, form or printout. Only meaningful if the field type is floating point or (in the future: decimal or currency). @@ -368,13 +368,13 @@ class KEXI_DB_EXPORT Field inline int order() const { return m_order; } /*! \return caption of this field. */ - inline QString caption() const { return m_caption; } + inline TQString caption() const { return m_caption; } /*! \return caption of this field or - if empty - return its name. */ - inline QString captionOrName() const { return m_caption.isEmpty() ? m_name : m_caption; } + inline TQString captionOrName() const { return m_caption.isEmpty() ? m_name : m_caption; } /*! \return description text for this field. */ - inline QString description() const { return m_desc; } + inline TQString description() const { return m_desc; } /*! \return width of this field (usually in pixels or points) 0 (the default) means there is no hint for the width. */ @@ -404,7 +404,7 @@ class KEXI_DB_EXPORT Field void setType(Type t); /*! Sets name \a name for this field. */ - void setName(const QString& name); + void setName(const TQString& name); /*! Sets constraints to \a c. If PrimaryKey is set in \a c, also constraits implied by being primary key are enforced (see setPrimaryKey()). @@ -432,13 +432,13 @@ class KEXI_DB_EXPORT Field /*! Sets default value for this field. Setting null value removes the default value. @see defaultValue() */ - void setDefaultValue(const QVariant& def); + void setDefaultValue(const TQVariant& def); - /*! Sets default value decoded from QCString. + /*! Sets default value decoded from TQCString. Decoding errors are detected (value is strictly checked against field type) - - if one is encountered, default value is cleared (defaultValue()==QVariant()). + - if one is encountered, default value is cleared (defaultValue()==TQVariant()). \return true if given value was valid for field type. */ - bool setDefaultValue(const QCString& def); + bool setDefaultValue(const TQCString& def); /*! Sets auto increment flag. Only available to set true, if isAutoIncrementAllowed() is true. */ @@ -490,10 +490,10 @@ class KEXI_DB_EXPORT Field void setIndexed(bool s); /*! Sets caption for this field to \a caption. */ - void setCaption(const QString& caption) { m_caption=caption; } + void setCaption(const TQString& caption) { m_caption=caption; } /*! Sets description for this field to \a description. */ - void setDescription(const QString& description) { m_desc=description; } + void setDescription(const TQString& description) { m_desc=description; } /*! Sets visible width for this field to \a w (usually in pixels or points). 0 means there is no hint for the width. */ @@ -503,14 +503,14 @@ class KEXI_DB_EXPORT Field to query schemas' field list. QueryAsterisk subclasses Field class, and to check if the given object (pointed by Field*) is asterisk or just ordinary field definition, - you can call this method. This is just effective version of QObject::isA(). + you can call this method. This is just effective version of TQObject::isA(). Every QueryAsterisk object returns true here, and every Field object returns false. */ virtual bool isQueryAsterisk() const { return false; } /*! \return string for debugging purposes. */ - virtual QString debugString() const; + virtual TQString debugString() const; /*! Shows debug information about this field. */ void debug(); @@ -538,22 +538,22 @@ class KEXI_DB_EXPORT Field //<TMP> /*! \return the hints for enum fields. */ - QValueVector<QString> enumHints() const { return m_hints; } - QString enumHint(uint num) { return (num < m_hints.size()) ? m_hints.at(num) : QString::null; } + TQValueVector<TQString> enumHints() const { return m_hints; } + TQString enumHint(uint num) { return (num < m_hints.size()) ? m_hints.at(num) : TQString(); } /*! sets the hint for enum fields */ - void setEnumHints(const QValueVector<QString> &l) { m_hints = l; } + void setEnumHints(const TQValueVector<TQString> &l) { m_hints = l; } //</TMP> /*! \return custom property \a propertyName. If there is no such a property, \a defaultValue is returned. */ - QVariant customProperty(const QCString& propertyName, - const QVariant& defaultValue = QVariant()) const; + TQVariant customProperty(const TQCString& propertyName, + const TQVariant& defaultValue = TQVariant()) const; //! Sets value \a value for custom property \a propertyName - void setCustomProperty(const QCString& propertyName, const QVariant& value); + void setCustomProperty(const TQCString& propertyName, const TQVariant& value); //! A data type used for handling custom properties of a field - typedef QMap<QCString,QVariant> CustomPropertiesMap; + typedef TQMap<TQCString,TQVariant> CustomPropertiesMap; //! \return all custom properties inline const CustomPropertiesMap customProperties() const { @@ -575,39 +575,39 @@ class KEXI_DB_EXPORT Field FieldList *m_parent; //!< In most cases this points to a TableSchema //!< object that field is assigned. - QString m_name; - QString m_subType; + TQString m_name; + TQString m_subType; uint m_constraints; uint m_length; //!< also used for storing scale for floating point types uint m_precision; int m_visibleDecimalPlaces; //!< used in visibleDecimalPlaces() uint m_options; - QVariant m_defaultValue; + TQVariant m_defaultValue; int m_order; - QString m_caption; - QString m_desc; + TQString m_caption; + TQString m_desc; uint m_width; - QValueVector<QString> m_hints; + TQValueVector<TQString> m_hints; KexiDB::BaseExpr *m_expr; CustomPropertiesMap* m_customProperties; //! @internal Used in m_typeNames member to handle i18n'd type names - class KEXI_DB_EXPORT FieldTypeNames : public QValueVector<QString> { + class KEXI_DB_EXPORT FieldTypeNames : public TQValueVector<TQString> { public: FieldTypeNames(); void init(); - QMap<QString,Type> str2num; + TQMap<TQString,Type> str2num; protected: bool m_initialized : 1; }; //! @internal Used in m_typeGroupNames member to handle i18n'd type group names - class KEXI_DB_EXPORT FieldTypeGroupNames : public QValueVector<QString> { + class KEXI_DB_EXPORT FieldTypeGroupNames : public TQValueVector<TQString> { public: FieldTypeGroupNames(); void init(); - QMap<QString,TypeGroup> str2num; + TQMap<TQString,TypeGroup> str2num; protected: bool m_initialized : 1; }; diff --git a/kexi/kexidb/fieldlist.cpp b/kexi/kexidb/fieldlist.cpp index ee159c72..dea19876 100644 --- a/kexi/kexidb/fieldlist.cpp +++ b/kexi/kexidb/fieldlist.cpp @@ -60,10 +60,10 @@ FieldList::~FieldList() void FieldList::clear() { -// m_name = QString::null; +// m_name = TQString(); m_fields.clear(); m_fields_by_name.clear(); - m_sqlFields = QString::null; + m_sqlFields = TQString(); delete m_autoinc_fields; m_autoinc_fields = 0; } @@ -81,20 +81,20 @@ FieldList& FieldList::insertField(uint index, KexiDB::Field *field) return *this; if (!field->name().isEmpty()) m_fields_by_name.insert(field->name().lower(),field); - m_sqlFields = QString::null; + m_sqlFields = TQString(); return *this; } -void FieldList::renameField(const QString& oldName, const QString& newName) +void FieldList::renameField(const TQString& oldName, const TQString& newName) { renameField( m_fields_by_name[ oldName ], newName ); } -void FieldList::renameField(KexiDB::Field *field, const QString& newName) +void FieldList::renameField(KexiDB::Field *field, const TQString& newName) { if (!field || field != m_fields_by_name[ field->name() ]) { KexiDBFatal << "FieldList::renameField() no field found " - << (field ? QString("\"%1\"").arg(field->name()) : QString::null) << endl; + << (field ? TQString("\"%1\"").tqarg(field->name()) : TQString()) << endl; return; } m_fields_by_name.take( field->name() ); @@ -115,17 +115,17 @@ void FieldList::removeField(KexiDB::Field *field) return; m_fields_by_name.remove(field->name()); m_fields.remove(field); - m_sqlFields = QString::null; + m_sqlFields = TQString(); } -Field* FieldList::field(const QString& name) +Field* FieldList::field(const TQString& name) { return m_fields_by_name[name]; } -QString FieldList::debugString() +TQString FieldList::debugString() { - QString dbg; + TQString dbg; dbg.reserve(512); Field::ListIterator it( m_fields ); Field *field; @@ -156,19 +156,19 @@ void FieldList::debug() fl->addField(f); \ } -static QString subListWarning1(const QString& fname) { - return QString("FieldList::subList() could not find field \"%1\"").arg(fname); +static TQString subListWarning1(const TQString& fname) { + return TQString("FieldList::subList() could not find field \"%1\"").tqarg(fname); } -FieldList* FieldList::subList(const QString& n1, const QString& n2, - const QString& n3, const QString& n4, - const QString& n5, const QString& n6, - const QString& n7, const QString& n8, - const QString& n9, const QString& n10, - const QString& n11, const QString& n12, - const QString& n13, const QString& n14, - const QString& n15, const QString& n16, - const QString& n17, const QString& n18) +FieldList* FieldList::subList(const TQString& n1, const TQString& n2, + const TQString& n3, const TQString& n4, + const TQString& n5, const TQString& n6, + const TQString& n7, const TQString& n8, + const TQString& n9, const TQString& n10, + const TQString& n11, const TQString& n12, + const TQString& n13, const TQString& n14, + const TQString& n15, const TQString& n16, + const TQString& n17, const TQString& n18) { if (n1.isEmpty()) return 0; @@ -195,24 +195,24 @@ FieldList* FieldList::subList(const QString& n1, const QString& n2, return fl; } -FieldList* FieldList::subList(const QStringList& list) +FieldList* FieldList::subList(const TQStringList& list) { Field *f; FieldList *fl = new FieldList(false); - for(QStringList::ConstIterator it = list.constBegin(); it != list.constEnd(); ++it) { + for(TQStringList::ConstIterator it = list.constBegin(); it != list.constEnd(); ++it) { _ADD_FIELD( (*it) ); } return fl; } -FieldList* FieldList::subList(const QValueList<uint>& list) +FieldList* FieldList::subList(const TQValueList<uint>& list) { Field *f; FieldList *fl = new FieldList(false); - foreach(QValueList<uint>::ConstIterator, it, list) { + foreach(TQValueList<uint>::ConstIterator, it, list) { f = field(*it); if (!f) { - KexiDBWarn << QString("FieldList::subList() could not find field at position %1").arg(*it) << endl; + KexiDBWarn << TQString("FieldList::subList() could not find field at position %1").tqarg(*it) << endl; delete fl; return 0; } @@ -221,10 +221,10 @@ FieldList* FieldList::subList(const QValueList<uint>& list) return fl; } -QStringList FieldList::names() const +TQStringList FieldList::names() const { - QStringList r; -// for (QDictIterator<Field> it(m_fields_by_name);it.current();++it) { + TQStringList r; +// for (TQDictIterator<Field> it(m_fields_by_name);it.current();++it) { // r += it.currentKey().lower(); // } for (Field::ListIterator it(m_fields); it.current(); ++it) { @@ -234,15 +234,15 @@ QStringList FieldList::names() const } //static -QString FieldList::sqlFieldsList(Field::List* list, Driver *driver, - const QString& separator, const QString& tableAlias, int drvEscaping) +TQString FieldList::sqlFieldsList(Field::List* list, Driver *driver, + const TQString& separator, const TQString& tableAlias, int drvEscaping) { if (!list) - return QString::null; - QString result; + return TQString(); + TQString result; result.reserve(256); bool start = true; - const QString tableAliasAndDot( tableAlias.isEmpty() ? QString::null : (tableAlias + ".") ); + const TQString tableAliasAndDot( tableAlias.isEmpty() ? TQString() : (tableAlias + ".") ); for (Field::ListIterator it( *list ); it.current(); ++it) { if (!start) result += separator; @@ -253,8 +253,8 @@ QString FieldList::sqlFieldsList(Field::List* list, Driver *driver, return result; } -QString FieldList::sqlFieldsList(Driver *driver, - const QString& separator, const QString& tableAlias, int drvEscaping) +TQString FieldList::sqlFieldsList(Driver *driver, + const TQString& separator, const TQString& tableAlias, int drvEscaping) { if (!m_sqlFields.isEmpty()) return m_sqlFields; diff --git a/kexi/kexidb/fieldlist.h b/kexi/kexidb/fieldlist.h index fd47459e..c5f28d5b 100644 --- a/kexi/kexidb/fieldlist.h +++ b/kexi/kexidb/fieldlist.h @@ -20,9 +20,9 @@ #ifndef KEXIDB_FIELDLIST_H #define KEXIDB_FIELDLIST_H -#include <qvaluelist.h> -#include <qdict.h> -#include <qstring.h> +#include <tqvaluelist.h> +#include <tqdict.h> +#include <tqstring.h> #include <kexidb/field.h> #include <kexidb/driver.h> @@ -76,17 +76,17 @@ class KEXI_DB_EXPORT FieldList inline Field* field(uint id) { return (id < m_fields.count()) ? m_fields.at(id) : 0; } /*! \return field with name \a name or NULL if there is no such a field. */ - virtual Field* field(const QString& name); + virtual Field* field(const TQString& name); /*! \return true if this list contains given \a field. */ - inline bool hasField(const Field* field) { return m_fields.findRef(field)!=-1; } + inline bool hasField(const Field* field) { return m_fields.tqfindRef(field)!=-1; } /*! \return first occurrence of \a field in the list or -1 if this list does not contain this field. */ - inline int indexOf(const Field* field) { return m_fields.findRef(field); } + inline int indexOf(const Field* field) { return m_fields.tqfindRef(field); } /*! \return list of field names for this list. */ - QStringList names() const; + TQStringList names() const; Field::ListIterator fieldsIterator() const { return Field::ListIterator(m_fields); } @@ -102,40 +102,40 @@ class KEXI_DB_EXPORT FieldList virtual void clear(); /*! \return String for debugging purposes. */ - virtual QString debugString(); + virtual TQString debugString(); /*! Shows debug information about all fields in the list. */ void debug(); /*! Creates and returns a list that contain fields selected by name. At least one field (exising on this list) should be selected, otherwise 0 is - returned. Returned FieldList object is not owned by any parent (so you need + returned. Returned FieldList object is not owned by any tqparent (so you need to destroy yourself) and Field objects included in it are not owned by it (but still as before, by 'this' object). Returned list can be usable e.g. as argument for Connection::insertRecord(). 0 is returned if at least one name cannot be found. */ - FieldList* subList(const QString& n1, const QString& n2 = QString::null, - const QString& n3 = QString::null, const QString& n4 = QString::null, - const QString& n5 = QString::null, const QString& n6 = QString::null, - const QString& n7 = QString::null, const QString& n8 = QString::null, - const QString& n9 = QString::null, const QString& n10 = QString::null, - const QString& n11 = QString::null, const QString& n12 = QString::null, - const QString& n13 = QString::null, const QString& n14 = QString::null, - const QString& n15 = QString::null, const QString& n16 = QString::null, - const QString& n17 = QString::null, const QString& n18 = QString::null + FieldList* subList(const TQString& n1, const TQString& n2 = TQString(), + const TQString& n3 = TQString(), const TQString& n4 = TQString(), + const TQString& n5 = TQString(), const TQString& n6 = TQString(), + const TQString& n7 = TQString(), const TQString& n8 = TQString(), + const TQString& n9 = TQString(), const TQString& n10 = TQString(), + const TQString& n11 = TQString(), const TQString& n12 = TQString(), + const TQString& n13 = TQString(), const TQString& n14 = TQString(), + const TQString& n15 = TQString(), const TQString& n16 = TQString(), + const TQString& n17 = TQString(), const TQString& n18 = TQString() ); - /*! Like above, but with a QStringList */ - FieldList* subList(const QStringList& list); + /*! Like above, but with a TQStringList */ + FieldList* subList(const TQStringList& list); /*! Like above, but with a list of field indices */ - FieldList* subList(const QValueList<uint>& list); + FieldList* subList(const TQValueList<uint>& list); /*! \return a string that is a result of all field names concatenated and with \a separator. This is usable e.g. as argument like "field1,field2" for "INSERT INTO (xxx) ..". The result of this method is effectively cached, - and it is invalidated when set of fields changes (e.g. using clear() + and it is tqinvalidated when set of fields changes (e.g. using clear() or addField()). \a tableAlias, if provided is prepended to each field, so the resulting names will be in form tableAlias.fieldName. This option is used for building @@ -143,31 +143,31 @@ class KEXI_DB_EXPORT FieldList See @ref Connection::selectStatement() for example use. \a drvEscaping can be used to alter default escaping type. */ - QString sqlFieldsList(Driver *driver, const QString& separator = QString::fromLatin1(","), - const QString& tableAlias = QString::null, + TQString sqlFieldsList(Driver *driver, const TQString& separator = TQString::tqfromLatin1(","), + const TQString& tableAlias = TQString(), int drvEscaping = Driver::EscapeDriver|Driver::EscapeAsNecessary); /*! Like above, but this is convenient static function, so you can pass any \a list here. */ - static QString sqlFieldsList(Field::List* list, Driver *driver, - const QString& separator = QString::fromLatin1(","), const QString& tableAlias = QString::null, + static TQString sqlFieldsList(Field::List* list, Driver *driver, + const TQString& separator = TQString::tqfromLatin1(","), const TQString& tableAlias = TQString(), int drvEscaping = Driver::EscapeDriver|Driver::EscapeAsNecessary); /*! @internal Renames field \a oldName to \a newName. Do not use this for physical renaming columns. Use AlterTableHandler instead. */ - void renameField(const QString& oldName, const QString& newName); + void renameField(const TQString& oldName, const TQString& newName); /*! @internal - \overload void renameField(const QString& oldName, const QString& newName) */ - void renameField(KexiDB::Field *field, const QString& newName); + \overload void renameField(const TQString& oldName, const TQString& newName) */ + void renameField(KexiDB::Field *field, const TQString& newName); protected: Field::List m_fields; - QDict<Field> m_fields_by_name; //!< Fields collected by name. Not used by QuerySchema. + TQDict<Field> m_fields_by_name; //!< Fields collected by name. Not used by QuerySchema. Field::List *m_autoinc_fields; private: //! cached - QString m_sqlFields; + TQString m_sqlFields; }; } //namespace KexiDB diff --git a/kexi/kexidb/fieldvalidator.cpp b/kexi/kexidb/fieldvalidator.cpp index e657d2fa..d9252c20 100644 --- a/kexi/kexidb/fieldvalidator.cpp +++ b/kexi/kexidb/fieldvalidator.cpp @@ -22,19 +22,19 @@ #include <kexiutils/longlongvalidator.h> #include <knumvalidator.h> -#include <qwidget.h> +#include <tqwidget.h> using namespace KexiDB; -FieldValidator::FieldValidator( const Field &field, QWidget * parent, const char * name ) - : KexiUtils::MultiValidator(parent, name) +FieldValidator::FieldValidator( const Field &field, TQWidget * tqparent, const char * name ) + : KexiUtils::MultiValidator(TQT_TQOBJECT(tqparent), name) { //! @todo merge this code with KexiTableEdit code! //! @todo set maximum length validator -//! @todo handle input mask (via QLineEdit::setInputMask() +//! @todo handle input tqmask (via TQLineEdit::setInputMask() const Field::Type t = field.type(); if (field.isIntegerType()) { - QValidator *validator = 0; + TQValidator *validator = 0; const bool u = field.isUnsigned(); int bottom, top; if (t==Field::Byte) { @@ -59,7 +59,7 @@ FieldValidator::FieldValidator( const Field &field, QWidget * parent, const char addSubvalidator( validator ); } else if (field.isFPNumericType()) { - QValidator *validator; + TQValidator *validator; if (t==Field::Float) { if (field.isUnsigned()) //ok? validator = new KDoubleValidator(0, 3.4e+38, field.scale(), 0); @@ -76,7 +76,7 @@ FieldValidator::FieldValidator( const Field &field, QWidget * parent, const char } else if (t==Field::Date) { //! @todo add validator -// QValidator *validator = new KDateValidator(this); +// TQValidator *validator = new KDateValidator(this); // setValidator( validator ); //moved setInputMask( dateFormatter()->inputMask() ); } diff --git a/kexi/kexidb/fieldvalidator.h b/kexi/kexidb/fieldvalidator.h index 4c5dbbfe..7b0e2bf8 100644 --- a/kexi/kexidb/fieldvalidator.h +++ b/kexi/kexidb/fieldvalidator.h @@ -23,13 +23,13 @@ #include <kexidb/kexidb_export.h> #include <kexiutils/validator.h> -class QWidget; +class TQWidget; namespace KexiDB { class Field; //! @short A validator for KexiDB data types -/*! This can be used by QLineEdit or subclass to provide validated +/*! This can be used by TQLineEdit or subclass to provide validated text entry. Curently is supports all integer types, floating point types and booleans. Internal validators like KIntValidator or KexiUtils::LongLongValidator are used. 'unsigned' and 'scale' parameters are taken into account when setting up internal validators. @@ -40,7 +40,7 @@ class KEXI_DB_EXPORT FieldValidator : public KexiUtils::MultiValidator { public: //! Setups the validator for \a field. Does not keep a pointer to \a field. - FieldValidator( const Field &field, QWidget * parent, const char * name = 0 ); + FieldValidator( const Field &field, TQWidget * tqparent, const char * name = 0 ); ~FieldValidator(); }; diff --git a/kexi/kexidb/global.cpp b/kexi/kexidb/global.cpp index cbbfb723..e5f6ecde 100644 --- a/kexi/kexidb/global.cpp +++ b/kexi/kexidb/global.cpp @@ -47,7 +47,7 @@ void ServerVersionInfo::clear() major = 0; minor = 0; release = 0; - string = QString::null; + string = TQString(); } //------------------------ diff --git a/kexi/kexidb/global.h b/kexi/kexidb/global.h index 78c1b68b..1a906ee3 100644 --- a/kexi/kexidb/global.h +++ b/kexi/kexidb/global.h @@ -21,7 +21,7 @@ #define KEXIDB_GLOBAL_H #include <kexidb/kexidb_export.h> -#include <qstring.h> +#include <tqstring.h> //global public definitions @@ -66,14 +66,14 @@ Data representation \section Drivers -Drivers are loaded using DriverManager::driver(const QString& name). The names +Drivers are loaded using DriverManager::driver(const TQString& name). The names of drivers are given in their drivers .desktop file in the X-Kexi-DriverName field. KexiDB supports two kinds of databases: file-based and network-based databases. The type of a driver is available from several places. The X-Kexi-DriverType field in the driver's .desktop file, is read by the DriverManager and -available by calling DriverManager::driverInfo(const QString &name) and using +available by calling DriverManager::driverInfo(const TQString &name) and using the Driver::Info#fileBased member from the result. Given a reference to a Driver, its type can also be found directly using Driver::isFileDriver() const. @@ -140,7 +140,7 @@ class KEXI_DB_EXPORT ServerVersionInfo uint release; //! Version string, as returned by the server - QString string; + TQString string; }; /*! Object types set like table or query. */ @@ -160,8 +160,8 @@ enum ObjectTypes { } #ifndef futureI18n -# define futureI18n QString -# define futureI18n2(a,b) QString(b) +# define futureI18n TQString +# define futureI18n2(a,b) TQString(b) #endif #ifndef FUTURE_I18N_NOOP diff --git a/kexi/kexidb/indexschema.cpp b/kexi/kexidb/indexschema.cpp index 20dc9e82..c672305a 100644 --- a/kexi/kexidb/indexschema.cpp +++ b/kexi/kexidb/indexschema.cpp @@ -41,11 +41,11 @@ IndexSchema::IndexSchema(TableSchema *tableSchema) m_master_owned_rels.setAutoDelete(true); //rels at the master-side are owned } -IndexSchema::IndexSchema(const IndexSchema& idx, TableSchema& parentTable) +IndexSchema::IndexSchema(const IndexSchema& idx, TableSchema& tqparentTable) // : FieldList(static_cast<const FieldList&>(idx))//fields are not owned by IndexSchema object : FieldList(false)//fields are not owned by IndexSchema object , SchemaData(static_cast<const SchemaData&>(idx)) - , m_tableSchema(&parentTable) + , m_tableSchema(&tqparentTable) , m_primary( idx.m_primary ) , m_unique( idx.m_unique ) , m_isAutoGenerated( idx.m_isAutoGenerated ) @@ -55,14 +55,14 @@ IndexSchema::IndexSchema(const IndexSchema& idx, TableSchema& parentTable) //deep copy of the fields for (Field::ListIterator f_it(idx.m_fields); f_it.current(); ++f_it) { - Field *parentTableField = parentTable.field( f_it.current()->name() ); - if (!parentTableField) { - KexiDBWarn << "IndexSchema::IndexSchema(const IndexSchema& idx, const TableSchema& parentTable): " - "cannot find field '" << f_it.current()->name() << " in parentTable. Empty index will be created!" << endl; + Field *tqparentTableField = tqparentTable.field( f_it.current()->name() ); + if (!tqparentTableField) { + KexiDBWarn << "IndexSchema::IndexSchema(const IndexSchema& idx, const TableSchema& tqparentTable): " + "cannot find field '" << f_it.current()->name() << " in tqparentTable. Empty index will be created!" << endl; FieldList::clear(); break; } - addField( parentTableField ); + addField( tqparentTableField ); } //js TODO: copy relationships! @@ -79,7 +79,7 @@ IndexSchema::~IndexSchema() So, we need to detach all these relationships from details-side, corresponding indices. */ - QPtrListIterator<Relationship> it(m_master_owned_rels); + TQPtrListIterator<Relationship> it(m_master_owned_rels); for (;it.current();++it) { if (it.current()->detailsIndex()) { it.current()->detailsIndex()->detachRelationship(it.current()); @@ -151,13 +151,13 @@ void IndexSchema::setForeignKey(bool set) } } -QString IndexSchema::debugString() +TQString IndexSchema::debugString() { - return QString("INDEX ") + schemaDataDebugString() + "\n" + return TQString("INDEX ") + schemaDataDebugString() + "\n" + (m_isForeignKey ? "FOREIGN KEY " : "") + (m_isAutoGenerated ? "AUTOGENERATED " : "") + (m_primary ? "PRIMARY " : "") - + ((!m_primary) && m_unique ? "UNIQUE " : "") + + ((!m_primary) && m_unique ? "UNITQUE " : "") + FieldList::debugString(); } @@ -172,18 +172,18 @@ void IndexSchema::attachRelationship(Relationship *rel, bool ownedByMaster) return; if (rel->masterIndex()==this) { if (ownedByMaster) { - if (m_master_owned_rels.findRef(rel)==-1) { + if (m_master_owned_rels.tqfindRef(rel)==-1) { m_master_owned_rels.append(rel); } } else {//not owned - if (m_master_rels.findRef(rel)==-1) { + if (m_master_rels.tqfindRef(rel)==-1) { m_master_rels.append(rel); } } } else if (rel->detailsIndex()==this) { - if (m_details_rels.findRef(rel)==-1) { + if (m_details_rels.tqfindRef(rel)==-1) { m_details_rels.append(rel); } } @@ -193,7 +193,7 @@ void IndexSchema::detachRelationship(Relationship *rel) { if (!rel) return; - m_master_owned_rels.take( m_master_owned_rels.findRef(rel) ); //for sanity - m_master_rels.take( m_master_rels.findRef(rel) ); //for sanity - m_details_rels.take( m_details_rels.findRef(rel) ); //for sanity + m_master_owned_rels.take( m_master_owned_rels.tqfindRef(rel) ); //for sanity + m_master_rels.take( m_master_rels.tqfindRef(rel) ); //for sanity + m_details_rels.take( m_details_rels.tqfindRef(rel) ); //for sanity } diff --git a/kexi/kexidb/indexschema.h b/kexi/kexidb/indexschema.h index a8bec433..60d1d7ac 100644 --- a/kexi/kexidb/indexschema.h +++ b/kexi/kexidb/indexschema.h @@ -20,8 +20,8 @@ #ifndef KEXIDB_INDEX_H #define KEXIDB_INDEX_H -#include <qvaluelist.h> -#include <qstring.h> +#include <tqvaluelist.h> +#include <tqstring.h> #include <kexidb/fieldlist.h> #include <kexidb/schemadata.h> @@ -43,8 +43,8 @@ class Relationship; class KEXI_DB_EXPORT IndexSchema : public FieldList, public SchemaData { public: - typedef QPtrList<IndexSchema> List; - typedef QPtrListIterator<IndexSchema> ListIterator; + typedef TQPtrList<IndexSchema> List; + typedef TQPtrListIterator<IndexSchema> ListIterator; /*! Constructs empty index schema object that is assigned to \a table, and will be owned by this table. @@ -56,7 +56,7 @@ class KEXI_DB_EXPORT IndexSchema : public FieldList, public SchemaData /*! Copy constructor. Copies all attributes from index \a idx, and fields assigned with it but the fields are taken (by name) from - \a parentTable, not from \a idx itself, so it's possible to copy of index + \a tqparentTable, not from \a idx itself, so it's possible to copy of index for a copy of table. To copy an index within the same table it's enough to call: @@ -65,7 +65,7 @@ class KEXI_DB_EXPORT IndexSchema : public FieldList, public SchemaData \endcode @todo All relationships should be also copied */ - IndexSchema(const IndexSchema& idx, TableSchema& parentTable); + IndexSchema(const IndexSchema& idx, TableSchema& tqparentTable); /*! Destroys the index. Field objects are not deleted. All Relationship objects listed in masterRelationships() list @@ -110,7 +110,7 @@ class KEXI_DB_EXPORT IndexSchema : public FieldList, public SchemaData is this IndexSchem object assigned. Note: If \a rel was detached from masterRelationships() list, - this object now has no parent, so you need to attach it to somewhere or destruct it. + this object now has no tqparent, so you need to attach it to somewhere or destruct it. */ void detachRelationship(Relationship *rel); @@ -118,7 +118,7 @@ class KEXI_DB_EXPORT IndexSchema : public FieldList, public SchemaData Auto-generated index is one-field index that was automatically generated for CREATE TABLE statement when the field has - UNIQUE or PRIMARY KEY constraint enabled. + UNITQUE or PRIMARY KEY constraint enabled. Any newly created IndexSchema object has this flag set to false. @@ -137,21 +137,21 @@ class KEXI_DB_EXPORT IndexSchema : public FieldList, public SchemaData /*! Sets PRIMARY KEY flag. \sa isPrimary(). Note: Setting PRIMARY KEY on (true), - UNIQUE flag will be also implicity set. */ + UNITQUE flag will be also implicity set. */ void setPrimaryKey(bool set); /*! \return true if this is unique index. This can be one or multifield. */ bool isUnique() const; - /*! Sets UNIQUE flag. \sa isUnique(). - Note: Setting UNIQUE off (false), PRIMARY KEY flag will - be also implicity set off, because this UNIQUE + /*! Sets UNITQUE flag. \sa isUnique(). + Note: Setting UNITQUE off (false), PRIMARY KEY flag will + be also implicity set off, because this UNITQUE is the requirement for PRIMARY KEYS. */ void setUnique(bool set); /*! \return String for debugging purposes. */ - virtual QString debugString(); + virtual TQString debugString(); protected: /*! Internal constructor for convenience. diff --git a/kexi/kexidb/kexidb.pro b/kexi/kexidb/kexidb.pro index d16e3f59..6c17210c 100644 --- a/kexi/kexidb/kexidb.pro +++ b/kexi/kexidb/kexidb.pro @@ -9,7 +9,7 @@ TARGET = kexidb$$KDEBUG DEFINES += YYERROR_VERBOSE=1 -system( bash kmoc ) +system( bash ktqmoc ) SOURCES = \ object.cpp \ diff --git a/kexi/kexidb/kexidb_export.h b/kexi/kexidb/kexidb_export.h index a9f4a640..2a908b66 100644 --- a/kexi/kexidb/kexidb_export.h +++ b/kexi/kexidb/kexidb_export.h @@ -49,7 +49,7 @@ #endif /* -- compile-time settings -- */ -#if defined(Q_WS_WIN) || defined(KEXI_OPTIONS) +#if defined(TQ_WS_WIN) || defined(KEXI_OPTIONS) /* defined in a .pro file or 'KEXI_OPTIONS' env. variable */ #else diff --git a/kexi/kexidb/keywords.cpp b/kexi/kexidb/keywords.cpp index 05563497..b1680097 100644 --- a/kexi/kexidb/keywords.cpp +++ b/kexi/kexidb/keywords.cpp @@ -82,7 +82,7 @@ namespace KexiDB { "THEN", "TRANSACTION", "UNION", - "UNIQUE", + "UNITQUE", "UPDATE", "USING", "VALUES", diff --git a/kexi/kexidb/lookupfieldschema.cpp b/kexi/kexidb/lookupfieldschema.cpp index f21ec588..66ed4396 100644 --- a/kexi/kexidb/lookupfieldschema.cpp +++ b/kexi/kexidb/lookupfieldschema.cpp @@ -20,8 +20,8 @@ #include "lookupfieldschema.h" #include "utils.h" -#include <qdom.h> -#include <qvariant.h> +#include <tqdom.h> +#include <tqvariant.h> #include <kdebug.h> using namespace KexiDB; @@ -38,14 +38,14 @@ LookupFieldSchema::RowSource::~RowSource() delete m_values; } -void LookupFieldSchema::RowSource::setName(const QString& name) +void LookupFieldSchema::RowSource::setName(const TQString& name) { m_name = name; if (m_values) m_values->clear(); } -QString LookupFieldSchema::RowSource::typeName() const +TQString LookupFieldSchema::RowSource::typeName() const { switch (m_type) { case Table: return "table"; @@ -55,10 +55,10 @@ QString LookupFieldSchema::RowSource::typeName() const case FieldList: return "fieldlist"; default:; } - return QString::null; + return TQString(); } -void LookupFieldSchema::RowSource::setTypeByName( const QString& typeName ) +void LookupFieldSchema::RowSource::setTypeByName( const TQString& typeName ) { if (typeName=="table") setType( Table ); @@ -74,24 +74,24 @@ void LookupFieldSchema::RowSource::setTypeByName( const QString& typeName ) setType( NoType ); } -QStringList LookupFieldSchema::RowSource::values() const +TQStringList LookupFieldSchema::RowSource::values() const { - return m_values ? *m_values : QStringList(); + return m_values ? *m_values : TQStringList(); } -void LookupFieldSchema::RowSource::setValues(const QStringList& values) +void LookupFieldSchema::RowSource::setValues(const TQStringList& values) { - m_name = QString::null; + m_name = TQString(); if (m_values) *m_values = values; else - m_values = new QStringList(values); + m_values = new TQStringList(values); } -QString LookupFieldSchema::RowSource::debugString() const +TQString LookupFieldSchema::RowSource::debugString() const { - return QString("rowSourceType:'%1' rowSourceName:'%2' rowSourceValues:'%3'\n") - .arg(typeName()).arg(name()).arg(m_values ? m_values->join("|") : QString::null); + return TQString("rowSourceType:'%1' rowSourceName:'%2' rowSourceValues:'%3'\n") + .tqarg(typeName()).tqarg(name()).tqarg(m_values ? m_values->join("|") : TQString()); } void LookupFieldSchema::RowSource::debug() const @@ -124,31 +124,31 @@ void LookupFieldSchema::setMaximumListRows(uint rows) m_maximumListRows = rows; } -QString LookupFieldSchema::debugString() const +TQString LookupFieldSchema::debugString() const { - QString columnWidthsStr; - foreach (QValueList<int>::ConstIterator, it, m_columnWidths) { + TQString columnWidthsStr; + foreach (TQValueList<int>::ConstIterator, it, m_columnWidths) { if (!columnWidthsStr.isEmpty()) columnWidthsStr.append(";"); - columnWidthsStr.append( QString::number(*it) ); + columnWidthsStr.append( TQString::number(*it) ); } - QString visibleColumnsString; - foreach (QValueList<uint>::ConstIterator, it, m_visibleColumns) { + TQString visibleColumnsString; + foreach (TQValueList<uint>::ConstIterator, it, m_visibleColumns) { if (!visibleColumnsString.isEmpty()) visibleColumnsString.append(";"); - visibleColumnsString.append(QString::number(*it)); + visibleColumnsString.append(TQString::number(*it)); } - return QString("LookupFieldSchema( %1\n" + return TQString("LookupFieldSchema( %1\n" " boundColumn:%2 visibleColumns:%3 maximumListRows:%4 displayWidget:%5\n" " columnHeadersVisible:%6 limitToList:%7\n" " columnWidths:%8 )") - .arg(m_rowSource.debugString()) - .arg(m_boundColumn).arg(visibleColumnsString).arg(m_maximumListRows) - .arg( m_displayWidget==ComboBox ? "ComboBox" : "ListBox") - .arg(m_columnHeadersVisible).arg(m_limitToList) - .arg(columnWidthsStr); + .tqarg(m_rowSource.debugString()) + .tqarg(m_boundColumn).tqarg(visibleColumnsString).tqarg(m_maximumListRows) + .tqarg( m_displayWidget==ComboBox ? "ComboBox" : "ListBox") + .tqarg(m_columnHeadersVisible).tqarg(m_limitToList) + .tqarg(columnWidthsStr); } void LookupFieldSchema::debug() const @@ -157,19 +157,19 @@ void LookupFieldSchema::debug() const } /* static */ -LookupFieldSchema *LookupFieldSchema::loadFromDom(const QDomElement& lookupEl) +LookupFieldSchema *LookupFieldSchema::loadFromDom(const TQDomElement& lookupEl) { LookupFieldSchema *lookupFieldSchema = new LookupFieldSchema(); - for (QDomNode node = lookupEl.firstChild(); !node.isNull(); node = node.nextSibling()) { - QDomElement el = node.toElement(); - QString name( el.tagName() ); + for (TQDomNode node = lookupEl.firstChild(); !node.isNull(); node = node.nextSibling()) { + TQDomElement el = node.toElement(); + TQString name( el.tagName() ); if (name=="row-source") { /*<row-source> empty | <type>table|query|sql|valuelist|fieldlist</type> #required because there can be table and query with the same name "fieldlist" (basically a list of column names of a table/query, "Field List" as in MSA) - <name>string</name> #table/query name, etc. or KEXISQL SELECT QUERY + <name>string</name> #table/query name, etc. or KEXISQL SELECT TQUERY <values><value>...</value> #for "valuelist" type <value>...</value> </values> @@ -186,8 +186,8 @@ LookupFieldSchema *LookupFieldSchema::loadFromDom(const QDomElement& lookupEl) /* <bound-column> <number>number</number> #in later implementation there can be more columns </bound-column> */ - const QVariant val = KexiDB::loadPropertyValueFromDom( el.firstChild() ); - if (val.type()==QVariant::Int) + const TQVariant val = KexiDB::loadPropertyValueFromDom( el.firstChild() ); + if (val.type()==TQVariant::Int) lookupFieldSchema->setBoundColumn( val.toInt() ); } else if (name=="visible-column") { @@ -196,10 +196,10 @@ LookupFieldSchema *LookupFieldSchema::loadFromDom(const QDomElement& lookupEl) <number>number 2</number> [..] </visible-column> */ - QValueList<uint> list; - for (QDomNode childNode = el.firstChild(); !childNode.isNull(); childNode = childNode.nextSibling()) { - const QVariant val = KexiDB::loadPropertyValueFromDom( childNode ); - if (val.type()==QVariant::Int) + TQValueList<uint> list; + for (TQDomNode childNode = el.firstChild(); !childNode.isNull(); childNode = childNode.nextSibling()) { + const TQVariant val = KexiDB::loadPropertyValueFromDom( childNode ); + if (val.type()==TQVariant::Int) list.append( val.toUInt() ); } lookupFieldSchema->setVisibleColumns( list ); @@ -210,11 +210,11 @@ LookupFieldSchema *LookupFieldSchema::loadFromDom(const QDomElement& lookupEl) ... <number>int</number> </column-widths> */ - QVariant val; - QValueList<int> columnWidths; + TQVariant val; + TQValueList<int> columnWidths; for (el = el.firstChild().toElement(); !el.isNull(); el=el.nextSibling().toElement()) { - QVariant val = KexiDB::loadPropertyValueFromDom( el ); - if (val.type()==QVariant::Int) + TQVariant val = KexiDB::loadPropertyValueFromDom( el ); + if (val.type()==TQVariant::Int) columnWidths.append(val.toInt()); } lookupFieldSchema->setColumnWidths( columnWidths ); @@ -223,24 +223,24 @@ LookupFieldSchema *LookupFieldSchema::loadFromDom(const QDomElement& lookupEl) /* <show-column-headers> <bool>true/false</bool> </show-column-headers> */ - const QVariant val = KexiDB::loadPropertyValueFromDom( el.firstChild() ); - if (val.type()==QVariant::Bool) + const TQVariant val = KexiDB::loadPropertyValueFromDom( el.firstChild() ); + if (val.type()==TQVariant::Bool) lookupFieldSchema->setColumnHeadersVisible( val.toBool() ); } else if (name=="list-rows") { /* <list-rows> <number>1..100</number> </list-rows> */ - const QVariant val = KexiDB::loadPropertyValueFromDom( el.firstChild() ); - if (val.type()==QVariant::Int) + const TQVariant val = KexiDB::loadPropertyValueFromDom( el.firstChild() ); + if (val.type()==TQVariant::Int) lookupFieldSchema->setMaximumListRows( val.toUInt() ); } else if (name=="limit-to-list") { /* <limit-to-list> <bool>true/false</bool> </limit-to-list> */ - const QVariant val = KexiDB::loadPropertyValueFromDom( el.firstChild() ); - if (val.type()==QVariant::Bool) + const TQVariant val = KexiDB::loadPropertyValueFromDom( el.firstChild() ); + if (val.type()==TQVariant::Bool) lookupFieldSchema->setLimitToList( val.toBool() ); } else if (name=="display-widget") { @@ -254,12 +254,12 @@ LookupFieldSchema *LookupFieldSchema::loadFromDom(const QDomElement& lookupEl) } /* static */ -void LookupFieldSchema::saveToDom(LookupFieldSchema& lookupSchema, QDomDocument& doc, QDomElement& parentEl) +void LookupFieldSchema::saveToDom(LookupFieldSchema& lookupSchema, TQDomDocument& doc, TQDomElement& tqparentEl) { - QDomElement lookupColumnEl, rowSourceEl, rowSourceTypeEl, nameEl; + TQDomElement lookupColumnEl, rowSourceEl, rowSourceTypeEl, nameEl; if (!lookupSchema.rowSource().name().isEmpty()) { lookupColumnEl = doc.createElement("lookup-column"); - parentEl.appendChild( lookupColumnEl ); + tqparentEl.appendChild( lookupColumnEl ); rowSourceEl = doc.createElement("row-source"); lookupColumnEl.appendChild( rowSourceEl ); @@ -273,12 +273,12 @@ void LookupFieldSchema::saveToDom(LookupFieldSchema& lookupSchema, QDomDocument& nameEl.appendChild( doc.createTextNode(lookupSchema.rowSource().name()) ); } - const QStringList& values( lookupSchema.rowSource().values() ); + const TQStringList& values( lookupSchema.rowSource().values() ); if (!values.isEmpty()) { - QDomElement valuesEl( doc.createElement("values") ); + TQDomElement valuesEl( doc.createElement("values") ); rowSourceEl.appendChild( valuesEl ); - for (QStringList::ConstIterator it = values.constBegin(); it!=values.constEnd(); ++it) { - QDomElement valueEl( doc.createElement("value") ); + for (TQStringList::ConstIterator it = values.constBegin(); it!=values.constEnd(); ++it) { + TQDomElement valueEl( doc.createElement("value") ); valuesEl.appendChild( valueEl ); valueEl.appendChild( doc.createTextNode(*it) ); } @@ -287,25 +287,25 @@ void LookupFieldSchema::saveToDom(LookupFieldSchema& lookupSchema, QDomDocument& if (lookupSchema.boundColumn()>=0) KexiDB::saveNumberElementToDom(doc, lookupColumnEl, "bound-column", lookupSchema.boundColumn()); - QValueList<uint> visibleColumns(lookupSchema.visibleColumns()); + TQValueList<uint> visibleColumns(lookupSchema.visibleColumns()); if (!visibleColumns.isEmpty()) { - QDomElement visibleColumnEl( doc.createElement("visible-column") ); + TQDomElement visibleColumnEl( doc.createElement("visible-column") ); lookupColumnEl.appendChild( visibleColumnEl ); - foreach (QValueList<uint>::ConstIterator, it, visibleColumns) { - QDomElement numberEl( doc.createElement("number") ); + foreach (TQValueList<uint>::ConstIterator, it, visibleColumns) { + TQDomElement numberEl( doc.createElement("number") ); visibleColumnEl.appendChild( numberEl ); - numberEl.appendChild( doc.createTextNode( QString::number(*it) ) ); + numberEl.appendChild( doc.createTextNode( TQString::number(*it) ) ); } } - const QValueList<int> columnWidths(lookupSchema.columnWidths()); + const TQValueList<int> columnWidths(lookupSchema.columnWidths()); if (!columnWidths.isEmpty()) { - QDomElement columnWidthsEl( doc.createElement("column-widths") ); + TQDomElement columnWidthsEl( doc.createElement("column-widths") ); lookupColumnEl.appendChild( columnWidthsEl ); - for (QValueList<int>::ConstIterator it = columnWidths.constBegin(); it!=columnWidths.constEnd(); ++it) { - QDomElement columnWidthEl( doc.createElement("number") ); + for (TQValueList<int>::ConstIterator it = columnWidths.constBegin(); it!=columnWidths.constEnd(); ++it) { + TQDomElement columnWidthEl( doc.createElement("number") ); columnWidthsEl.appendChild( columnWidthEl ); - columnWidthEl.appendChild( doc.createTextNode( QString::number(*it) ) ); + columnWidthEl.appendChild( doc.createTextNode( TQString::number(*it) ) ); } } @@ -317,7 +317,7 @@ void LookupFieldSchema::saveToDom(LookupFieldSchema& lookupSchema, QDomDocument& KexiDB::saveBooleanElementToDom(doc, lookupColumnEl, "limit-to-list", lookupSchema.limitToList()); if (lookupSchema.displayWidget()!=KEXIDB_LOOKUP_FIELD_DEFAULT_DISPLAY_WIDGET) { - QDomElement displayWidgetEl( doc.createElement("display-widget") ); + TQDomElement displayWidgetEl( doc.createElement("display-widget") ); lookupColumnEl.appendChild( displayWidgetEl ); displayWidgetEl.appendChild( doc.createTextNode( (lookupSchema.displayWidget()==ListBox) ? "listbox" : "combobox" ) ); @@ -326,7 +326,7 @@ void LookupFieldSchema::saveToDom(LookupFieldSchema& lookupSchema, QDomDocument& //static bool LookupFieldSchema::setProperty( - LookupFieldSchema& lookup, const QCString& propertyName, const QVariant& value ) + LookupFieldSchema& lookup, const TQCString& propertyName, const TQVariant& value ) { bool ok; if ("rowSource" == propertyName || "rowSourceType" == propertyName || "rowSourceValues" == propertyName) { @@ -346,8 +346,8 @@ bool LookupFieldSchema::setProperty( lookup.setBoundColumn( ival ); } else if ("visibleColumn" == propertyName ) { - QValueList<QVariant> variantList; - if (value.type()==QVariant::Int) { + TQValueList<TQVariant> variantList; + if (value.type()==TQVariant::Int) { //! @todo Remove this case: it's for backward compatibility with Kexi's 1.1.2 table designer GUI //! supporting only single lookup column. variantList.append( value.toInt() ); @@ -355,8 +355,8 @@ bool LookupFieldSchema::setProperty( else { variantList = value.toList(); } - QValueList<uint> visibleColumns; - foreach (QValueList<QVariant>::ConstIterator, it, variantList) { + TQValueList<uint> visibleColumns; + foreach (TQValueList<TQVariant>::ConstIterator, it, variantList) { const uint ival = (*it).toUInt(&ok); if (!ok) return false; @@ -365,9 +365,9 @@ bool LookupFieldSchema::setProperty( lookup.setVisibleColumns( visibleColumns ); } else if ("columnWidths" == propertyName ) { - QValueList<QVariant> variantList( value.toList() ); - QValueList<int> widths; - foreach (QValueList<QVariant>::ConstIterator, it, variantList) { + TQValueList<TQVariant> variantList( value.toList() ); + TQValueList<int> widths; + foreach (TQValueList<TQVariant>::ConstIterator, it, variantList) { const uint ival = (*it).toInt(&ok); if (!ok) return false; diff --git a/kexi/kexidb/lookupfieldschema.h b/kexi/kexidb/lookupfieldschema.h index 9494b348..35d3b59f 100644 --- a/kexi/kexidb/lookupfieldschema.h +++ b/kexi/kexidb/lookupfieldschema.h @@ -20,12 +20,12 @@ #ifndef KEXIDB_LOOKUPFIELDSCHEMA_H #define KEXIDB_LOOKUPFIELDSCHEMA_H -#include <qvaluelist.h> -#include <qstringlist.h> +#include <tqvaluelist.h> +#include <tqstringlist.h> -class QDomElement; -class QDomDocument; -class QVariant; +class TQDomElement; +class TQDomDocument; +class TQVariant; namespace KexiDB { @@ -81,38 +81,38 @@ class KEXI_DB_EXPORT LookupFieldSchema void setType(Type type) { m_type = type; } /*! @return row source type name. @see setTypeByName() */ - QString typeName() const; + TQString typeName() const; /*! Sets row source type by name using \a typeName. Accepted (cast sensitive) names are "table", "query", "sql", "valuelist", "fieldlist". For other value NoType type is set. */ - void setTypeByName( const QString& typeName ); + void setTypeByName( const TQString& typeName ); /*! @return a string for row source: table name, query name or anonymous query provided as KEXISQL string. If rowSourceType() is a ValueList, rowSourceValues() should be used instead. If rowSourceType() is a FieldList, rowSource() should return table or query name. */ - QString name() const { return m_name; } + TQString name() const { return m_name; } /*! Sets row source value. @see value() */ - void setName(const QString& name); + void setName(const TQString& name); /*! @return row source values specified if type() is ValueList. */ - QStringList values() const; + TQStringList values() const; /*! Sets row source values used if type() is ValueList. Using it clears name (see name()). */ - void setValues(const QStringList& values); + void setValues(const TQStringList& values); /*! \return String for debugging purposes. */ - QString debugString() const; + TQString debugString() const; /*! Shows debug information. */ void debug() const; private: Type m_type; - QString m_name; - QStringList *m_values; + TQString m_name; + TQStringList *m_values; }; LookupFieldSchema(); @@ -136,11 +136,11 @@ class KEXI_DB_EXPORT LookupFieldSchema /*! @return a list of visible column: a list of integers specifying a column that has to be visible in the combo box (counted from 0). Empty list means unspecified value. */ - QValueList<uint> visibleColumns() const { return m_visibleColumns; } + TQValueList<uint> visibleColumns() const { return m_visibleColumns; } /*! Sets a list of visible columns to \a list. Columns will be separated with a single space character when displayed. */ - void setVisibleColumns(const QValueList<uint>& list) { m_visibleColumns = list; } + void setVisibleColumns(const TQValueList<uint>& list) { m_visibleColumns = list; } /*! A helper method. If visibleColumns() contains one item, this item is returned (a typical case). @@ -157,10 +157,10 @@ class KEXI_DB_EXPORT LookupFieldSchema /*! @return a number of ordered integers specifying column widths; -1 means 'default width' for a given column. */ - const QValueList<int> columnWidths() const { return m_columnWidths; } + const TQValueList<int> columnWidths() const { return m_columnWidths; } /*! Sets column widths. @see columnWidths */ - void setColumnWidths(const QValueList<int>& widths) { m_columnWidths = widths; } + void setColumnWidths(const TQValueList<int>& widths) { m_columnWidths = widths; } /*! @return true if column headers are visible in the associated combo box popup or the list view. The default is false. */ @@ -202,7 +202,7 @@ class KEXI_DB_EXPORT LookupFieldSchema void setDisplayWidget(DisplayWidget widget) { m_displayWidget = widget; } /*! \return String for debugging purposes. */ - QString debugString() const; + TQString debugString() const; /*! Shows debug information. */ void debug() const; @@ -210,21 +210,21 @@ class KEXI_DB_EXPORT LookupFieldSchema /*! Loads data of lookup column schema from DOM tree. The data can be outdated or invalid, so the app should handle such cases. @return a new LookupFieldSchema object even if lookupEl contains no valid contents. */ - static LookupFieldSchema* loadFromDom(const QDomElement& lookupEl); + static LookupFieldSchema* loadFromDom(const TQDomElement& lookupEl); - /*! Saves data of lookup column schema to \a parentEl DOM element of \a doc document. */ - static void saveToDom(LookupFieldSchema& lookupSchema, QDomDocument& doc, QDomElement& parentEl); + /*! Saves data of lookup column schema to \a tqparentEl DOM element of \a doc document. */ + static void saveToDom(LookupFieldSchema& lookupSchema, TQDomDocument& doc, TQDomElement& tqparentEl); /*! Sets property of name \a propertyName and value \a value for the lookup schema \a lookup \return true on successful set and false on failure because of invalid value or invalid property name. */ static bool setProperty( - LookupFieldSchema& lookup, const QCString& propertyName, const QVariant& value ); + LookupFieldSchema& lookup, const TQCString& propertyName, const TQVariant& value ); protected: RowSource m_rowSource; int m_boundColumn; - QValueList<uint> m_visibleColumns; - QValueList<int> m_columnWidths; + TQValueList<uint> m_visibleColumns; + TQValueList<int> m_columnWidths; uint m_maximumListRows; DisplayWidget m_displayWidget; bool m_columnHeadersVisible : 1; diff --git a/kexi/kexidb/msghandler.cpp b/kexi/kexidb/msghandler.cpp index 1cacae5e..f2946a2b 100644 --- a/kexi/kexidb/msghandler.cpp +++ b/kexi/kexidb/msghandler.cpp @@ -21,7 +21,7 @@ using namespace KexiDB; -MessageTitle::MessageTitle(Object* o, const QString& msg) +MessageTitle::MessageTitle(Object* o, const TQString& msg) : m_obj(o) , m_prevMsgTitle(o->m_msgTitle) { @@ -35,8 +35,8 @@ MessageTitle::~MessageTitle() //------------------------------------------------ -MessageHandler::MessageHandler(QWidget *parent) - : m_messageHandlerParentWidget(parent) +MessageHandler::MessageHandler(TQWidget *tqparent) + : m_messageHandlerParentWidget(tqparent) , m_enableMessages(true) { } @@ -45,11 +45,11 @@ MessageHandler::~MessageHandler() { } -int MessageHandler::askQuestion( const QString& message, +int MessageHandler::askQuestion( const TQString& message, KMessageBox::DialogType dlgType, KMessageBox::ButtonCode defaultResult, const KGuiItem &buttonYes, const KGuiItem &buttonNo, - const QString &dontShowAskAgainName, + const TQString &dontShowAskAgainName, int options ) { Q_UNUSED(message); diff --git a/kexi/kexidb/msghandler.h b/kexi/kexidb/msghandler.h index da907c7e..c0c8c494 100644 --- a/kexi/kexidb/msghandler.h +++ b/kexi/kexidb/msghandler.h @@ -21,8 +21,8 @@ #define KEXIDB_MSGHANDLER_H #include <kexidb/object.h> -#include <qguardedptr.h> -#include <qwidget.h> +#include <tqguardedptr.h> +#include <tqwidget.h> namespace KexiDB { @@ -38,12 +38,12 @@ namespace KexiDB { class KEXI_DB_EXPORT MessageTitle { public: - MessageTitle(KexiDB::Object* o, const QString& msg = QString::null); + MessageTitle(KexiDB::Object* o, const TQString& msg = TQString()); ~MessageTitle(); protected: Object* m_obj; - QString m_prevMsgTitle; + TQString m_prevMsgTitle; }; /*! A prototype for Message Handler usable @@ -54,9 +54,9 @@ class KEXI_DB_EXPORT MessageHandler public: enum MessageType { Error, Sorry, Warning }; - /*! Constructs mesage handler, \a parent is a widget that will be a parent + /*! Constructs mesage handler, \a tqparent is a widget that will be a tqparent for displaying gui elements (e.g. message boxes). Can be 0 for non-gui usage. */ - MessageHandler(QWidget *parent = 0); + MessageHandler(TQWidget *tqparent = 0); virtual ~MessageHandler(); /*! This method can be used to block/unblock messages. @@ -68,12 +68,12 @@ class KEXI_DB_EXPORT MessageHandler inline void enableMessages(bool enable) { m_enableMessages = enable; } /*! Shows error message with \a title (it is not caption) and details. */ - virtual void showErrorMessage(const QString &title, - const QString &details = QString::null) = 0; + virtual void showErrorMessage(const TQString &title, + const TQString &details = TQString()) = 0; /*! Shows error message with \a msg text. Existing error message from \a obj object is also copied, if present. */ - virtual void showErrorMessage(KexiDB::Object *obj, const QString& msg = QString::null) = 0; + virtual void showErrorMessage(KexiDB::Object *obj, const TQString& msg = TQString()) = 0; /*! Interactively asks a question. For GUI version, KMessageBox class is used. See KMessageBox documentation for explanation of the parameters. @@ -81,15 +81,15 @@ class KEXI_DB_EXPORT MessageHandler \a message should be i18n's string. Value from KMessageBox::ButtonCode enum is returned. Reimplement this. This implementation does nothing, just returns \a defaultResult. */ - virtual int askQuestion( const QString& message, + virtual int askQuestion( const TQString& message, KMessageBox::DialogType dlgType, KMessageBox::ButtonCode defaultResult, const KGuiItem &buttonYes=KStdGuiItem::yes(), const KGuiItem &buttonNo=KStdGuiItem::no(), - const QString &dontShowAskAgainName = QString::null, + const TQString &dontShowAskAgainName = TQString(), int options = KMessageBox::Notify ); protected: - QGuardedPtr<QWidget> m_messageHandlerParentWidget; + TQGuardedPtr<TQWidget> m_messageHandlerParentWidget; bool m_enableMessages : 1; }; diff --git a/kexi/kexidb/object.cpp b/kexi/kexidb/object.cpp index f4228bc7..2e32274d 100644 --- a/kexi/kexidb/object.cpp +++ b/kexi/kexidb/object.cpp @@ -50,7 +50,7 @@ Object::~Object() KexiDBDbg << "Object ERROR: " << m_previousServerResultNum2 << ": " \ << m_previousServerResultName2 <<endl -void Object::setError( int code, const QString &msg ) +void Object::setError( int code, const TQString &msg ) { STORE_PREV_ERR; @@ -66,17 +66,17 @@ void Object::setError( int code, const QString &msg ) ERRMSG(this); } -void Object::setError( const QString &msg ) +void Object::setError( const TQString &msg ) { setError( ERR_OTHER, msg ); } -void Object::setError( const QString& title, const QString &msg ) +void Object::setError( const TQString& title, const TQString &msg ) { STORE_PREV_ERR; m_errno=ERR_OTHER; - QString origMsgTitle( m_msgTitle ); //store + TQString origMsgTitle( m_msgTitle ); //store m_msgTitle += title; m_errMsg = msg; @@ -88,12 +88,12 @@ void Object::setError( const QString& title, const QString &msg ) m_msgTitle = origMsgTitle; //revert } -void Object::setError( KexiDB::Object *obj, const QString& prependMessage ) +void Object::setError( KexiDB::Object *obj, const TQString& prependMessage ) { setError( obj, obj ? obj->errorNum() : ERR_OTHER, prependMessage ); } -void Object::setError( KexiDB::Object *obj, int code, const QString& prependMessage ) +void Object::setError( KexiDB::Object *obj, int code, const TQString& prependMessage ) { if (obj && (obj->errorNum()!=0 || !obj->serverErrorMsg().isEmpty())) { STORE_PREV_ERR; @@ -104,7 +104,7 @@ void Object::setError( KexiDB::Object *obj, int code, const QString& prependMess m_errno = code; m_hasError = true; } - m_errMsg = (prependMessage.isEmpty() ? QString::null : (prependMessage + " ")) + m_errMsg = (prependMessage.isEmpty() ? TQString() : (prependMessage + " ")) + obj->errorMsg(); m_sql = obj->m_sql; m_errorSql = obj->m_errorSql; @@ -132,16 +132,16 @@ void Object::clearError() { m_errno = 0; m_hasError = false; - m_errMsg = QString::null; - m_sql = QString::null; - m_errorSql = QString::null; + m_errMsg = TQString(); + m_sql = TQString(); + m_errorSql = TQString(); m_serverResult = 0; - m_serverResultName = QString::null; - m_serverErrorMsg = QString::null; + m_serverResultName = TQString(); + m_serverErrorMsg = TQString(); drv_clearServerResult(); } -QString Object::serverErrorMsg() +TQString Object::serverErrorMsg() { return m_serverErrorMsg; } @@ -151,7 +151,7 @@ int Object::serverResult() return m_serverResult; } -QString Object::serverResultName() +TQString Object::serverResultName() { return m_serverResultName; } @@ -160,7 +160,7 @@ void Object::debugError() { if (error()) { KexiDBDbg << "KEXIDB ERROR: " << errorMsg() << endl; - QString s = serverErrorMsg(), sn = serverResultName(); + TQString s = serverErrorMsg(), sn = serverResultName(); if (!s.isEmpty()) KexiDBDbg << "KEXIDB SERVER ERRMSG: " << s << endl; if (!sn.isEmpty()) @@ -171,11 +171,11 @@ void Object::debugError() KexiDBDbg << "KEXIDB OK." << endl; } -int Object::askQuestion( const QString& message, +int Object::askQuestion( const TQString& message, KMessageBox::DialogType dlgType, KMessageBox::ButtonCode defaultResult, const KGuiItem &buttonYes, const KGuiItem &buttonNo, - const QString &dontShowAskAgainName, + const TQString &dontShowAskAgainName, int options, MessageHandler* msgHandler ) { diff --git a/kexi/kexidb/object.h b/kexi/kexidb/object.h index aff98491..232535d1 100644 --- a/kexi/kexidb/object.h +++ b/kexi/kexidb/object.h @@ -23,7 +23,7 @@ #include <kexidb/error.h> #include <kmessagebox.h> #include <kstdguiitem.h> -#include <qstring.h> +#include <tqstring.h> namespace KexiDB { @@ -39,7 +39,7 @@ class KEXI_DB_EXPORT Object /*! \return (localized) error message if there was error during last operation on the object, else: 0. */ - const QString& errorMsg() const { return m_errMsg; } + const TQString& errorMsg() const { return m_errMsg; } /*! \return error number of if there was error during last operation on the object, else: 0. */ @@ -48,7 +48,7 @@ class KEXI_DB_EXPORT Object //! \return previous server result number, for error displaying purposes. int previousServerResult() const { return m_previousServerResultNum; } - QString previousServerResultName() const { return m_previousServerResultName; } + TQString previousServerResultName() const { return m_previousServerResultName; } /*! Sends errorMsg() to debug output. */ void debugError(); @@ -71,7 +71,7 @@ class KEXI_DB_EXPORT Object - default implementation just returns null string. \sa serverErrorMsg() */ - virtual QString serverErrorMsg(); + virtual TQString serverErrorMsg(); /*! \return engine-specific last server-side operation result number. Use this in your application to give users more information on what's up. @@ -93,16 +93,16 @@ class KEXI_DB_EXPORT Object by serverErorMsg() or erorMsg() \sa serverErrorMsg(), drv_clearServerResult() */ - virtual QString serverResultName(); + virtual TQString serverResultName(); /*! \return message title that sometimes is provided and prepended to the main warning/error message. Used by MessageHandler. */ - QString msgTitle() const { return m_msgTitle; } + TQString msgTitle() const { return m_msgTitle; } /*! \return sql string of actually executed SQL statement, usually using drv_executeSQL(). If there was error during executing SQL statement, before, that string is returned instead. */ - const QString recentSQLString() const { return m_errorSql.isEmpty() ? m_sql : m_errorSql; } + const TQString recentSQLString() const { return m_errorSql.isEmpty() ? m_sql : m_errorSql; } protected: /* Constructs a new object. @@ -118,34 +118,34 @@ class KEXI_DB_EXPORT Object and default message for this will be set. Use this in KexiDB::Object subclasses to informa the world about your object's state. */ - virtual void setError(int code = ERR_OTHER, const QString &msg = QString::null ); + virtual void setError(int code = ERR_OTHER, const TQString &msg = TQString() ); - /*! \overload void setError(int code, const QString &msg = QString::null ) + /*! \overload void setError(int code, const TQString &msg = TQString() ) Sets error code to ERR_OTHER. Use this if you don't care about setting error code. */ - virtual void setError( const QString &msg ); + virtual void setError( const TQString &msg ); - /*! \overload void setError(const QString &msg) + /*! \overload void setError(const TQString &msg) Also sets \a title. */ - virtual void setError( const QString &title, const QString &msg ); + virtual void setError( const TQString &title, const TQString &msg ); /*! Copies the (localized) error message and code from other KexiDB::Object. */ - void setError( KexiDB::Object *obj, const QString& prependMessage = QString::null ); + void setError( KexiDB::Object *obj, const TQString& prependMessage = TQString() ); /*! Copies the (localized) error message and code from other KexiDB::Object with custom error \a code. */ virtual void setError( KexiDB::Object *obj, int code, - const QString& prependMessage = QString::null ); + const TQString& prependMessage = TQString() ); /*! Interactively asks a question. Console or GUI can be used for this, depending on installed message handler. For GUI version, KMessageBox class is used. See KexiDB::MessageHandler::askQuestion() for details. */ - virtual int askQuestion( const QString& message, + virtual int askQuestion( const TQString& message, KMessageBox::DialogType dlgType, KMessageBox::ButtonCode defaultResult, const KGuiItem &buttonYes=KStdGuiItem::yes(), const KGuiItem &buttonNo=KStdGuiItem::no(), - const QString &dontShowAskAgainName = QString::null, + const TQString &dontShowAskAgainName = TQString(), int options = KMessageBox::Notify, MessageHandler* msgHandler = 0 ); @@ -158,10 +158,10 @@ class KEXI_DB_EXPORT Object virtual void drv_clearServerResult() {}; //! used to store of actually executed SQL statement - QString m_sql, m_errorSql; + TQString m_sql, m_errorSql; int m_serverResult; - QString m_serverResultName, m_serverErrorMsg; - QString m_errMsg; + TQString m_serverResultName, m_serverErrorMsg; + TQString m_errMsg; private: int m_errno; @@ -170,9 +170,9 @@ class KEXI_DB_EXPORT Object //! previous server result number, for error displaying purposes. int m_previousServerResultNum, m_previousServerResultNum2; //! previous server result name, for error displaying purposes. - QString m_previousServerResultName, m_previousServerResultName2; + TQString m_previousServerResultName, m_previousServerResultName2; - QString m_msgTitle; + TQString m_msgTitle; MessageHandler *m_msgHandler; class Private; diff --git a/kexi/kexidb/parser/parser.cpp b/kexi/kexidb/parser/parser.cpp index f64ec96d..eeb6e39d 100644 --- a/kexi/kexidb/parser/parser.cpp +++ b/kexi/kexidb/parser/parser.cpp @@ -41,7 +41,7 @@ Parser::~Parser() Parser::OPCode Parser::operation() const { return (OPCode)d->operation; } -QString +TQString Parser::operationString() const { switch((OPCode)d->operation) { @@ -72,7 +72,7 @@ Connection *Parser::db() const { return d->db; } ParserError Parser::error() const { return d->error; } -QString Parser::statement() const { return d->statement; } +TQString Parser::statement() const { return d->statement; } void Parser::setOperation(OPCode op) { d->operation = op; } @@ -109,11 +109,11 @@ void Parser::init() bool Parser::isReservedKeyword(const char *str) { - return d->reservedKeywords.find(str); + return d->reservedKeywords.tqfind(str); } bool -Parser::parse(const QString &statement) +Parser::parse(const TQString &statement) { init(); clear(); @@ -141,7 +141,7 @@ ParserError::ParserError() // m_isNull = true; } -ParserError::ParserError(const QString &type, const QString &error, const QString &hint, int at) +ParserError::ParserError(const TQString &type, const TQString &error, const TQString &hint, int at) { m_type = type; m_error = error; diff --git a/kexi/kexidb/parser/parser.h b/kexi/kexidb/parser/parser.h index ec2942e1..c408dec5 100644 --- a/kexi/kexidb/parser/parser.h +++ b/kexi/kexidb/parser/parser.h @@ -21,9 +21,9 @@ #ifndef KEXIDBPARSER_H #define KEXIDBPARSER_H -#include <qobject.h> -#include <qptrlist.h> -#include <qvariant.h> +#include <tqobject.h> +#include <tqptrlist.h> +#include <tqvariant.h> #include <kexidb/field.h> #include <kexidb/expression.h> @@ -56,7 +56,7 @@ class KEXI_DB_EXPORT ParserError * \param hint Token where the error happend. * \param at The position where the error happend. */ - ParserError(const QString &type, const QString &error, const QString &hint, int at); + ParserError(const TQString &type, const TQString &error, const TQString &hint, int at); /** * Destructor. @@ -66,12 +66,12 @@ class KEXI_DB_EXPORT ParserError /** * \return the errortype. */ - QString type() { return m_type; } + TQString type() { return m_type; } /** * \return a descriping error message. */ - QString error() { return m_error; } + TQString error() { return m_error; } /** * \return position where the error happend. @@ -79,9 +79,9 @@ class KEXI_DB_EXPORT ParserError int at() { return m_at; } private: - QString m_type; - QString m_error; - QString m_hint; + TQString m_type; + TQString m_error; + TQString m_hint; int m_at; // bool m_isNull; }; @@ -138,7 +138,7 @@ class KEXI_DB_EXPORT Parser /** * clears previous results and runs the parser */ - bool parse(const QString &statement); + bool parse(const TQString &statement); /** * rests results @@ -153,7 +153,7 @@ class KEXI_DB_EXPORT Parser /** * \return the resulting operation as string. */ - QString operationString() const; + TQString operationString() const; /** * \return a pointer to a KexiDBTable on CREATE TABLE @@ -187,7 +187,7 @@ class KEXI_DB_EXPORT Parser /** * \return the statement passed on the last \a parse method-call. */ - QString statement() const; + TQString statement() const; /** * \internal 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; diff --git a/kexi/kexidb/parser/parser_p.h b/kexi/kexidb/parser/parser_p.h index 6a695bc5..d03955c8 100644 --- a/kexi/kexidb/parser/parser_p.h +++ b/kexi/kexidb/parser/parser_p.h @@ -20,10 +20,10 @@ #ifndef KEXIDB_PARSER_P_H #define KEXIDB_PARSER_P_H -#include <qvaluelist.h> -#include <qdict.h> -#include <qasciicache.h> -#include <qstring.h> +#include <tqvaluelist.h> +#include <tqdict.h> +#include <tqasciicache.h> +#include <tqstring.h> #include <kexidb/queryschema.h> #include <kexidb/tableschema.h> @@ -47,9 +47,9 @@ class ParserPrivate TableSchema *table; QuerySchema *select; Connection *db; - QString statement; + TQString statement; ParserError error; - QAsciiCache<char> reservedKeywords; + TQAsciiCache<char> reservedKeywords; bool initialized : 1; }; @@ -62,17 +62,17 @@ class ParseInfo ~ParseInfo(); //! collects positions of tables/aliases with the same names - QDict< QValueList<int> > repeatedTablesAndAliases; + TQDict< TQValueList<int> > repeatedTablesAndAliases; - QString errMsg, errDescr; //helpers + TQString errMsg, errDescr; //helpers QuerySchema *querySchema; }; } void yyerror(const char *str); -void setError(const QString& errName, const QString& errDesc); -void setError(const QString& errDesc); +void setError(const TQString& errName, const TQString& errDesc); +void setError(const TQString& errDesc); //bool parseData(KexiDB::Parser *p, const char *data); bool addColumn( KexiDB::ParseInfo& parseInfo, KexiDB::BaseExpr* columnExpr ); KexiDB::QuerySchema* buildSelectQuery( diff --git a/kexi/kexidb/parser/sqlparser.cpp b/kexi/kexidb/parser/sqlparser.cpp index 682b8aa0..f4086b3b 100644 --- a/kexi/kexidb/parser/sqlparser.cpp +++ b/kexi/kexidb/parser/sqlparser.cpp @@ -20,7 +20,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -/* As a special exception, you may create a larger work that contains +/* As a special exception, you may create a larger work that tqcontains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof @@ -174,12 +174,12 @@ DISTINCT = 363, DOMAIN_TOKEN = 364, SQL_DOUBLE = 365, - DOUBLE_QUOTED_STRING = 366, + DOUBLE_TQUOTED_STRING = 366, DROP = 367, ELSE = 368, END = 369, END_EXEC = 370, - EQUAL = 371, + ETQUAL = 371, ESCAPE = 372, EXCEPT = 373, SQL_EXCEPTION = 374, @@ -296,7 +296,7 @@ PARTIAL = 485, SQL_PASCAL = 486, PERSISTENT = 487, - CQL_PI = 488, + CTQL_PI = 488, PLI = 489, POSITION = 490, PRECISION = 491, @@ -308,8 +308,8 @@ PROCEDURE = 497, PRODUCT = 498, PUBLIC = 499, - QUARTER = 500, - QUIT = 501, + TQUARTER = 500, + TQUIT = 501, RAND = 502, READ_ONLY = 503, REAL = 504, @@ -381,7 +381,7 @@ TWO_DIGITS = 570, UCASE = 571, UNION = 572, - UNIQUE = 573, + UNITQUE = 573, SQL_UNKNOWN = 574, UPDATE = 575, UPPER = 576, @@ -389,7 +389,7 @@ USER = 578, IDENTIFIER = 579, IDENTIFIER_DOT_ASTERISK = 580, - QUERY_PARAMETER = 581, + TQUERY_PARAMETER = 581, USING = 582, VALUE = 583, VALUES = 584, @@ -524,12 +524,12 @@ #define DISTINCT 363 #define DOMAIN_TOKEN 364 #define SQL_DOUBLE 365 -#define DOUBLE_QUOTED_STRING 366 +#define DOUBLE_TQUOTED_STRING 366 #define DROP 367 #define ELSE 368 #define END 369 #define END_EXEC 370 -#define EQUAL 371 +#define ETQUAL 371 #define ESCAPE 372 #define EXCEPT 373 #define SQL_EXCEPTION 374 @@ -646,7 +646,7 @@ #define PARTIAL 485 #define SQL_PASCAL 486 #define PERSISTENT 487 -#define CQL_PI 488 +#define CTQL_PI 488 #define PLI 489 #define POSITION 490 #define PRECISION 491 @@ -658,8 +658,8 @@ #define PROCEDURE 497 #define PRODUCT 498 #define PUBLIC 499 -#define QUARTER 500 -#define QUIT 501 +#define TQUARTER 500 +#define TQUIT 501 #define RAND 502 #define READ_ONLY 503 #define REAL 504 @@ -731,7 +731,7 @@ #define TWO_DIGITS 570 #define UCASE 571 #define UNION 572 -#define UNIQUE 573 +#define UNITQUE 573 #define SQL_UNKNOWN 574 #define UPDATE 575 #define UPPER 576 @@ -739,7 +739,7 @@ #define USER 578 #define IDENTIFIER 579 #define IDENTIFIER_DOT_ASTERISK 580 -#define QUERY_PARAMETER 581 +#define TQUERY_PARAMETER 581 #define USING 582 #define VALUE 583 #define VALUES 584 @@ -780,7 +780,7 @@ #include <assert.h> #include <limits.h> //TODO OK? -#ifdef Q_WS_WIN +#ifdef TQ_WS_WIN //workaround for bug on msvc # undef LLONG_MIN #endif @@ -798,12 +798,12 @@ # include <malloc.h> #endif -#include <qobject.h> +#include <tqobject.h> #include <kdebug.h> #include <klocale.h> -#include <qptrlist.h> -#include <qcstring.h> -#include <qvariant.h> +#include <tqptrlist.h> +#include <tqcstring.h> +#include <tqvariant.h> #include <connection.h> #include <queryschema.h> @@ -834,7 +834,7 @@ using namespace KexiDB; #if 0 struct yyval { - QString parserUserName; + TQString parserUserName; int integerValue; KexiDBField::ColumnType coltype; } @@ -864,8 +864,8 @@ using namespace KexiDB; typedef union YYSTYPE #line 511 "sqlparser.y" { - QString* stringValue; - Q_LLONG integerValue; + TQString* stringValue; + TQ_LLONG integerValue; bool booleanValue; struct realType realValue; KexiDB::Field::Type colType; @@ -876,7 +876,7 @@ typedef union YYSTYPE KexiDB::QuerySchema *querySchema; SelectOptionsInternal *selectOptions; OrderByColumnInternal::List *orderByColumns; - QVariant *variantValue; + TQVariant *variantValue; } /* Line 193 of yacc.c. */ #line 883 "sqlparser.tab.c" @@ -1290,8 +1290,8 @@ static const char *const yytname[] = "DEC", "DECLARE", "DEFAULT", "DEFERRABLE", "DEFERRED", "SQL_DELETE", "DESC", "DESCRIBE", "DESCRIPTOR", "DIAGNOSTICS", "DICTIONARY", "DIRECTORY", "DISCONNECT", "DISPLACEMENT", "DISTINCT", "DOMAIN_TOKEN", - "SQL_DOUBLE", "DOUBLE_QUOTED_STRING", "DROP", "ELSE", "END", "END_EXEC", - "EQUAL", "ESCAPE", "EXCEPT", "SQL_EXCEPTION", "EXEC", "EXECUTE", + "SQL_DOUBLE", "DOUBLE_TQUOTED_STRING", "DROP", "ELSE", "END", "END_EXEC", + "ETQUAL", "ESCAPE", "EXCEPT", "SQL_EXCEPTION", "EXEC", "EXECUTE", "EXISTS", "EXP", "EXPONENT", "EXTERNAL", "EXTRACT", "SQL_FALSE", "FETCH", "FIRST", "SQL_FLOAT", "FLOOR", "FN", "FOR", "FOREIGN", "FORTRAN", "FOUND", "FOUR_DIGITS", "FROM", "FULL", "GET", "GLOBAL", "GO", "GOTO", @@ -1308,9 +1308,9 @@ static const char *const yytname[] = "NOW", "SQL_NULL", "SQL_IS", "SQL_IS_NULL", "SQL_IS_NOT_NULL", "NULLIF", "NUMERIC", "OCTET_LENGTH", "ODBC", "OF", "SQL_OFF", "SQL_ON", "ONLY", "OPEN", "OPTION", "OR", "ORDER", "OUTER", "OUTPUT", "OVERLAPS", "PAGE", - "PARTIAL", "SQL_PASCAL", "PERSISTENT", "CQL_PI", "PLI", "POSITION", + "PARTIAL", "SQL_PASCAL", "PERSISTENT", "CTQL_PI", "PLI", "POSITION", "PRECISION", "PREPARE", "PRESERVE", "PRIMARY", "PRIOR", "PRIVILEGES", - "PROCEDURE", "PRODUCT", "PUBLIC", "QUARTER", "QUIT", "RAND", "READ_ONLY", + "PROCEDURE", "PRODUCT", "PUBLIC", "TQUARTER", "TQUIT", "RAND", "READ_ONLY", "REAL", "REFERENCES", "REPEAT", "REPLACE", "RESTRICT", "REVOKE", "RIGHT", "ROLLBACK", "ROWS", "RPAD", "RTRIM", "SCHEMA", "SCREEN_WIDTH", "SCROLL", "SECOND", "SECONDS_BETWEEN", "SELECT", "SEQUENCE", "SETOPT", "SET", @@ -1322,9 +1322,9 @@ static const char *const yytname[] = "TAN", "TEMPORARY", "THEN", "THREE_DIGITS", "TIME", "TIMESTAMP", "TIMEZONE_HOUR", "TIMEZONE_MINUTE", "TINYINT", "TO", "TO_CHAR", "TO_DATE", "TRANSACTION", "TRANSLATE", "TRANSLATION", "TRUNCATE", - "GENERAL_TITLE", "TWO_DIGITS", "UCASE", "UNION", "UNIQUE", "SQL_UNKNOWN", + "GENERAL_TITLE", "TWO_DIGITS", "UCASE", "UNION", "UNITQUE", "SQL_UNKNOWN", "UPDATE", "UPPER", "USAGE", "USER", "IDENTIFIER", - "IDENTIFIER_DOT_ASTERISK", "QUERY_PARAMETER", "USING", "VALUE", "VALUES", + "IDENTIFIER_DOT_ASTERISK", "TQUERY_PARAMETER", "USING", "VALUE", "VALUES", "VARBINARY", "VARCHAR", "VARYING", "VENDOR", "VIEW", "WEEK", "WHEN", "WHENEVER", "WHERE", "WHERE_CURRENT_OF", "WITH", "WORD_WRAPPED", "WORK", "WRAPPED", "XOR", "YEAR", "YEARS_BETWEEN", "SCAN_ERROR", "__LAST_TOKEN", @@ -2703,7 +2703,7 @@ YYACCEPT; case 38: #line 828 "sqlparser.y" { - (yyval.variantValue) = new QVariant( *(yyvsp[(1) - (1)].stringValue) ); + (yyval.variantValue) = new TQVariant( *(yyvsp[(1) - (1)].stringValue) ); KexiDBDbg << "OrderByColumnId: " << *(yyval.variantValue) << endl; delete (yyvsp[(1) - (1)].stringValue); ;} @@ -2712,7 +2712,7 @@ YYACCEPT; case 39: #line 834 "sqlparser.y" { - (yyval.variantValue) = new QVariant( *(yyvsp[(1) - (3)].stringValue) + "." + *(yyvsp[(3) - (3)].stringValue) ); + (yyval.variantValue) = new TQVariant( *(yyvsp[(1) - (3)].stringValue) + "." + *(yyvsp[(3) - (3)].stringValue) ); KexiDBDbg << "OrderByColumnId: " << *(yyval.variantValue) << endl; delete (yyvsp[(1) - (3)].stringValue); delete (yyvsp[(3) - (3)].stringValue); @@ -2722,7 +2722,7 @@ YYACCEPT; case 40: #line 841 "sqlparser.y" { - (yyval.variantValue) = new QVariant((yyvsp[(1) - (1)].integerValue)); + (yyval.variantValue) = new TQVariant((yyvsp[(1) - (1)].integerValue)); KexiDBDbg << "OrderByColumnId: " << *(yyval.variantValue) << endl; ;} break; @@ -2988,10 +2988,10 @@ YYACCEPT; case 84: #line 1054 "sqlparser.y" { - (yyval.expr) = new ConstExpr( SQL_NULL, QVariant() ); + (yyval.expr) = new ConstExpr( SQL_NULL, TQVariant() ); KexiDBDbg << " + NULL" << endl; // $$ = new Field(); - //$$->setName(QString::null); + //$$->setName(TQString()); ;} break; @@ -3007,16 +3007,16 @@ YYACCEPT; case 86: #line 1067 "sqlparser.y" { - QVariant val; + TQVariant val; if ((yyvsp[(1) - (1)].integerValue) <= INT_MAX && (yyvsp[(1) - (1)].integerValue) >= INT_MIN) val = (int)(yyvsp[(1) - (1)].integerValue); else if ((yyvsp[(1) - (1)].integerValue) <= UINT_MAX && (yyvsp[(1) - (1)].integerValue) >= 0) val = (uint)(yyvsp[(1) - (1)].integerValue); - else if ((yyvsp[(1) - (1)].integerValue) <= (Q_LLONG)LLONG_MAX && (yyvsp[(1) - (1)].integerValue) >= (Q_LLONG)LLONG_MIN) - val = (Q_LLONG)(yyvsp[(1) - (1)].integerValue); + else if ((yyvsp[(1) - (1)].integerValue) <= (TQ_LLONG)LLONG_MAX && (yyvsp[(1) - (1)].integerValue) >= (TQ_LLONG)LLONG_MIN) + val = (TQ_LLONG)(yyvsp[(1) - (1)].integerValue); // if ($1 < ULLONG_MAX) -// val = (Q_ULLONG)$1; +// val = (TQ_ULLONG)$1; //TODO ok? (yyval.expr) = new ConstExpr( INTEGER_CONST, val ); @@ -3027,7 +3027,7 @@ YYACCEPT; case 87: #line 1084 "sqlparser.y" { - (yyval.expr) = new ConstExpr( REAL_CONST, QPoint( (yyvsp[(1) - (1)].realValue).integer, (yyvsp[(1) - (1)].realValue).fractional ) ); + (yyval.expr) = new ConstExpr( REAL_CONST, TQPoint( (yyvsp[(1) - (1)].realValue).integer, (yyvsp[(1) - (1)].realValue).fractional ) ); KexiDBDbg << " + real constant: " << (yyvsp[(1) - (1)].realValue).integer << "." << (yyvsp[(1) - (1)].realValue).fractional << endl; ;} break; @@ -3111,7 +3111,7 @@ YYACCEPT; Field *f = item->table()->field(item->name()); if(!f) { - ParserError err(i18n("Field List Error"), i18n("Unknown column '%1' in table '%2'").arg(item->name()).arg(schema->name()), ctoken, current); + ParserError err(i18n("Field List Error"), i18n("Unknown column '%1' in table '%2'").tqarg(item->name()).tqarg(schema->name()), ctoken, current); parser->setError(err); yyerror("fieldlisterror"); } @@ -3242,7 +3242,7 @@ YYACCEPT; case 108: #line 1352 "sqlparser.y" { - QString s( *(yyvsp[(1) - (3)].stringValue) ); + TQString s( *(yyvsp[(1) - (3)].stringValue) ); s += ".*"; (yyval.expr) = new VariableExpr(s); KexiDBDbg << " + all columns from " << s << endl; diff --git a/kexi/kexidb/parser/sqlparser.h b/kexi/kexidb/parser/sqlparser.h index 7caf4b87..6895e29f 100644 --- a/kexi/kexidb/parser/sqlparser.h +++ b/kexi/kexidb/parser/sqlparser.h @@ -27,7 +27,7 @@ bool parseData(KexiDB::Parser *p, const char *data); Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -/* As a special exception, you may create a larger work that contains +/* As a special exception, you may create a larger work that tqcontains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof @@ -154,12 +154,12 @@ bool parseData(KexiDB::Parser *p, const char *data); DISTINCT = 363, DOMAIN_TOKEN = 364, SQL_DOUBLE = 365, - DOUBLE_QUOTED_STRING = 366, + DOUBLE_TQUOTED_STRING = 366, DROP = 367, ELSE = 368, END = 369, END_EXEC = 370, - EQUAL = 371, + ETQUAL = 371, ESCAPE = 372, EXCEPT = 373, SQL_EXCEPTION = 374, @@ -276,7 +276,7 @@ bool parseData(KexiDB::Parser *p, const char *data); PARTIAL = 485, SQL_PASCAL = 486, PERSISTENT = 487, - CQL_PI = 488, + CTQL_PI = 488, PLI = 489, POSITION = 490, PRECISION = 491, @@ -288,8 +288,8 @@ bool parseData(KexiDB::Parser *p, const char *data); PROCEDURE = 497, PRODUCT = 498, PUBLIC = 499, - QUARTER = 500, - QUIT = 501, + TQUARTER = 500, + TQUIT = 501, RAND = 502, READ_ONLY = 503, REAL = 504, @@ -361,7 +361,7 @@ bool parseData(KexiDB::Parser *p, const char *data); TWO_DIGITS = 570, UCASE = 571, UNION = 572, - UNIQUE = 573, + UNITQUE = 573, SQL_UNKNOWN = 574, UPDATE = 575, UPPER = 576, @@ -369,7 +369,7 @@ bool parseData(KexiDB::Parser *p, const char *data); USER = 578, IDENTIFIER = 579, IDENTIFIER_DOT_ASTERISK = 580, - QUERY_PARAMETER = 581, + TQUERY_PARAMETER = 581, USING = 582, VALUE = 583, VALUES = 584, @@ -504,12 +504,12 @@ bool parseData(KexiDB::Parser *p, const char *data); #define DISTINCT 363 #define DOMAIN_TOKEN 364 #define SQL_DOUBLE 365 -#define DOUBLE_QUOTED_STRING 366 +#define DOUBLE_TQUOTED_STRING 366 #define DROP 367 #define ELSE 368 #define END 369 #define END_EXEC 370 -#define EQUAL 371 +#define ETQUAL 371 #define ESCAPE 372 #define EXCEPT 373 #define SQL_EXCEPTION 374 @@ -626,7 +626,7 @@ bool parseData(KexiDB::Parser *p, const char *data); #define PARTIAL 485 #define SQL_PASCAL 486 #define PERSISTENT 487 -#define CQL_PI 488 +#define CTQL_PI 488 #define PLI 489 #define POSITION 490 #define PRECISION 491 @@ -638,8 +638,8 @@ bool parseData(KexiDB::Parser *p, const char *data); #define PROCEDURE 497 #define PRODUCT 498 #define PUBLIC 499 -#define QUARTER 500 -#define QUIT 501 +#define TQUARTER 500 +#define TQUIT 501 #define RAND 502 #define READ_ONLY 503 #define REAL 504 @@ -711,7 +711,7 @@ bool parseData(KexiDB::Parser *p, const char *data); #define TWO_DIGITS 570 #define UCASE 571 #define UNION 572 -#define UNIQUE 573 +#define UNITQUE 573 #define SQL_UNKNOWN 574 #define UPDATE 575 #define UPPER 576 @@ -719,7 +719,7 @@ bool parseData(KexiDB::Parser *p, const char *data); #define USER 578 #define IDENTIFIER 579 #define IDENTIFIER_DOT_ASTERISK 580 -#define QUERY_PARAMETER 581 +#define TQUERY_PARAMETER 581 #define USING 582 #define VALUE 583 #define VALUES 584 @@ -751,8 +751,8 @@ bool parseData(KexiDB::Parser *p, const char *data); typedef union YYSTYPE #line 511 "sqlparser.y" { - QString* stringValue; - Q_LLONG integerValue; + TQString* stringValue; + TQ_LLONG integerValue; bool booleanValue; struct realType realValue; KexiDB::Field::Type colType; @@ -763,7 +763,7 @@ typedef union YYSTYPE KexiDB::QuerySchema *querySchema; SelectOptionsInternal *selectOptions; OrderByColumnInternal::List *orderByColumns; - QVariant *variantValue; + TQVariant *variantValue; } /* Line 1528 of yacc.c. */ #line 763 "sqlparser.tab.h" diff --git a/kexi/kexidb/parser/sqlparser.y b/kexi/kexidb/parser/sqlparser.y index 5a8357f2..426dec48 100644 --- a/kexi/kexidb/parser/sqlparser.y +++ b/kexi/kexidb/parser/sqlparser.y @@ -1003,7 +1003,7 @@ aExpr9 '/' aExpr8 aExpr9 ; -/* parenthesis, unary operators, and terminals precedence */ +/* tqparenthesis, unary operators, and terminals precedence */ aExpr9: /* --- unary logical left --- */ '-' aExpr9 @@ -1201,7 +1201,7 @@ IDENTIFIER Field *f = item->table()->field(item->name()); if(!f) { - ParserError err(i18n("Field List Error"), i18n("Unknown column '%1' in table '%2'").arg(item->name()).arg(schema->name()), ctoken, current); + ParserError err(i18n("Field List Error"), i18n("Unknown column '%1' in table '%2'").tqarg(item->name()).tqarg(schema->name()), ctoken, current); parser->setError(err); yyerror("fieldlisterror"); } @@ -1360,7 +1360,7 @@ ColWildCard: { $$ = new VariableExpr($1); KexiDBDbg << " Invalid identifier! " << $1 << endl; - setError(i18n("Invalid identifier \"%1\"").arg($1)); + setError(i18n("Invalid identifier \"%1\"").tqarg($1)); }*/ ; diff --git a/kexi/kexidb/parser/sqlscanner.cpp b/kexi/kexidb/parser/sqlscanner.cpp index c3984a39..10fe70a2 100644 --- a/kexi/kexidb/parser/sqlscanner.cpp +++ b/kexi/kexidb/parser/sqlscanner.cpp @@ -512,8 +512,8 @@ char *yytext; #define YY_NO_UNPUT #define ECOUNT current += yyleng; ctoken = yytext -extern void setError(const QString& errDesc); -extern void setError(const QString& errName, const QString& errDesc); +extern void setError(const TQString& errDesc); +extern void setError(const TQString& errName, const TQString& errDesc); /* *** Please reflect changes to this file in ../driver_p.cpp *** */ #define YY_NEVER_INTERACTIVE 1 @@ -822,10 +822,10 @@ YY_RULE_SETUP #line 91 "sqlscanner.l" { //TODO: what about hex or octal values? - //we're using QString:toLongLong() here because atoll() is not so portable: + //we're using TQString:toLongLong() here because atoll() is not so portable: ECOUNT; bool ok; - yylval.integerValue = QString(yytext).toLongLong( &ok ); + yylval.integerValue = TQString(yytext).toLongLong( &ok ); if (!ok) { setError(i18n("Invalid integer number"),i18n("This integer number may be too large.")); return SCAN_ERROR; @@ -1097,7 +1097,7 @@ YY_RULE_SETUP #line 273 "sqlscanner.l" { ECOUNT; - yylval.stringValue = new QString(QString::fromUtf8(yytext+1, yyleng-2)); + yylval.stringValue = new TQString(TQString::fromUtf8(yytext+1, yyleng-2)); return CHARACTER_STRING_LITERAL; /* "ZZZ" sentinel for script */ @@ -1109,7 +1109,7 @@ YY_RULE_SETUP { KexiDBDbg << "yytext: '" << yytext << "' (" << yyleng << ")" << endl; ECOUNT; - yylval.stringValue = new QString(QString::fromUtf8(yytext, yyleng)); + yylval.stringValue = new TQString(TQString::fromUtf8(yytext, yyleng)); if (yytext[0]>='0' && yytext[0]<='9') { setError(i18n("Invalid identifier"), i18n("Identifiers should start with a letter or '_' character")); @@ -1124,8 +1124,8 @@ YY_RULE_SETUP { KexiDBDbg << "yytext: '" << yytext << "' (" << yyleng << ")" << endl; ECOUNT; - yylval.stringValue = new QString(QString::fromUtf8(yytext+1, yyleng-2)); - return QUERY_PARAMETER; + yylval.stringValue = new TQString(TQString::fromUtf8(yytext+1, yyleng-2)); + return TQUERY_PARAMETER; } YY_BREAK case 41: diff --git a/kexi/kexidb/parser/sqltypes.h b/kexi/kexidb/parser/sqltypes.h index c0879a3c..52d921e7 100644 --- a/kexi/kexidb/parser/sqltypes.h +++ b/kexi/kexidb/parser/sqltypes.h @@ -20,10 +20,10 @@ #ifndef SQLTYPES_H #define SQLTYPES_H -#include <qvariant.h> +#include <tqvariant.h> extern int current; -extern QString ctoken; +extern TQString ctoken; struct dateType { @@ -41,26 +41,26 @@ struct realType //! @internal struct OrderByColumnInternal { - typedef QValueList<OrderByColumnInternal> List; - typedef QValueListConstIterator<OrderByColumnInternal> ListConstIterator; + typedef TQValueList<OrderByColumnInternal> List; + typedef TQValueListConstIterator<OrderByColumnInternal> ListConstIterator; OrderByColumnInternal() : columnNumber(-1) , ascending(true) { } - void setColumnByNameOrNumber(const QVariant& nameOrNumber) { - if (nameOrNumber.type()==QVariant::String) { + void setColumnByNameOrNumber(const TQVariant& nameOrNumber) { + if (nameOrNumber.type()==TQVariant::String) { aliasOrName = nameOrNumber.toString(); columnNumber = -1; } else { columnNumber = nameOrNumber.toInt(); - aliasOrName = QString::null; + aliasOrName = TQString(); } } - QString aliasOrName; //!< Can include a "tablename." prefix + TQString aliasOrName; //!< Can include a "tablename." prefix int columnNumber; //!< Optional, used instead of aliasOrName to refer to column //!< by its number rather than name. bool ascending : 1; diff --git a/kexi/kexidb/preparedstatement.cpp b/kexi/kexidb/preparedstatement.cpp index 24947dff..ce96f630 100644 --- a/kexi/kexidb/preparedstatement.cpp +++ b/kexi/kexidb/preparedstatement.cpp @@ -26,11 +26,11 @@ using namespace KexiDB; PreparedStatement::PreparedStatement(StatementType type, ConnectionInternal& conn, - FieldList& fields, const QStringList& where) + FieldList& fields, const TQStringList& where) : KShared() , m_type(type) , m_fields(&fields) - , m_where(where.isEmpty() ? new QStringList(where) : 0) + , m_where(where.isEmpty() ? new TQStringList(where) : 0) , m_whereFields(0) { Q_UNUSED(conn); @@ -42,9 +42,9 @@ PreparedStatement::~PreparedStatement() delete m_whereFields; } -QCString PreparedStatement::generateStatementString() +TQCString PreparedStatement::generateStatementString() { - QCString s(1024); + TQCString s(1024); if (m_type == SelectStatement) { //! @todo only tables and trivial queries supported for select... s = "SELECT "; @@ -62,7 +62,7 @@ QCString PreparedStatement::generateStatementString() // for (uint i=0; i<m_fields->fieldCount(); i++) { m_whereFields = new Field::List(); - for (QStringList::ConstIterator it=m_where->constBegin(); it!=m_where->constEnd(); ++it) { + for (TQStringList::ConstIterator it=m_where->constBegin(); it!=m_where->constEnd(); ++it) { // for (Field::ListIterator it(m_fields->fieldsIterator()); it.current(); ++it) { if (first) first = false; @@ -86,7 +86,7 @@ QCString PreparedStatement::generateStatementString() if (!table) return ""; //err - QCString namesList; + TQCString namesList; bool first = true; const bool allTableFieldsUsed = dynamic_cast<TableSchema*>(m_fields); //we are using a selection of fields only Field::ListIterator it = m_fields->fieldsIterator(); @@ -99,18 +99,18 @@ QCString PreparedStatement::generateStatementString() } else { s.append( ",?" ); if (!allTableFieldsUsed) - namesList.append(QCString(", ")+it.current()->name().latin1()); + namesList.append(TQCString(", ")+it.current()->name().latin1()); } } s.append(")"); - s.prepend(QCString("INSERT INTO ") + table->name().latin1() - + (allTableFieldsUsed ? QCString() : (" (" + namesList + ")")) + s.prepend(TQCString("INSERT INTO ") + table->name().latin1() + + (allTableFieldsUsed ? TQCString() : (" (" + namesList + ")")) + " VALUES ("); } return s; } -PreparedStatement& PreparedStatement::operator<< ( const QVariant& value ) +PreparedStatement& PreparedStatement::operator<< ( const TQVariant& value ) { m_args.append(value); return *this; diff --git a/kexi/kexidb/preparedstatement.h b/kexi/kexidb/preparedstatement.h index 368140e5..463c3c44 100644 --- a/kexi/kexidb/preparedstatement.h +++ b/kexi/kexidb/preparedstatement.h @@ -20,7 +20,7 @@ #ifndef KEXIDB_PREPAREDSTATEMENT_H #define KEXIDB_PREPAREDSTATEMENT_H -#include <qvariant.h> +#include <tqvariant.h> #include <ksharedptr.h> #include "field.h" @@ -39,7 +39,7 @@ class FieldList; connection.insertRecord(*tabelSchema, dbRowBuffer). To use PreparedStatement, create is using KexiDB::Connection:prepareStatement(), - providing table schema; set up arguments using operator << ( const QVariant& value ); + providing table schema; set up arguments using operator << ( const TQVariant& value ); and call execute() when ready. PreparedStatement objects are accessed using KDE shared pointers, i.e KexiDB::PreparedStatement::Ptr, so you do not need to remember about destroying them. However, when underlying Connection object @@ -83,12 +83,12 @@ class KEXI_DB_EXPORT PreparedStatement : public KShared //! Creates Prepared statement. In your code use KexiDB::Connection:prepareStatement() instead. PreparedStatement(StatementType type, ConnectionInternal& conn, FieldList& fields, - const QStringList& where = QStringList()); + const TQStringList& where = TQStringList()); virtual ~PreparedStatement(); //! Appends argument \a value to the statement. - PreparedStatement& operator<< ( const QVariant& value ); + PreparedStatement& operator<< ( const TQVariant& value ); //! Clears arguments of the prepared statement. Usually used after execute() void clearArguments(); @@ -103,12 +103,12 @@ class KEXI_DB_EXPORT PreparedStatement : public KShared protected: //! @todo is this portable across backends? - QCString generateStatementString(); + TQCString generateStatementString(); StatementType m_type; FieldList *m_fields; - QValueList<QVariant> m_args; - QStringList* m_where; + TQValueList<TQVariant> m_args; + TQStringList* m_where; Field::List* m_whereFields; }; 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 += ", "; diff --git a/kexi/kexidb/queryschema.h b/kexi/kexidb/queryschema.h index 76dfa757..a68acffe 100644 --- a/kexi/kexidb/queryschema.h +++ b/kexi/kexidb/queryschema.h @@ -17,13 +17,13 @@ * Boston, MA 02110-1301, USA. */ -#ifndef KEXIDB_QUERY_H -#define KEXIDB_QUERY_H +#ifndef KEXIDB_TQUERY_H +#define KEXIDB_TQUERY_H -#include <qvaluevector.h> -#include <qstring.h> -#include <qmap.h> -#include <qptrlist.h> +#include <tqvaluevector.h> +#include <tqstring.h> +#include <tqmap.h> +#include <tqptrlist.h> #include "fieldlist.h" #include "schemadata.h" @@ -36,7 +36,7 @@ class Connection; class QueryAsterisk; class QuerySchemaPrivate; class QuerySchemaParameter; -typedef QValueList<QuerySchemaParameter> QuerySchemaParameterList; +typedef TQValueList<QuerySchemaParameter> QuerySchemaParameterList; //! @short Helper class that assigns additional information for the column in a query /*! The following information is assigned: @@ -48,25 +48,25 @@ typedef QValueList<QuerySchemaParameter> QuerySchemaParameterList; class KEXI_DB_EXPORT QueryColumnInfo { public: - typedef QPtrVector<QueryColumnInfo> Vector; - typedef QPtrList<QueryColumnInfo> List; - typedef QPtrListIterator<QueryColumnInfo> ListIterator; + typedef TQPtrVector<QueryColumnInfo> Vector; + typedef TQPtrList<QueryColumnInfo> List; + typedef TQPtrListIterator<QueryColumnInfo> ListIterator; - QueryColumnInfo(Field *f, const QCString& _alias, bool _visible, QueryColumnInfo *foreignColumn = 0); + QueryColumnInfo(Field *f, const TQCString& _alias, bool _visible, QueryColumnInfo *foreignColumn = 0); ~QueryColumnInfo(); //! \return alias if it is not empty, field's name otherwise. - inline QCString aliasOrName() const { + inline TQCString aliasOrName() const { return alias.isEmpty() ? field->name().latin1() : (const char*)alias; } //! \return field's caption if it is not empty, field's alias otherwise. //! If alias is also empty - returns field's name. - inline QString captionOrAliasOrName() const { - return field->caption().isEmpty() ? QString(aliasOrName()) : field->caption(); } + inline TQString captionOrAliasOrName() const { + return field->caption().isEmpty() ? TQString(aliasOrName()) : field->caption(); } Field *field; - QCString alias; + TQCString alias; /*! \return index of column with visible lookup value within the 'fields expanded' vector. -1 means no visible lookup value is available because there is no lookup for the column defined. @@ -81,7 +81,7 @@ class KEXI_DB_EXPORT QueryColumnInfo QueryColumnInfo *foreignColumn() const { return m_foreignColumn; } /*! \return string for debugging purposes. */ - QString debugString() const; + TQString debugString() const; //! true if this column is visible to the user (and its data is fetched by the engine) bool visible : 1; @@ -100,7 +100,7 @@ class KEXI_DB_EXPORT QueryColumnInfo class KEXI_DB_EXPORT OrderByColumn { public: - typedef QValueListConstIterator<OrderByColumn> ListConstIterator; + typedef TQValueListConstIterator<OrderByColumn> ListConstIterator; OrderByColumn(); OrderByColumn(QueryColumnInfo& column, bool ascending = true, int pos = -1); @@ -130,13 +130,13 @@ class KEXI_DB_EXPORT OrderByColumn && m_ascending==col.m_ascending; } /*! \return string for debugging purposes. */ - QString debugString() const; + TQString debugString() const; /*! \return a string like "name ASC" usable for building a SQL statement. If \a includeTableNames is true (the default) field is output in a form of "tablename.fieldname" (but only if fieldname is not a name of alias). \a drv and \a identifierEscaping are used for escaping the table and field identifiers. */ - QString toSQLString(bool includeTableName = true, + TQString toSQLString(bool includeTableName = true, Driver *drv = 0, int identifierEscaping = Driver::EscapeDriver|Driver::EscapeAsNecessary) const; protected: @@ -152,7 +152,7 @@ class KEXI_DB_EXPORT OrderByColumn }; //! A base for KexiDB::OrderByColumnList -typedef QValueList<OrderByColumn> OrderByColumnListBase; +typedef TQValueList<OrderByColumn> OrderByColumnListBase; //! @short KexiDB::OrderByColumnList provides list of sorted columns for a query schema class KEXI_DB_EXPORT OrderByColumnList : protected OrderByColumnListBase @@ -168,11 +168,11 @@ class KEXI_DB_EXPORT OrderByColumnList : protected OrderByColumnListBase \return false if there is at least one name for which a field or alias name does not exist (all the newly appended fields are removed in this case) */ bool appendFields(QuerySchema& querySchema, - const QString& field1, bool ascending1 = true, - const QString& field2 = QString::null, bool ascending2 = true, - const QString& field3 = QString::null, bool ascending3 = true, - const QString& field4 = QString::null, bool ascending4 = true, - const QString& field5 = QString::null, bool ascending5 = true); + const TQString& field1, bool ascending1 = true, + const TQString& field2 = TQString(), bool ascending2 = true, + const TQString& field3 = TQString(), bool ascending3 = true, + const TQString& field4 = TQString(), bool ascending4 = true, + const TQString& field5 = TQString(), bool ascending5 = true); /*! Appends column \a columnInfo. Ascending sorting is set is \a ascending is true. */ void appendColumn(QueryColumnInfo& columnInfo, bool ascending = true); @@ -185,7 +185,7 @@ class KEXI_DB_EXPORT OrderByColumnList : protected OrderByColumnListBase /*! Appends field with a name \a field. Ascending sorting is set is \a ascending is true. \return true on successful appending, and false if there is no such field or alias name in the \a querySchema. */ - bool appendField(QuerySchema& querySchema, const QString& fieldName, + bool appendField(QuerySchema& querySchema, const TQString& fieldName, bool ascending = true); /*! Appends a column that is at position \a pos (counted from 0). @@ -208,13 +208,13 @@ class KEXI_DB_EXPORT OrderByColumnList : protected OrderByColumnListBase const_iterator constEnd () const { return OrderByColumnListBase::constEnd(); } /*! \return string for debugging purposes. */ - QString debugString() const; + TQString debugString() const; /*! \return a string like "name ASC, 2 DESC" usable for building a SQL statement. If \a includeTableNames is true (the default) fields are output in a form of "tablename.fieldname". \a drv and \a identifierEscaping are used for escaping the table and field identifiers. */ - QString toSQLString(bool includeTableNames = true, + TQString toSQLString(bool includeTableNames = true, Driver *drv = 0, int identifierEscaping = Driver::EscapeDriver|Driver::EscapeAsNecessary) const; }; @@ -318,7 +318,7 @@ class KEXI_DB_EXPORT QuerySchema : public FieldList, public SchemaData virtual void clear(); /*! \return string for debugging purposes. */ - virtual QString debugString(); + virtual TQString debugString(); /*! If query was created using a connection, returns this connection object, otherwise NULL. */ @@ -352,19 +352,19 @@ class KEXI_DB_EXPORT QuerySchema : public FieldList, public SchemaData if \a alias is not empty, it will be assigned to this table using setTableAlias(position, alias) */ - void addTable(TableSchema *table, const QCString& alias = QCString()); + void addTable(TableSchema *table, const TQCString& alias = TQCString()); /*! Removes \a table schema from this query. This does not destroy \a table object but only takes it out of the list. If this table was master for the query, master table information is also - invalidated. */ + tqinvalidated. */ void removeTable(TableSchema *table); /*! \return table with name \a tableName or 0 if this query has no such table. */ - TableSchema* table(const QString& tableName) const; + TableSchema* table(const TQString& tableName) const; /*! \return true if the query uses \a table. */ - bool contains(TableSchema *table) const; + bool tqcontains(TableSchema *table) const; /*! Convenience function. \return table field by searching through all tables in this query. @@ -384,7 +384,7 @@ class KEXI_DB_EXPORT QuerySchema : public FieldList, public SchemaData @see KexiDB::splitToTableAndFieldParts() */ - Field* findTableField(const QString &tableOrTableAndFieldName) const; + Field* findTableField(const TQString &tableOrTableAndFieldName) const; /*! \return alias of a column at \a position or null string If there is no alias for this column @@ -392,7 +392,7 @@ class KEXI_DB_EXPORT QuerySchema : public FieldList, public SchemaData If the column is an expression and has no alias defined, a new unique alias will be generated automatically on this call. */ - QCString columnAlias(uint position) const; + TQCString columnAlias(uint position) const; /*! Provided for convenience. \return true if a column at \a position has non empty alias defined @@ -403,7 +403,7 @@ class KEXI_DB_EXPORT QuerySchema : public FieldList, public SchemaData /*! Sets \a alias for a column at \a position, within the query. Passing empty string to \a alias clears alias for a given column. */ - void setColumnAlias(uint position, const QCString& alias); + void setColumnAlias(uint position, const TQCString& alias); /*! \return a table position (within FROM section), that is bound to column at \a columnPosition (within SELECT section). @@ -431,7 +431,7 @@ class KEXI_DB_EXPORT QuerySchema : public FieldList, public SchemaData /*! \return alias of a table at \a position (within FROM section) or null string if there is no alias for this table or if there is no such table within the query defined. */ - QCString tableAlias(uint position) const; + TQCString tableAlias(uint position) const; /*! \return table position (within FROM section) that has attached alias \a name. @@ -444,13 +444,13 @@ class KEXI_DB_EXPORT QuerySchema : public FieldList, public SchemaData e.g. "SELECT 1 from table1 t, table2 t" is ok but "SELECT t.id from table1 t, table2 t" is not. */ - int tablePositionForAlias(const QCString& name) const; + int tablePositionForAlias(const TQCString& name) const; /*! \return table position (within FROM section) for \a tableName. -1 is returend if there's no such table declared in the FROM section. \sa tablePositions() */ - int tablePosition(const QString& tableName) const; + int tablePosition(const TQString& tableName) const; /*! \return a list of all \a tableName table occurrences (within FROM section). E.g. for "SELECT * FROM table t, table t2" [0, 1] list is returned. @@ -458,7 +458,7 @@ class KEXI_DB_EXPORT QuerySchema : public FieldList, public SchemaData in the FROM section at all. \sa tablePosition() */ - QValueList<int> tablePositions(const QString& tableName) const; + TQValueList<int> tablePositions(const TQString& tableName) const; /*! Provided for convenience. \return true if a table at \a position (within FROM section of the the query) @@ -469,13 +469,13 @@ class KEXI_DB_EXPORT QuerySchema : public FieldList, public SchemaData /*! \return column position that has defined alias \a name. If there is no such alias, -1 is returned. */ - int columnPositionForAlias(const QCString& name) const; + int columnPositionForAlias(const TQCString& name) const; /*! Sets \a alias for a table at \a position (within FROM section of the the query). Passing empty sting to \a alias clears alias for a given table (only for specified \a position). */ - void setTableAlias(uint position, const QCString& alias); + void setTableAlias(uint position, const TQCString& alias); /*! \return a list of relationships defined for this query */ Relationship::List* relationships() const; @@ -516,12 +516,12 @@ class KEXI_DB_EXPORT QuerySchema : public FieldList, public SchemaData will return the same pointer. - Calling field("T.A") will return the same pointer as field("A"). */ - virtual Field* field(const QString& name, bool expanded = true); + virtual Field* field(const TQString& name, bool expanded = true); /*! \return field id or NULL if there is no such a field. */ inline Field* field(uint id) { return FieldList::field(id); } - /*! Like QuerySchema::field(const QString& name) but returns not only Field + /*! Like QuerySchema::field(const TQString& name) but returns not only Field object for \a identifier but entire QueryColumnInfo object. \a identifier can be: - a fieldname @@ -533,7 +533,7 @@ class KEXI_DB_EXPORT QuerySchema : public FieldList, public SchemaData calling columnInfo("name") for "SELECT t1.name, t2.name FROM t1, t2" statement will only return the column related to t1.name and not t2.name, so you'll need to explicitly specify "t2.name" as the identifier to get the second column. */ - QueryColumnInfo* columnInfo(const QString& identifier, bool expanded = true); + QueryColumnInfo* columnInfo(const TQString& identifier, bool expanded = true); /*! Options used in fieldsExpanded(). */ enum FieldsExpandedOptions { @@ -632,7 +632,7 @@ class KEXI_DB_EXPORT QuerySchema : public FieldList, public SchemaData - columnsOrder(UnexpandedListWithoutAsterisks) will return the following map: QueryColumnInfo(id)->0, */ - QMap<QueryColumnInfo*,int> columnsOrder(ColumnsOrderOptions options = ExpandedList); + TQMap<QueryColumnInfo*,int> columnsOrder(ColumnsOrderOptions options = ExpandedList); /*! \return table describing order of primary key (PKEY) fields within the query. Indexing is performed against vector returned by fieldsExpanded(). @@ -656,7 +656,7 @@ class KEXI_DB_EXPORT QuerySchema : public FieldList, public SchemaData @see example for pkeyFieldsCount(). @todo js: UPDATE CACHE! */ - QValueVector<int> pkeyFieldsOrder(); + TQValueVector<int> pkeyFieldsOrder(); /*! \return number of master table's primary key fields included in this query. This method is useful to quickly check whether the vector returned by pkeyFieldsOrder() @@ -685,26 +685,26 @@ class KEXI_DB_EXPORT QuerySchema : public FieldList, public SchemaData QueryColumnInfo::List* autoIncrementFields(); /*! \return a preset statement (if any). */ - QString statement() const; + TQString statement() const; /*! Forces a query statement (i.e. no statement is composed from QuerySchema's content) */ - void setStatement(const QString &s); + void setStatement(const TQString &s); /*! \return a string that is a result of concatenating all column names for \a infolist, with "," between each one. This is usable e.g. as argument like "field1,field2" for "INSERT INTO (xxx) ..". The result of this method is effectively cached, - and it is invalidated when set of fields changes (e.g. using clear() + and it is tqinvalidated when set of fields changes (e.g. using clear() or addField()). This method is similar to FieldList::sqlFieldsList() it just uses QueryColumnInfo::List instead of Field::List. */ - static QString sqlColumnsList(QueryColumnInfo::List* infolist, Driver *driver); + static TQString sqlColumnsList(QueryColumnInfo::List* infolist, Driver *driver); /*! \return cached sql list created using sqlColumnsList() on a list returned by autoIncrementFields(). */ - QString autoIncrementSQLFieldsList(Driver *driver); + TQString autoIncrementSQLFieldsList(Driver *driver); /*! Sets a WHERE expression \a exp. It will be owned by this query, so you can forget about it. Previously set WHERE expression will be deleted. @@ -717,7 +717,7 @@ class KEXI_DB_EXPORT QuerySchema : public FieldList, public SchemaData /*! Adds a part to WHERE expression. Simplifies creating of WHERE expression, if used instead of setWhereExpression(BaseExpr *expr). */ - void addToWhereExpression(KexiDB::Field *field, const QVariant& value, int relation = '='); + void addToWhereExpression(KexiDB::Field *field, const TQVariant& value, int relation = '='); /*! Sets a list of columns for ORDER BY section of the query. Each name on the list must be a field or alias present within the query @@ -815,7 +815,7 @@ class KEXI_DB_EXPORT QueryAsterisk : public Field bool isAllTableAsterisk() const { return m_table==NULL; } /*! \return String for debugging purposes. */ - virtual QString debugString() const; + virtual TQString debugString() const; protected: //! \return a deep copy of this object. Used in FieldList(const FieldList& fl). diff --git a/kexi/kexidb/queryschemaparameter.cpp b/kexi/kexidb/queryschemaparameter.cpp index 3703de24..4cead962 100644 --- a/kexi/kexidb/queryschemaparameter.cpp +++ b/kexi/kexidb/queryschemaparameter.cpp @@ -21,7 +21,7 @@ #include "driver.h" #include <kdebug.h> -#include <qguardedptr.h> +#include <tqguardedptr.h> using namespace KexiDB; @@ -34,14 +34,14 @@ QuerySchemaParameter::~QuerySchemaParameter() { } -QString QuerySchemaParameter::debugString() const +TQString QuerySchemaParameter::debugString() const { - return QString("msg=\"%1\" type=\"%2\"").arg(Field::typeName(type)).arg(message); + return TQString("msg=\"%1\" type=\"%2\"").tqarg(Field::typeName(type)).tqarg(message); } void KexiDB::debug(const QuerySchemaParameterList& list) { - KexiDBDbg << QString("Query parameters (%1):").arg(list.count()) << endl; + KexiDBDbg << TQString("Query parameters (%1):").tqarg(list.count()) << endl; foreach(QuerySchemaParameterListConstIterator, it, list) KexiDBDbg << " - " << (*it).debugString() << endl; } @@ -51,7 +51,7 @@ void KexiDB::debug(const QuerySchemaParameterList& list) class QuerySchemaParameterValueListIterator::Private { public: - Private(const Driver& aDriver, const QValueList<QVariant>& aParams) + Private(const Driver& aDriver, const TQValueList<TQVariant>& aParams) : driver(&aDriver) , params(aParams) { @@ -59,14 +59,14 @@ class QuerySchemaParameterValueListIterator::Private paramsIt = params.fromLast(); //constBegin(); paramsItPosition = params.count(); } - QGuardedPtr<const Driver> driver; - const QValueList<QVariant> params; - QValueList<QVariant>::ConstIterator paramsIt; + TQGuardedPtr<const Driver> driver; + const TQValueList<TQVariant> params; + TQValueList<TQVariant>::ConstIterator paramsIt; uint paramsItPosition; }; QuerySchemaParameterValueListIterator::QuerySchemaParameterValueListIterator( - const Driver& driver, const QValueList<QVariant>& params) + const Driver& driver, const TQValueList<TQVariant>& params) : d( new Private(driver, params) ) { } @@ -76,26 +76,26 @@ QuerySchemaParameterValueListIterator::~QuerySchemaParameterValueListIterator() delete d; } -QVariant QuerySchemaParameterValueListIterator::getPreviousValue() +TQVariant QuerySchemaParameterValueListIterator::getPreviousValue() { if (d->paramsItPosition == 0) { //d->params.constEnd()) { KexiDBWarn << "QuerySchemaParameterValues::getPreviousValue() no prev value" << endl; - return QVariant(); + return TQVariant(); } - QVariant res( *d->paramsIt ); + TQVariant res( *d->paramsIt ); --d->paramsItPosition; --d->paramsIt; // ++d->paramsIt; return res; } -QString QuerySchemaParameterValueListIterator::getPreviousValueAsString(Field::Type type) +TQString QuerySchemaParameterValueListIterator::getPreviousValueAsString(Field::Type type) { if (d->paramsItPosition == 0) { //d->params.constEnd()) { KexiDBWarn << "QuerySchemaParameterValues::getPreviousValueAsString() no prev value" << endl; - return d->driver->valueToSQL(type, QVariant()); //"NULL" + return d->driver->valueToSQL(type, TQVariant()); //"NULL" } - QString res( d->driver->valueToSQL(type, *d->paramsIt) ); + TQString res( d->driver->valueToSQL(type, *d->paramsIt) ); --d->paramsItPosition; --d->paramsIt; // ++d->paramsIt; diff --git a/kexi/kexidb/queryschemaparameter.h b/kexi/kexidb/queryschemaparameter.h index e7c00880..96168719 100644 --- a/kexi/kexidb/queryschemaparameter.h +++ b/kexi/kexidb/queryschemaparameter.h @@ -17,8 +17,8 @@ * Boston, MA 02110-1301, USA. */ -#ifndef KEXIDB_QUERYSCHEMAPARAMETER_H -#define KEXIDB_QUERYSCHEMAPARAMETER_H +#ifndef KEXIDB_TQUERYSCHEMAPARAMETER_H +#define KEXIDB_TQUERYSCHEMAPARAMETER_H #include "queryschema.h" @@ -32,33 +32,33 @@ class KEXI_DB_EXPORT QuerySchemaParameter QuerySchemaParameter(); ~QuerySchemaParameter(); - QString debugString() const; + TQString debugString() const; Field::Type type; //!< A datatype of the parameter - QString message; //!< A user-visible message that will be displayed to ask for value of the parameter + TQString message; //!< A user-visible message that will be displayed to ask for value of the parameter }; -typedef QValueList<QuerySchemaParameter> QuerySchemaParameterList; -typedef QValueList<QuerySchemaParameter>::Iterator QuerySchemaParameterListIterator; -typedef QValueList<QuerySchemaParameter>::ConstIterator QuerySchemaParameterListConstIterator; +typedef TQValueList<QuerySchemaParameter> QuerySchemaParameterList; +typedef TQValueList<QuerySchemaParameter>::Iterator QuerySchemaParameterListIterator; +typedef TQValueList<QuerySchemaParameter>::ConstIterator QuerySchemaParameterListConstIterator; //! Shows debug information for \a list KEXI_DB_EXPORT void debug(const QuerySchemaParameterList& list); //! @short An iteratof for a list of values of query schema parameters providing -//! Allows to iterate over parameters and return QVariant value or well-formatted string. +//! Allows to iterate over parameters and return TQVariant value or well-formatted string. //! The iterator is initially set to the last item because of the parser requirements class KEXI_DB_EXPORT QuerySchemaParameterValueListIterator { public: - QuerySchemaParameterValueListIterator(const Driver& driver, const QValueList<QVariant>& params); + QuerySchemaParameterValueListIterator(const Driver& driver, const TQValueList<TQVariant>& params); ~QuerySchemaParameterValueListIterator(); //! \return previous value - QVariant getPreviousValue(); + TQVariant getPreviousValue(); //! \return previous value as string formatted using driver's escaping - QString getPreviousValueAsString(Field::Type type); + TQString getPreviousValueAsString(Field::Type type); protected: class Private; Private * const d; diff --git a/kexi/kexidb/record.h b/kexi/kexidb/record.h index 29f3d670..b2b0906b 100644 --- a/kexi/kexidb/record.h +++ b/kexi/kexidb/record.h @@ -20,8 +20,8 @@ #ifndef KEXIDB_RECORD_H #define KEXIDB_RECORD_H -#include <qvaluelist.h> -#include <qstring.h> +#include <tqvaluelist.h> +#include <tqstring.h> #include <kexidb/field.h> @@ -32,37 +32,37 @@ namespace KexiDB { class KEXI_DB_EXPORT Record { public: - Record(const QString & name); + Record(const TQString & name); //TODO............. Table(); ~Table(); - const QString& name() const; - void setName(const QString& name); + const TQString& name() const; + void setName(const TQString& name); unsigned int fieldCount() const; KexiDB::Field field(unsigned int id) const; - QStringList primaryKeys() const; + TQStringList primaryKeys() const; bool hasPrimaryKeys() const; //js void addField(KexiDB::Field field); -//js void addPrimaryKey(const QString& key); +//js void addPrimaryKey(const TQString& key); private: -//js QStringList m_primaryKeys; - QValueList<Field> m_fields; - QString m_name; +//js TQStringList m_primaryKeys; + TQValueList<Field> m_fields; + TQString m_name; Connection* m_conn; }; /* -class KexiDBTableFields: public QValueList<KexiDBField> { +class KexiDBTableFields: public TQValueList<KexiDBField> { public: - KexiDBTable(const QString & name); + KexiDBTable(const TQString & name); ~KexiDBTable(); void addField(KexiDBField); -// const QString& tableName() const; +// const TQString& tableName() const; private: -// QString m_tableName; +// TQString m_tableName; }; */ diff --git a/kexi/kexidb/relationship.cpp b/kexi/kexidb/relationship.cpp index a7796207..bcb6ec89 100644 --- a/kexi/kexidb/relationship.cpp +++ b/kexi/kexidb/relationship.cpp @@ -80,7 +80,7 @@ void Relationship::createIndices( QuerySchema *query, Field *field1, Field *fiel return; } // if (!query->hasField(field1) && !query->hasField(field2)) { - if (!query->contains(field1->table()) || !query->contains(field2->table())) { + if (!query->tqcontains(field1->table()) || !query->tqcontains(field2->table())) { KexiDBWarn << "Relationship::addRelationship(): fields do not belong to this query" << endl; return; } diff --git a/kexi/kexidb/relationship.h b/kexi/kexidb/relationship.h index b72c7209..827835e1 100644 --- a/kexi/kexidb/relationship.h +++ b/kexi/kexidb/relationship.h @@ -77,8 +77,8 @@ class QuerySchema; class KEXI_DB_EXPORT Relationship { public: - typedef QPtrList<Relationship> List; - typedef QPtrListIterator<Relationship> ListIterator; + typedef TQPtrList<Relationship> List; + typedef TQPtrListIterator<Relationship> ListIterator; /*! Creates uninitialized Relationship object. setIndices() will be required to call. diff --git a/kexi/kexidb/roweditbuffer.cpp b/kexi/kexidb/roweditbuffer.cpp index 7b5b5711..ba1bb7d5 100644 --- a/kexi/kexidb/roweditbuffer.cpp +++ b/kexi/kexidb/roweditbuffer.cpp @@ -30,8 +30,8 @@ RowEditBuffer::RowEditBuffer(bool dbAwareBuffer) , m_simpleBufferIt(dbAwareBuffer ? 0 : new SimpleMap::ConstIterator()) , m_dbBuffer(dbAwareBuffer ? new DBMap() : 0) , m_dbBufferIt(dbAwareBuffer ? new DBMap::Iterator() : 0) -, m_defaultValuesDbBuffer(dbAwareBuffer ? new QMap<QueryColumnInfo*,bool>() : 0) -, m_defaultValuesDbBufferIt(dbAwareBuffer ? new QMap<QueryColumnInfo*,bool>::ConstIterator() : 0) +, m_defaultValuesDbBuffer(dbAwareBuffer ? new TQMap<QueryColumnInfo*,bool>() : 0) +, m_defaultValuesDbBufferIt(dbAwareBuffer ? new TQMap<QueryColumnInfo*,bool>::ConstIterator() : 0) { } @@ -44,14 +44,14 @@ RowEditBuffer::~RowEditBuffer() delete m_dbBufferIt; } -const QVariant* RowEditBuffer::at( QueryColumnInfo& ci, bool useDefaultValueIfPossible ) const +const TQVariant* RowEditBuffer::at( QueryColumnInfo& ci, bool useDefaultValueIfPossible ) const { if (!m_dbBuffer) { KexiDBWarn << "RowEditBuffer::at(QueryColumnInfo&): not db-aware buffer!" << endl; return 0; } - *m_dbBufferIt = m_dbBuffer->find( &ci ); - QVariant* result = 0; + *m_dbBufferIt = m_dbBuffer->tqfind( &ci ); + TQVariant* result = 0; if (*m_dbBufferIt!=m_dbBuffer->end()) result = &(*m_dbBufferIt).data(); if ( useDefaultValueIfPossible @@ -65,28 +65,28 @@ const QVariant* RowEditBuffer::at( QueryColumnInfo& ci, bool useDefaultValueIfPo result = &(*m_dbBuffer)[ &ci ]; m_defaultValuesDbBuffer->insert(&ci, true); } - return (const QVariant*)result; + return (const TQVariant*)result; } -const QVariant* RowEditBuffer::at( Field& f ) const +const TQVariant* RowEditBuffer::at( Field& f ) const { if (!m_simpleBuffer) { KexiDBWarn << "RowEditBuffer::at(Field&): this is db-aware buffer!" << endl; return 0; } - *m_simpleBufferIt = m_simpleBuffer->find( f.name() ); + *m_simpleBufferIt = m_simpleBuffer->tqfind( f.name() ); if (*m_simpleBufferIt==m_simpleBuffer->constEnd()) return 0; return &(*m_simpleBufferIt).data(); } -const QVariant* RowEditBuffer::at( const QString& fname ) const +const TQVariant* RowEditBuffer::at( const TQString& fname ) const { if (!m_simpleBuffer) { KexiDBWarn << "RowEditBuffer::at(Field&): this is db-aware buffer!" << endl; return 0; } - *m_simpleBufferIt = m_simpleBuffer->find( fname ); + *m_simpleBufferIt = m_simpleBuffer->tqfind( fname ); if (*m_simpleBufferIt==m_simpleBuffer->constEnd()) return 0; return &(*m_simpleBufferIt).data(); @@ -116,7 +116,7 @@ void RowEditBuffer::debug() KexiDBDbg << "RowEditBuffer type=DB-AWARE, " << m_dbBuffer->count() <<" items"<< endl; for (DBMap::ConstIterator it = m_dbBuffer->constBegin(); it!=m_dbBuffer->constEnd(); ++it) { KexiDBDbg << "* field name=" <<it.key()->field->name()<<" val=" - << (it.data().isNull() ? QString("<NULL>") : it.data().toString()) + << (it.data().isNull() ? TQString("<NULL>") : it.data().toString()) << (hasDefaultValueAt(*it.key()) ? " DEFAULT" : "") <<endl; } return; @@ -124,6 +124,6 @@ void RowEditBuffer::debug() KexiDBDbg << "RowEditBuffer type=SIMPLE, " << m_simpleBuffer->count() <<" items"<< endl; for (SimpleMap::ConstIterator it = m_simpleBuffer->constBegin(); it!=m_simpleBuffer->constEnd(); ++it) { KexiDBDbg << "* field name=" <<it.key()<<" val=" - << (it.data().isNull() ? QString("<NULL>") : it.data().toString()) <<endl; + << (it.data().isNull() ? TQString("<NULL>") : it.data().toString()) <<endl; } } diff --git a/kexi/kexidb/roweditbuffer.h b/kexi/kexidb/roweditbuffer.h index edf48206..438e525e 100644 --- a/kexi/kexidb/roweditbuffer.h +++ b/kexi/kexidb/roweditbuffer.h @@ -20,7 +20,7 @@ #ifndef KEXIDB_ROWEDITBUFFER_H #define KEXIDB_ROWEDITBUFFER_H -#include <qmap.h> +#include <tqmap.h> #include <kexidb/field.h> #include <kexidb/queryschema.h> @@ -64,17 +64,17 @@ namespace KexiDB { // KexiDB::Connection::updateRow(), KexiDB::Connection::insertRow() </code> - You can use QMap::clear() to clear buffer contents, - QMap::isEmpty() to see if buffer is empty. - For more, see QMap documentation. + You can use TQMap::clear() to clear buffer contents, + TQMap::isEmpty() to see if buffer is empty. + For more, see TQMap documentation. Notes: added fields should come from the same (common) QuerySchema object. - However, this isn't checked at QValue& EditBuffer::operator[]( const Field& f ) level. + However, this isn't checked at TQValue& EditBuffer::operator[]( const Field& f ) level. */ class KEXI_DB_EXPORT RowEditBuffer { public: - typedef QMap<QString,QVariant> SimpleMap; - typedef QMap<QueryColumnInfo*,QVariant> DBMap; + typedef TQMap<TQString,TQVariant> SimpleMap; + typedef TQMap<QueryColumnInfo*,TQVariant> DBMap; RowEditBuffer(bool dbAwareBuffer); ~RowEditBuffer(); @@ -86,7 +86,7 @@ public: bool isEmpty() const; //! Inserts value \a val for db-aware buffer's column \a ci - inline void insert( QueryColumnInfo& ci, QVariant &val ) { + inline void insert( QueryColumnInfo& ci, TQVariant &val ) { if (m_dbBuffer) { m_dbBuffer->insert(&ci, val); m_defaultValuesDbBuffer->remove(&ci); @@ -94,7 +94,7 @@ public: } //! Inserts value \a val for not-db-aware buffer's column \a fname - inline void insert( const QString& fname, QVariant &val ) + inline void insert( const TQString& fname, TQVariant &val ) { if (m_simpleBuffer) m_simpleBuffer->insert(fname,val); } /*! Useful only for db-aware buffer. \return value for column \a ci @@ -102,18 +102,18 @@ public: default value obtained from \a ci if \a useDefaultValueIfPossible is true. Note that if the column is declared as unique (especially: primary key), default value will not be used. */ - const QVariant* at( QueryColumnInfo& ci, bool useDefaultValueIfPossible = true ) const; + const TQVariant* at( QueryColumnInfo& ci, bool useDefaultValueIfPossible = true ) const; //! Useful only for not-db-aware buffer. \return value for field \a f - const QVariant* at( Field& f ) const; + const TQVariant* at( Field& f ) const; //! Useful only for not-db-aware buffer. \return value for field \a fname - const QVariant* at( const QString& fname ) const; + const TQVariant* at( const TQString& fname ) const; //! Useful only for db-aware buffer: \return true if the value available as //! at( ci ) is obtained from column's default value inline bool hasDefaultValueAt( QueryColumnInfo& ci ) const { - return m_defaultValuesDbBuffer->contains(&ci) && (*m_defaultValuesDbBuffer)[ &ci ]; + return m_defaultValuesDbBuffer->tqcontains(&ci) && (*m_defaultValuesDbBuffer)[ &ci ]; } inline const SimpleMap simpleBuffer() { return *m_simpleBuffer; } @@ -127,8 +127,8 @@ protected: SimpleMap::ConstIterator *m_simpleBufferIt; DBMap *m_dbBuffer; DBMap::Iterator *m_dbBufferIt; - QMap<QueryColumnInfo*,bool> *m_defaultValuesDbBuffer; - QMap<QueryColumnInfo*,bool>::ConstIterator *m_defaultValuesDbBufferIt; + TQMap<QueryColumnInfo*,bool> *m_defaultValuesDbBuffer; + TQMap<QueryColumnInfo*,bool>::ConstIterator *m_defaultValuesDbBufferIt; }; } //namespace KexiDB diff --git a/kexi/kexidb/schemadata.cpp b/kexi/kexidb/schemadata.cpp index 0a0c2124..9b691349 100644 --- a/kexi/kexidb/schemadata.cpp +++ b/kexi/kexidb/schemadata.cpp @@ -38,18 +38,18 @@ SchemaData::~SchemaData() void SchemaData::clear() { m_id = -1; - m_name = QString::null; - m_caption = QString::null; - m_desc = QString::null; + m_name = TQString(); + m_caption = TQString(); + m_desc = TQString(); } -QString SchemaData::schemaDataDebugString() const +TQString SchemaData::schemaDataDebugString() const { - QString desc = m_desc; + TQString desc = m_desc; if (desc.length()>40) { desc.truncate(40); desc+="..."; } - return QString("id=%1 name='%2' caption='%3' desc='%4'") - .arg(m_id).arg(m_name).arg(m_caption).arg(desc); + return TQString("id=%1 name='%2' caption='%3' desc='%4'") + .tqarg(m_id).tqarg(m_name).tqarg(m_caption).tqarg(desc); } diff --git a/kexi/kexidb/schemadata.h b/kexi/kexidb/schemadata.h index 615f8602..ec9a27df 100644 --- a/kexi/kexidb/schemadata.h +++ b/kexi/kexidb/schemadata.h @@ -20,8 +20,8 @@ #ifndef KEXIDB_SCHEMADATA_H #define KEXIDB_SCHEMADATA_H -#include <qvaluelist.h> -#include <qstring.h> +#include <tqvaluelist.h> +#include <tqstring.h> #include <kexidb/global.h> #include <kexidb/field.h> @@ -41,17 +41,17 @@ class KEXI_DB_EXPORT SchemaData int type() const { return m_type; } int id() const { return m_id; } - QString name() const { return m_name; } - /*! The same as name(). Added to avoid conflict with QObject::name() */ - QString objectName() const { return m_name; } - void setName(const QString& n) { m_name=n; } - QString caption() const { return m_caption; } - void setCaption(const QString& c) { m_caption=c; } - QString description() const { return m_desc; } - void setDescription(const QString& desc) { m_desc=desc; } + TQString name() const { return m_name; } + /*! The same as name(). Added to avoid conflict with TQObject::name() */ + TQString objectName() const { return m_name; } + void setName(const TQString& n) { m_name=n; } + TQString caption() const { return m_caption; } + void setCaption(const TQString& c) { m_caption=c; } + TQString description() const { return m_desc; } + void setDescription(const TQString& desc) { m_desc=desc; } /*! \return debug string useful for debugging */ - virtual QString schemaDataDebugString() const; + virtual TQString schemaDataDebugString() const; /*! \return true if this is schema of native database object, like, for example like, native table. This flag @@ -79,9 +79,9 @@ class KEXI_DB_EXPORT SchemaData int m_type; int m_id; - QString m_name; - QString m_caption; - QString m_desc; + TQString m_name; + TQString m_caption; + TQString m_desc; bool m_native : 1; friend class Connection; diff --git a/kexi/kexidb/simplecommandlineapp.cpp b/kexi/kexidb/simplecommandlineapp.cpp index ec73cde2..904469bc 100644 --- a/kexi/kexidb/simplecommandlineapp.cpp +++ b/kexi/kexidb/simplecommandlineapp.cpp @@ -19,7 +19,7 @@ #include "simplecommandlineapp.h" -#include <qfileinfo.h> +#include <tqfileinfo.h> #include <kcmdlineargs.h> #include <kdebug.h> @@ -74,7 +74,7 @@ public: KCmdLineOptions *allOptions; KInstance* instance; ConnectionData connData; - QGuardedPtr<Connection> conn; + TQGuardedPtr<Connection> conn; }; //----------------------------------------- @@ -88,8 +88,8 @@ SimpleCommandLineApp::SimpleCommandLineApp( : Object() , d( new Private() ) { - QFileInfo fi(argv[0]); - QCString appName( fi.baseName().latin1() ); + TQFileInfo fi(argv[0]); + TQCString appName( fi.baseName().latin1() ); KCmdLineArgs::init(argc, argv, new KAboutData( appName, programName, version, shortDescription, licenseType, copyrightStatement, text, @@ -135,14 +135,14 @@ SimpleCommandLineApp::SimpleCommandLineApp( d->connData.useLocalSocketFile = args->isSet("local-socket"); if (args->isSet("password")) { - QString userAtHost = d->connData.userName; + TQString userAtHost = d->connData.userName; if (!d->connData.userName.isEmpty()) userAtHost += "@"; userAtHost += (d->connData.hostName.isEmpty() ? "localhost" : d->connData.hostName); - QTextStream cout(stdout,IO_WriteOnly); - cout << i18n("Enter password for %1: ").arg(userAtHost); + TQTextStream cout(stdout,IO_WriteOnly); + cout << i18n("Enter password for %1: ").tqarg(userAtHost); //! @todo make use of pty/tty here! (and care about portability) - QTextStream cin(stdin,IO_ReadOnly); + TQTextStream cin(stdin,IO_ReadOnly); cin >> d->connData.password; KexiDBDbg << d->connData.password << endl; } @@ -154,7 +154,7 @@ SimpleCommandLineApp::~SimpleCommandLineApp() delete d; } -bool SimpleCommandLineApp::openDatabase(const QString& databaseName) +bool SimpleCommandLineApp::openDatabase(const TQString& databaseName) { if (!d->conn) { if (d->manager.error()) { diff --git a/kexi/kexidb/simplecommandlineapp.h b/kexi/kexidb/simplecommandlineapp.h index 13d1f115..c14a35ea 100644 --- a/kexi/kexidb/simplecommandlineapp.h +++ b/kexi/kexidb/simplecommandlineapp.h @@ -63,7 +63,7 @@ namespace KexiDB In details: the database driver is loaded, the connection is opened and the database is used. Use KexiDB::Object methods to get status of the operation on failure. */ - bool openDatabase(const QString& databaseName); + bool openDatabase(const TQString& databaseName); /*! Closes database connection previously opened using openDatabase() \return true on success. This method is called on destruction. diff --git a/kexi/kexidb/tableschema.cpp b/kexi/kexidb/tableschema.cpp index 8c0f5e07..b794f273 100644 --- a/kexi/kexidb/tableschema.cpp +++ b/kexi/kexidb/tableschema.cpp @@ -43,7 +43,7 @@ public: void clearLookupFields() { - for (QMap<const Field*, LookupFieldSchema*>::ConstIterator it = lookupFields.constBegin(); + for (TQMap<const Field*, LookupFieldSchema*>::ConstIterator it = lookupFields.constBegin(); it!=lookupFields.constEnd(); ++it) { delete it.data(); @@ -52,8 +52,8 @@ public: } Field *anyNonPKField; - QMap<const Field*, LookupFieldSchema*> lookupFields; - QPtrVector<LookupFieldSchema> lookupFieldsList; + TQMap<const Field*, LookupFieldSchema*> lookupFields; + TQPtrVector<LookupFieldSchema> lookupFieldsList; }; } //------------------------------------- @@ -61,7 +61,7 @@ public: using namespace KexiDB; -TableSchema::TableSchema(const QString& name) +TableSchema::TableSchema(const TQString& name) : FieldList(true) , SchemaData(KexiDB::TableObjectType) , m_query(0) @@ -105,7 +105,7 @@ TableSchema::TableSchema(const TableSchema& ts, int setId) } // used by Connection -TableSchema::TableSchema(Connection *conn, const QString & name) +TableSchema::TableSchema(Connection *conn, const TQString & name) : FieldList(true) , SchemaData(KexiDB::TableObjectType) , m_conn( conn ) @@ -278,12 +278,12 @@ void TableSchema::clear() } /* -void TableSchema::addPrimaryKey(const QString& key) +void TableSchema::addPrimaryKey(const TQString& key) { m_primaryKeys.append(key); }*/ -/*QStringList TableSchema::primaryKeys() const +/*TQStringList TableSchema::primaryKeys() const { return m_primaryKeys; } @@ -294,12 +294,12 @@ bool TableSchema::hasPrimaryKeys() const } */ -//const QString& TableSchema::name() const +//const TQString& TableSchema::name() const //{ // return m_name; //} -//void TableSchema::setName(const QString& name) +//void TableSchema::setName(const TQString& name) //{ // m_name=name; /* ListIterator it( m_fields ); @@ -323,23 +323,23 @@ unsigned int TableSchema::fieldCount() const return m_fields.count(); }*/ -QString TableSchema::debugString() +TQString TableSchema::debugString() { return debugString(true); } -QString TableSchema::debugString(bool includeTableName) +TQString TableSchema::debugString(bool includeTableName) { - QString s; + TQString s; if (includeTableName) - s = QString("TABLE ") + schemaDataDebugString() + "\n"; + s = TQString("TABLE ") + schemaDataDebugString() + "\n"; s.append( FieldList::debugString() ); Field *f; for (Field::ListIterator it(m_fields); (f = it.current()); ++it) { LookupFieldSchema *lookupSchema = lookupFieldSchema( *f ); if (lookupSchema) - s.append( QString("\n") + lookupSchema->debugString() ); + s.append( TQString("\n") + lookupSchema->debugString() ); } return s; } @@ -374,7 +374,7 @@ Field* TableSchema::anyNonPKField() if (!d->anyNonPKField) { Field *f; Field::ListIterator it(m_fields); - it.toLast(); //from the end (higher chances to find) + it.toLast(); //from the end (higher chances to tqfind) for (; (f = it.current()); --it) { if (!f->isPrimaryKey() && (!m_pkey || !m_pkey->hasField(f))) break; @@ -384,7 +384,7 @@ Field* TableSchema::anyNonPKField() return d->anyNonPKField; } -bool TableSchema::setLookupFieldSchema( const QString& fieldName, LookupFieldSchema *lookupFieldSchema ) +bool TableSchema::setLookupFieldSchema( const TQString& fieldName, LookupFieldSchema *lookupFieldSchema ) { Field *f = field(fieldName); if (!f) { @@ -393,7 +393,7 @@ bool TableSchema::setLookupFieldSchema( const QString& fieldName, LookupFieldSch return false; } if (lookupFieldSchema) - d->lookupFields.replace( f, lookupFieldSchema ); + d->lookupFields.tqreplace( f, lookupFieldSchema ); else { delete d->lookupFields[f]; d->lookupFields.remove( f ); @@ -407,7 +407,7 @@ LookupFieldSchema *TableSchema::lookupFieldSchema( const Field& field ) const return d->lookupFields[ &field ]; } -LookupFieldSchema *TableSchema::lookupFieldSchema( const QString& fieldName ) +LookupFieldSchema *TableSchema::lookupFieldSchema( const TQString& fieldName ) { Field *f = TableSchema::field(fieldName); if (!f) @@ -415,7 +415,7 @@ LookupFieldSchema *TableSchema::lookupFieldSchema( const QString& fieldName ) return lookupFieldSchema( *f ); } -const QPtrVector<LookupFieldSchema>& TableSchema::lookupFieldsList() +const TQPtrVector<LookupFieldSchema>& TableSchema::lookupFieldsList() { if (d->lookupFields.isEmpty()) return d->lookupFieldsList; @@ -426,7 +426,7 @@ const QPtrVector<LookupFieldSchema>& TableSchema::lookupFieldsList() d->lookupFieldsList.resize( d->lookupFields.count() ); uint i = 0; for (Field::ListIterator it(m_fields); it.current(); ++it) { - QMap<const Field*, LookupFieldSchema*>::ConstIterator itMap = d->lookupFields.find( it.current() ); + TQMap<const Field*, LookupFieldSchema*>::ConstIterator itMap = d->lookupFields.tqfind( it.current() ); if (itMap != d->lookupFields.constEnd()) { d->lookupFieldsList.insert( i, itMap.data() ); i++; @@ -437,7 +437,7 @@ const QPtrVector<LookupFieldSchema>& TableSchema::lookupFieldsList() //-------------------------------------- -InternalTableSchema::InternalTableSchema(const QString& name) +InternalTableSchema::InternalTableSchema(const TQString& name) : TableSchema(name) { } diff --git a/kexi/kexidb/tableschema.h b/kexi/kexidb/tableschema.h index 7584d703..c2d38237 100644 --- a/kexi/kexidb/tableschema.h +++ b/kexi/kexidb/tableschema.h @@ -21,10 +21,10 @@ #ifndef KEXIDB_TABLE_H #define KEXIDB_TABLE_H -#include <qvaluelist.h> -#include <qptrlist.h> -#include <qstring.h> -#include <qguardedptr.h> +#include <tqvaluelist.h> +#include <tqptrlist.h> +#include <tqstring.h> +#include <tqguardedptr.h> #include <kexidb/fieldlist.h> #include <kexidb/schemadata.h> @@ -42,10 +42,10 @@ class LookupFieldSchema; class KEXI_DB_EXPORT TableSchema : public FieldList, public SchemaData { public: - typedef QPtrList<TableSchema> List; //!< Type of tables list - typedef QPtrListIterator<TableSchema> ListIterator; //!< Iterator for tables list + typedef TQPtrList<TableSchema> List; //!< Type of tables list + typedef TQPtrListIterator<TableSchema> ListIterator; //!< Iterator for tables list - TableSchema(const QString & name); + TableSchema(const TQString & name); TableSchema(const SchemaData& sdata); TableSchema(); @@ -99,10 +99,10 @@ class KEXI_DB_EXPORT TableSchema : public FieldList, public SchemaData /*! \return String for debugging purposes, if \a includeTableName is true, table name, caption, etc. is prepended, else only debug string for the fields are returned. */ - QString debugString(bool includeTableName); + TQString debugString(bool includeTableName); /*! \return String for debugging purposes. Equal to debugString(true). */ - virtual QString debugString(); + virtual TQString debugString(); /*! \return connection object if table was created/retrieved using a connection, otherwise 0. */ @@ -150,7 +150,7 @@ class KEXI_DB_EXPORT TableSchema : public FieldList, public SchemaData Passing null \a lookupFieldSchema will remove the previously set lookup field. \return true if \a lookupFieldSchema has been added, or false if there is no such field \a fieldName. */ - bool setLookupFieldSchema( const QString& fieldName, LookupFieldSchema *lookupFieldSchema ); + bool setLookupFieldSchema( const TQString& fieldName, LookupFieldSchema *lookupFieldSchema ); /*! \return lookup field schema for \a field. 0 is returned if there is no such field in the table or this field has no lookup schema. @@ -160,19 +160,19 @@ class KEXI_DB_EXPORT TableSchema : public FieldList, public SchemaData LookupFieldSchema *lookupFieldSchema( const Field& field ) const; /*! \overload LookupFieldSchema *TableSchema::lookupFieldSchema( Field& field ) const */ - LookupFieldSchema *lookupFieldSchema( const QString& fieldName ); + LookupFieldSchema *lookupFieldSchema( const TQString& fieldName ); /*! \return list of lookup field schemas for this table. The order is the same as the order of fields within the table. */ - const QPtrVector<LookupFieldSchema>& lookupFieldsList(); + const TQPtrVector<LookupFieldSchema>& lookupFieldsList(); protected: /*! Automatically retrieves table schema via connection. */ - TableSchema(Connection *conn, const QString & name = QString::null); + TableSchema(Connection *conn, const TQString & name = TQString()); IndexSchema::List m_indices; - QGuardedPtr<Connection> m_conn; + TQGuardedPtr<Connection> m_conn; IndexSchema *m_pkey; @@ -200,7 +200,7 @@ class KEXI_DB_EXPORT TableSchema : public FieldList, public SchemaData class KEXI_DB_EXPORT InternalTableSchema : public TableSchema { public: - InternalTableSchema(const QString& name); + InternalTableSchema(const TQString& name); InternalTableSchema(const TableSchema& ts); virtual ~InternalTableSchema(); }; diff --git a/kexi/kexidb/transaction.cpp b/kexi/kexidb/transaction.cpp index c0607448..6d6e37f1 100644 --- a/kexi/kexidb/transaction.cpp +++ b/kexi/kexidb/transaction.cpp @@ -58,13 +58,13 @@ TransactionData::~TransactionData() const Transaction Transaction::null; Transaction::Transaction() - : QObject(0,"kexidb_transaction") + : TQObject(0,"kexidb_transaction") , m_data(0) { } Transaction::Transaction( const Transaction& trans ) - : QObject(0,"kexidb_transaction") + : TQObject(0,"kexidb_transaction") , m_data(trans.m_data) { if (m_data) { diff --git a/kexi/kexidb/transaction.h b/kexi/kexidb/transaction.h index 2ec065d9..bee90b26 100644 --- a/kexi/kexidb/transaction.h +++ b/kexi/kexidb/transaction.h @@ -20,7 +20,7 @@ #ifndef KEXIDB_TRANSACTION_H #define KEXIDB_TRANSACTION_H -#include <qguardedptr.h> +#include <tqguardedptr.h> #include <kexidb/kexidb_export.h> @@ -56,7 +56,7 @@ class KEXI_DB_EXPORT TransactionData Transaction object is value-based, internal data (handle) structure, reference-counted. */ -class KEXI_DB_EXPORT Transaction : public QObject +class KEXI_DB_EXPORT Transaction : public TQObject { public: /*! Constructs uninitialised (null) transaction. diff --git a/kexi/kexidb/utils.cpp b/kexi/kexidb/utils.cpp index 78b7e416..a44f9c36 100644 --- a/kexi/kexidb/utils.cpp +++ b/kexi/kexidb/utils.cpp @@ -22,11 +22,11 @@ #include "drivermanager.h" #include "lookupfieldschema.h" -#include <qmap.h> -#include <qthread.h> -#include <qdom.h> -#include <qintdict.h> -#include <qbuffer.h> +#include <tqmap.h> +#include <tqthread.h> +#include <tqdom.h> +#include <tqintdict.h> +#include <tqbuffer.h> #include <kdebug.h> #include <klocale.h> @@ -42,10 +42,10 @@ using namespace KexiDB; //! Cache struct TypeCache { - QMap< uint, TypeGroupList > tlist; - QMap< uint, QStringList > nlist; - QMap< uint, QStringList > slist; - QMap< uint, Field::Type > def_tlist; + TQMap< uint, TypeGroupList > tlist; + TQMap< uint, TQStringList > nlist; + TQMap< uint, TQStringList > slist; + TQMap< uint, Field::Type > def_tlist; }; static KStaticDeleter<TypeCache> KexiDB_typeCacheDeleter; @@ -58,8 +58,8 @@ static void initList() for (uint t=0; t<=KexiDB::Field::LastType; t++) { const uint tg = KexiDB::Field::typeGroup( t ); TypeGroupList list; - QStringList name_list, str_list; - if (KexiDB_typeCache->tlist.find( tg )!=KexiDB_typeCache->tlist.end()) { + TQStringList name_list, str_list; + if (KexiDB_typeCache->tlist.tqfind( tg )!=KexiDB_typeCache->tlist.end()) { list = KexiDB_typeCache->tlist[ tg ]; name_list = KexiDB_typeCache->nlist[ tg ]; str_list = KexiDB_typeCache->slist[ tg ]; @@ -88,14 +88,14 @@ const TypeGroupList KexiDB::typesForGroup(KexiDB::Field::TypeGroup typeGroup) return KexiDB_typeCache->tlist[ typeGroup ]; } -QStringList KexiDB::typeNamesForGroup(KexiDB::Field::TypeGroup typeGroup) +TQStringList KexiDB::typeNamesForGroup(KexiDB::Field::TypeGroup typeGroup) { if (!KexiDB_typeCache) initList(); return KexiDB_typeCache->nlist[ typeGroup ]; } -QStringList KexiDB::typeStringsForGroup(KexiDB::Field::TypeGroup typeGroup) +TQStringList KexiDB::typeStringsForGroup(KexiDB::Field::TypeGroup typeGroup) { if (!KexiDB_typeCache) initList(); @@ -109,7 +109,7 @@ KexiDB::Field::Type KexiDB::defaultTypeForGroup(KexiDB::Field::TypeGroup typeGro return (typeGroup <= Field::LastTypeGroup) ? KexiDB_typeCache->def_tlist[ typeGroup ] : Field::InvalidType; } -void KexiDB::getHTMLErrorMesage(Object* obj, QString& msg, QString &details) +void KexiDB::getHTMLErrorMesage(Object* obj, TQString& msg, TQString &details) { Connection *conn = 0; if (!obj || !obj->error()) { @@ -138,9 +138,9 @@ void KexiDB::getHTMLErrorMesage(Object* obj, QString& msg, QString &details) if (!obj->serverErrorMsg().isEmpty()) details += "<p><b><nobr>" +i18n("Message from server:") + "</nobr></b><br>" + obj->serverErrorMsg(); if (!obj->recentSQLString().isEmpty()) - details += "<p><b><nobr>" +i18n("SQL statement:") + QString("</nobr></b><br><tt>%1</tt>").arg(obj->recentSQLString()); + details += "<p><b><nobr>" +i18n("SQL statement:") + TQString("</nobr></b><br><tt>%1</tt>").tqarg(obj->recentSQLString()); int serverResult; - QString serverResultName; + TQString serverResultName; if (obj->serverResult()!=0) { serverResult = obj->serverResult(); serverResultName = obj->serverResultName(); @@ -150,22 +150,22 @@ void KexiDB::getHTMLErrorMesage(Object* obj, QString& msg, QString &details) serverResultName = obj->previousServerResultName(); } if (!serverResultName.isEmpty()) - details += (QString("<p><b><nobr>")+i18n("Server result name:")+"</nobr></b><br>"+serverResultName); + details += (TQString("<p><b><nobr>")+i18n("Server result name:")+"</nobr></b><br>"+serverResultName); if (!details.isEmpty() && (!obj->serverErrorMsg().isEmpty() || !obj->recentSQLString().isEmpty() || !serverResultName.isEmpty() || serverResult!=0) ) { - details += (QString("<p><b><nobr>")+i18n("Server result number:")+"</nobr></b><br>"+QString::number(serverResult)); + details += (TQString("<p><b><nobr>")+i18n("Server result number:")+"</nobr></b><br>"+TQString::number(serverResult)); } if (!details.isEmpty() && !details.startsWith("<qt>")) { if (details.startsWith("<p>")) - details = QString::fromLatin1("<qt>")+details; + details = TQString::tqfromLatin1("<qt>")+details; else - details = QString::fromLatin1("<qt><p>")+details; + details = TQString::tqfromLatin1("<qt><p>")+details; } } -void KexiDB::getHTMLErrorMesage(Object* obj, QString& msg) +void KexiDB::getHTMLErrorMesage(Object* obj, TQString& msg) { getHTMLErrorMesage(obj, msg, msg); } @@ -175,11 +175,11 @@ void KexiDB::getHTMLErrorMesage(Object* obj, ResultInfo *result) getHTMLErrorMesage(obj, result->msg, result->desc); } -int KexiDB::idForObjectName( Connection &conn, const QString& objName, int objType ) +int KexiDB::idForObjectName( Connection &conn, const TQString& objName, int objType ) { RowData data; - if (true!=conn.querySingleRecord(QString("select o_id from kexi__objects where lower(o_name)='%1' and o_type=%2") - .arg(objName.lower()).arg(objType), data)) + if (true!=conn.querySingleRecord(TQString("select o_id from kexi__objects where lower(o_name)='%1' and o_type=%2") + .tqarg(objName.lower()).tqarg(objType), data)) return 0; bool ok; int id = data[0].toInt(&ok); @@ -188,26 +188,26 @@ int KexiDB::idForObjectName( Connection &conn, const QString& objName, int objTy //----------------------------------------- -TableOrQuerySchema::TableOrQuerySchema(Connection *conn, const QCString& name) +TableOrQuerySchema::TableOrQuerySchema(Connection *conn, const TQCString& name) : m_name(name) { - m_table = conn->tableSchema(QString(name)); - m_query = m_table ? 0 : conn->querySchema(QString(name)); + m_table = conn->tableSchema(TQString(name)); + m_query = m_table ? 0 : conn->querySchema(TQString(name)); if (!m_table && !m_query) KexiDBWarn << "TableOrQuery(FieldList &tableOrQuery) : " " tableOrQuery is neither table nor query!" << endl; } -TableOrQuerySchema::TableOrQuerySchema(Connection *conn, const QCString& name, bool table) +TableOrQuerySchema::TableOrQuerySchema(Connection *conn, const TQCString& name, bool table) : m_name(name) - , m_table(table ? conn->tableSchema(QString(name)) : 0) - , m_query(table ? 0 : conn->querySchema(QString(name))) + , m_table(table ? conn->tableSchema(TQString(name)) : 0) + , m_query(table ? 0 : conn->querySchema(TQString(name))) { if (table && !m_table) - KexiDBWarn << "TableOrQuery(Connection *conn, const QCString& name, bool table) : " + KexiDBWarn << "TableOrQuery(Connection *conn, const TQCString& name, bool table) : " "no table specified!" << endl; if (!table && !m_query) - KexiDBWarn << "TableOrQuery(Connection *conn, const QCString& name, bool table) : " + KexiDBWarn << "TableOrQuery(Connection *conn, const TQCString& name, bool table) : " "no query specified!" << endl; } @@ -266,7 +266,7 @@ const QueryColumnInfo::Vector TableOrQuerySchema::columns(bool unique) return QueryColumnInfo::Vector(); } -QCString TableOrQuerySchema::name() const +TQCString TableOrQuerySchema::name() const { if (m_table) return m_table->name().latin1(); @@ -275,7 +275,7 @@ QCString TableOrQuerySchema::name() const return m_name; } -QString TableOrQuerySchema::captionOrName() const +TQString TableOrQuerySchema::captionOrName() const { SchemaData *sdata = m_table ? static_cast<SchemaData *>(m_table) : static_cast<SchemaData *>(m_query); if (!sdata) @@ -283,7 +283,7 @@ QString TableOrQuerySchema::captionOrName() const return sdata->caption().isEmpty() ? sdata->name() : sdata->caption(); } -Field* TableOrQuerySchema::field(const QString& name) +Field* TableOrQuerySchema::field(const TQString& name) { if (m_table) return m_table->field(name); @@ -293,7 +293,7 @@ Field* TableOrQuerySchema::field(const QString& name) return 0; } -QueryColumnInfo* TableOrQuerySchema::columnInfo(const QString& name) +QueryColumnInfo* TableOrQuerySchema::columnInfo(const TQString& name) { if (m_table) return m_table->query()->columnInfo(name); @@ -304,13 +304,13 @@ QueryColumnInfo* TableOrQuerySchema::columnInfo(const QString& name) return 0; } -QString TableOrQuerySchema::debugString() +TQString TableOrQuerySchema::debugString() { if (m_table) return m_table->debugString(); else if (m_query) return m_query->debugString(); - return QString::null; + return TQString(); } void TableOrQuerySchema::debug() @@ -333,7 +333,7 @@ Connection* TableOrQuerySchema::connection() const //------------------------------------------ -class ConnectionTestThread : public QThread { +class ConnectionTestThread : public TQThread { public: ConnectionTestThread(ConnectionTestDialog *dlg, const KexiDB::ConnectionData& connData); virtual void run(); @@ -372,7 +372,7 @@ void ConnectionTestThread::run() } // SQL database backends like PostgreSQL require executing "USE database" // if we really want to know connection to the server succeeded. - QString tmpDbName; + TQString tmpDbName; if (!conn->useTemporaryDatabaseIfNeeded( tmpDbName )) { m_dlg->error(conn); delete conn; @@ -382,12 +382,12 @@ void ConnectionTestThread::run() m_dlg->error(0); } -ConnectionTestDialog::ConnectionTestDialog(QWidget* parent, +ConnectionTestDialog::ConnectionTestDialog(TQWidget* tqparent, const KexiDB::ConnectionData& data, KexiDB::MessageHandler& msgHandler) - : KProgressDialog(parent, "testconn_dlg", + : KProgressDialog(tqparent, "testconn_dlg", i18n("Test Connection"), i18n("<qt>Testing connection to <b>%1</b> database server...</qt>") - .arg(data.serverInfoString(true)), true /*modal*/) + .tqarg(data.serverInfoString(true)), true /*modal*/) , m_thread(new ConnectionTestThread(this, data)) , m_connData(data) , m_msgHandler(&msgHandler) @@ -398,7 +398,7 @@ ConnectionTestDialog::ConnectionTestDialog(QWidget* parent, showCancelButton(true); progressBar()->setPercentageVisible(false); progressBar()->setTotalSteps(0); - connect(&m_timer, SIGNAL(timeout()), this, SLOT(slotTimeout())); + connect(&m_timer, TQT_SIGNAL(timeout()), this, TQT_SLOT(slotTimeout())); adjustSize(); resize(250, height()); } @@ -441,13 +441,13 @@ void ConnectionTestDialog::slotTimeout() else if (notResponding) { KMessageBox::sorry(0, i18n("<qt>Test connection to <b>%1</b> database server failed. The server is not responding.</qt>") - .arg(m_connData.serverInfoString(true)), + .tqarg(m_connData.serverInfoString(true)), i18n("Test Connection")); } else { KMessageBox::information(0, i18n("<qt>Test connection to <b>%1</b> database server established successfully.</qt>") - .arg(m_connData.serverInfoString(true)), + .tqarg(m_connData.serverInfoString(true)), i18n("Test Connection")); } // slotCancel(); @@ -483,17 +483,17 @@ void ConnectionTestDialog::slotCancel() KProgressDialog::slotCancel(); } -void KexiDB::connectionTestDialog(QWidget* parent, const KexiDB::ConnectionData& data, +void KexiDB::connectionTestDialog(TQWidget* tqparent, const KexiDB::ConnectionData& data, KexiDB::MessageHandler& msgHandler) { - ConnectionTestDialog dlg(parent, data, msgHandler); + ConnectionTestDialog dlg(tqparent, data, msgHandler); dlg.exec(); } -int KexiDB::rowCount(Connection &conn, const QString& sql) +int KexiDB::rowCount(Connection &conn, const TQString& sql) { int count = -1; //will be changed only on success of querySingleNumber() - QString selectSql( QString::fromLatin1("SELECT COUNT() FROM (") + sql + ")" ); + TQString selectSql( TQString::tqfromLatin1("SELECT COUNT() FROM (") + sql + ")" ); conn.querySingleNumber(selectSql, count); return count; } @@ -507,7 +507,7 @@ int KexiDB::rowCount(const KexiDB::TableSchema& tableSchema) } int count = -1; //will be changed only on success of querySingleNumber() tableSchema.connection()->querySingleNumber( - QString::fromLatin1("SELECT COUNT(*) FROM ") + TQString::tqfromLatin1("SELECT COUNT(*) FROM ") + tableSchema.connection()->driver()->escapeIdentifier(tableSchema.name()), count ); @@ -523,7 +523,7 @@ int KexiDB::rowCount(KexiDB::QuerySchema& querySchema) } int count = -1; //will be changed only on success of querySingleNumber() querySchema.connection()->querySingleNumber( - QString::fromLatin1("SELECT COUNT(*) FROM (") + TQString::tqfromLatin1("SELECT COUNT(*) FROM (") + querySchema.connection()->selectStatement(querySchema) + ")", count ); @@ -548,24 +548,24 @@ int KexiDB::fieldCount(KexiDB::TableOrQuerySchema& tableOrQuery) return -1; } -QMap<QString,QString> KexiDB::toMap( const ConnectionData& data ) +TQMap<TQString,TQString> KexiDB::toMap( const ConnectionData& data ) { - QMap<QString,QString> m; + TQMap<TQString,TQString> m; m["caption"] = data.caption; m["description"] = data.description; m["driverName"] = data.driverName; m["hostName"] = data.hostName; - m["port"] = QString::number(data.port); - m["useLocalSocketFile"] = QString::number((int)data.useLocalSocketFile); + m["port"] = TQString::number(data.port); + m["useLocalSocketFile"] = TQString::number((int)data.useLocalSocketFile); m["localSocketFileName"] = data.localSocketFileName; m["password"] = data.password; - m["savePassword"] = QString::number((int)data.savePassword); + m["savePassword"] = TQString::number((int)data.savePassword); m["userName"] = data.userName; m["fileName"] = data.fileName(); return m; } -void KexiDB::fromMap( const QMap<QString,QString>& map, ConnectionData& data ) +void KexiDB::fromMap( const TQMap<TQString,TQString>& map, ConnectionData& data ) { data.caption = map["caption"]; data.description = map["description"]; @@ -580,13 +580,13 @@ void KexiDB::fromMap( const QMap<QString,QString>& map, ConnectionData& data ) data.setFileName(map["fileName"]); } -bool KexiDB::splitToTableAndFieldParts(const QString& string, - QString& tableName, QString& fieldName, +bool KexiDB::splitToTableAndFieldParts(const TQString& string, + TQString& tableName, TQString& fieldName, SplitToTableAndFieldPartsOptions option) { - const int id = string.find('.'); + const int id = string.tqfind('.'); if (option & SetFieldNameIfNoTableName && id==-1) { - tableName = QString::null; + tableName = TQString(); fieldName = string; return !fieldName.isEmpty(); } @@ -603,21 +603,21 @@ bool KexiDB::supportsVisibleDecimalPlacesProperty(Field::Type type) return Field::isFPNumericType(type); } -QString KexiDB::formatNumberForVisibleDecimalPlaces(double value, int decimalPlaces) +TQString KexiDB::formatNumberForVisibleDecimalPlaces(double value, int decimalPlaces) { //! @todo round? if (decimalPlaces < 0) { - QString s( QString::number(value, 'f', 10 /*reasonable precision*/)); + TQString s( TQString::number(value, 'f', 10 /*reasonable precision*/)); uint i = s.length()-1; while (i>0 && s[i]=='0') i--; if (s[i]=='.') //remove '.' i--; - s = s.left(i+1).replace('.', KGlobal::locale()->decimalSymbol()); + s = s.left(i+1).tqreplace('.', KGlobal::locale()->decimalSymbol()); return s; } if (decimalPlaces == 0) - return QString::number((int)value); + return TQString::number((int)value); return KGlobal::locale()->formatNumber(value, decimalPlaces); } @@ -630,7 +630,7 @@ KexiDB::Field::Type KexiDB::intToFieldType( int type ) return (KexiDB::Field::Type)type; } -static bool setIntToFieldType( Field& field, const QVariant& value ) +static bool setIntToFieldType( Field& field, const TQVariant& value ) { bool ok; const int intType = value.toInt(&ok); @@ -643,14 +643,14 @@ static bool setIntToFieldType( Field& field, const QVariant& value ) } //! for KexiDB::isBuiltinTableFieldProperty() -static KStaticDeleter< QAsciiDict<char> > KexiDB_builtinFieldPropertiesDeleter; +static KStaticDeleter< TQAsciiDict<char> > KexiDB_builtinFieldPropertiesDeleter; //! for KexiDB::isBuiltinTableFieldProperty() -QAsciiDict<char>* KexiDB_builtinFieldProperties = 0; +TQAsciiDict<char>* KexiDB_builtinFieldProperties = 0; -bool KexiDB::isBuiltinTableFieldProperty( const QCString& propertyName ) +bool KexiDB::isBuiltinTableFieldProperty( const TQCString& propertyName ) { if (!KexiDB_builtinFieldProperties) { - KexiDB_builtinFieldPropertiesDeleter.setObject( KexiDB_builtinFieldProperties, new QAsciiDict<char>(499) ); + KexiDB_builtinFieldPropertiesDeleter.setObject( KexiDB_builtinFieldProperties, new TQAsciiDict<char>(499) ); #define ADD(name) KexiDB_builtinFieldProperties->insert(name, (char*)1) ADD("type"); ADD("primaryKey"); @@ -671,13 +671,13 @@ bool KexiDB::isBuiltinTableFieldProperty( const QCString& propertyName ) //! @todo always update this when new builtins appear! #undef ADD } - return KexiDB_builtinFieldProperties->find( propertyName ); + return KexiDB_builtinFieldProperties->tqfind( propertyName ); } -bool KexiDB::setFieldProperties( Field& field, const QMap<QCString, QVariant>& values ) +bool KexiDB::setFieldProperties( Field& field, const TQMap<TQCString, TQVariant>& values ) { - QMapConstIterator<QCString, QVariant> it; - if ( (it = values.find("type")) != values.constEnd() ) { + TQMapConstIterator<TQCString, TQVariant> it; + if ( (it = values.tqfind("type")) != values.constEnd() ) { if (!setIntToFieldType(field, *it)) return false; } @@ -690,57 +690,57 @@ bool KexiDB::setFieldProperties( Field& field, const QMap<QCString, QVariant>& v uint constraints = field.constraints(); bool ok = true; - if ( (it = values.find("primaryKey")) != values.constEnd() ) + if ( (it = values.tqfind("primaryKey")) != values.constEnd() ) SET_BOOLEAN_FLAG(PrimaryKey, (*it).toBool()); - if ( (it = values.find("indexed")) != values.constEnd() ) + if ( (it = values.tqfind("indexed")) != values.constEnd() ) SET_BOOLEAN_FLAG(Indexed, (*it).toBool()); - if ( (it = values.find("autoIncrement")) != values.constEnd() + if ( (it = values.tqfind("autoIncrement")) != values.constEnd() && KexiDB::Field::isAutoIncrementAllowed(field.type()) ) SET_BOOLEAN_FLAG(AutoInc, (*it).toBool()); - if ( (it = values.find("unique")) != values.constEnd() ) + if ( (it = values.tqfind("unique")) != values.constEnd() ) SET_BOOLEAN_FLAG(Unique, (*it).toBool()); - if ( (it = values.find("notNull")) != values.constEnd() ) + if ( (it = values.tqfind("notNull")) != values.constEnd() ) SET_BOOLEAN_FLAG(NotNull, (*it).toBool()); - if ( (it = values.find("allowEmpty")) != values.constEnd() ) + if ( (it = values.tqfind("allowEmpty")) != values.constEnd() ) SET_BOOLEAN_FLAG(NotEmpty, !(*it).toBool()); field.setConstraints( constraints ); uint options = 0; - if ( (it = values.find("unsigned")) != values.constEnd()) { + if ( (it = values.tqfind("unsigned")) != values.constEnd()) { options |= KexiDB::Field::Unsigned; if (!(*it).toBool()) options ^= KexiDB::Field::Unsigned; } field.setOptions( options ); - if ( (it = values.find("name")) != values.constEnd()) + if ( (it = values.tqfind("name")) != values.constEnd()) field.setName( (*it).toString() ); - if ( (it = values.find("caption")) != values.constEnd()) + if ( (it = values.tqfind("caption")) != values.constEnd()) field.setCaption( (*it).toString() ); - if ( (it = values.find("description")) != values.constEnd()) + if ( (it = values.tqfind("description")) != values.constEnd()) field.setDescription( (*it).toString() ); - if ( (it = values.find("length")) != values.constEnd()) + if ( (it = values.tqfind("length")) != values.constEnd()) field.setLength( (*it).isNull() ? 0/*default*/ : (*it).toUInt(&ok) ); if (!ok) return false; - if ( (it = values.find("precision")) != values.constEnd()) + if ( (it = values.tqfind("precision")) != values.constEnd()) field.setPrecision( (*it).isNull() ? 0/*default*/ : (*it).toUInt(&ok) ); if (!ok) return false; - if ( (it = values.find("defaultValue")) != values.constEnd()) + if ( (it = values.tqfind("defaultValue")) != values.constEnd()) field.setDefaultValue( *it ); - if ( (it = values.find("width")) != values.constEnd()) + if ( (it = values.tqfind("width")) != values.constEnd()) field.setWidth( (*it).isNull() ? 0/*default*/ : (*it).toUInt(&ok) ); if (!ok) return false; - if ( (it = values.find("visibleDecimalPlaces")) != values.constEnd() + if ( (it = values.tqfind("visibleDecimalPlaces")) != values.constEnd() && KexiDB::supportsVisibleDecimalPlacesProperty(field.type()) ) field.setVisibleDecimalPlaces( (*it).isNull() ? -1/*default*/ : (*it).toInt(&ok) ); if (!ok) return false; // set custom properties - typedef QMap<QCString, QVariant> PropertiesMap; + typedef TQMap<TQCString, TQVariant> PropertiesMap; foreach( PropertiesMap::ConstIterator, it, values ) { if (!isBuiltinTableFieldProperty( it.key() ) && !isExtendedTableFieldProperty( it.key() )) { field.setCustomProperty( it.key(), it.data() ); @@ -751,14 +751,14 @@ bool KexiDB::setFieldProperties( Field& field, const QMap<QCString, QVariant>& v } //! for KexiDB::isExtendedTableFieldProperty() -static KStaticDeleter< QAsciiDict<char> > KexiDB_extendedPropertiesDeleter; +static KStaticDeleter< TQAsciiDict<char> > KexiDB_extendedPropertiesDeleter; //! for KexiDB::isExtendedTableFieldProperty() -QAsciiDict<char>* KexiDB_extendedProperties = 0; +TQAsciiDict<char>* KexiDB_extendedProperties = 0; -bool KexiDB::isExtendedTableFieldProperty( const QCString& propertyName ) +bool KexiDB::isExtendedTableFieldProperty( const TQCString& propertyName ) { if (!KexiDB_extendedProperties) { - KexiDB_extendedPropertiesDeleter.setObject( KexiDB_extendedProperties, new QAsciiDict<char>(499, false) ); + KexiDB_extendedPropertiesDeleter.setObject( KexiDB_extendedProperties, new TQAsciiDict<char>(499, false) ); #define ADD(name) KexiDB_extendedProperties->insert(name, (char*)1) ADD("visibleDecimalPlaces"); ADD("rowSource"); @@ -773,10 +773,10 @@ bool KexiDB::isExtendedTableFieldProperty( const QCString& propertyName ) ADD("displayWidget"); #undef ADD } - return KexiDB_extendedProperties->find( propertyName ); + return KexiDB_extendedProperties->tqfind( propertyName ); } -bool KexiDB::setFieldProperty( Field& field, const QCString& propertyName, const QVariant& value ) +bool KexiDB::setFieldProperty( Field& field, const TQCString& propertyName, const TQVariant& value ) { #define SET_BOOLEAN_FLAG(flag, value) { \ constraints |= KexiDB::Field::flag; \ @@ -806,8 +806,8 @@ bool KexiDB::setFieldProperty( Field& field, const QCString& propertyName, const } else { if (!field.table()) { - KexiDBWarn << QString("KexiDB::setFieldProperty() Cannot set \"%1\" property - no table assinged for field!") - .arg(propertyName) << endl; + KexiDBWarn << TQString("KexiDB::setFieldProperty() Cannot set \"%1\" property - no table assinged for field!") + .tqarg(propertyName.data()) << endl; } else { LookupFieldSchema *lookup = field.table()->lookupFieldSchema(field); @@ -886,45 +886,45 @@ bool KexiDB::setFieldProperty( Field& field, const QCString& propertyName, const #undef GET_INT } -int KexiDB::loadIntPropertyValueFromDom( const QDomNode& node, bool* ok ) +int KexiDB::loadIntPropertyValueFromDom( const TQDomNode& node, bool* ok ) { - QCString valueType = node.nodeName().latin1(); + TQCString valueType = node.nodeName().latin1(); if (valueType.isEmpty() || valueType!="number") { if (ok) *ok = false; return 0; } - const QString text( QDomNode(node).toElement().text() ); + const TQString text( TQDomNode(node).toElement().text() ); int val = text.toInt(ok); return val; } -QString KexiDB::loadStringPropertyValueFromDom( const QDomNode& node, bool* ok ) +TQString KexiDB::loadStringPropertyValueFromDom( const TQDomNode& node, bool* ok ) { - QCString valueType = node.nodeName().latin1(); + TQCString valueType = node.nodeName().latin1(); if (valueType!="string") { if (ok) *ok = false; return 0; } - return QDomNode(node).toElement().text(); + return TQDomNode(node).toElement().text(); } -QVariant KexiDB::loadPropertyValueFromDom( const QDomNode& node ) +TQVariant KexiDB::loadPropertyValueFromDom( const TQDomNode& node ) { - QCString valueType = node.nodeName().latin1(); + TQCString valueType = node.nodeName().latin1(); if (valueType.isEmpty()) - return QVariant(); - const QString text( QDomNode(node).toElement().text() ); + return TQVariant(); + const TQString text( TQDomNode(node).toElement().text() ); bool ok; if (valueType == "string") { return text; } else if (valueType == "cstring") { - return QCString(text.latin1()); + return TQCString(text.latin1()); } else if (valueType == "number") { // integer or double - if (text.find('.')!=-1) { + if (text.tqfind('.')!=-1) { double val = text.toDouble(&ok); if (ok) return val; @@ -933,106 +933,106 @@ QVariant KexiDB::loadPropertyValueFromDom( const QDomNode& node ) const int val = text.toInt(&ok); if (ok) return val; - const Q_LLONG valLong = text.toLongLong(&ok); + const TQ_LLONG valLong = text.toLongLong(&ok); if (ok) return valLong; } } else if (valueType == "bool") { - return QVariant(text.lower()=="true" || text=="1", 1); + return TQVariant(text.lower()=="true" || text=="1", 1); } -//! @todo add more QVariant types +//! @todo add more TQVariant types KexiDBWarn << "loadPropertyValueFromDom(): unknown type '" << valueType << "'" << endl; - return QVariant(); + return TQVariant(); } -QDomElement KexiDB::saveNumberElementToDom(QDomDocument& doc, QDomElement& parentEl, - const QString& elementName, int value) +TQDomElement KexiDB::saveNumberElementToDom(TQDomDocument& doc, TQDomElement& tqparentEl, + const TQString& elementName, int value) { - QDomElement el( doc.createElement(elementName) ); - parentEl.appendChild( el ); - QDomElement numberEl( doc.createElement("number") ); + TQDomElement el( doc.createElement(elementName) ); + tqparentEl.appendChild( el ); + TQDomElement numberEl( doc.createElement("number") ); el.appendChild( numberEl ); - numberEl.appendChild( doc.createTextNode( QString::number(value) ) ); + numberEl.appendChild( doc.createTextNode( TQString::number(value) ) ); return el; } -QDomElement KexiDB::saveBooleanElementToDom(QDomDocument& doc, QDomElement& parentEl, - const QString& elementName, bool value) +TQDomElement KexiDB::saveBooleanElementToDom(TQDomDocument& doc, TQDomElement& tqparentEl, + const TQString& elementName, bool value) { - QDomElement el( doc.createElement(elementName) ); - parentEl.appendChild( el ); - QDomElement numberEl( doc.createElement("bool") ); + TQDomElement el( doc.createElement(elementName) ); + tqparentEl.appendChild( el ); + TQDomElement numberEl( doc.createElement("bool") ); el.appendChild( numberEl ); numberEl.appendChild( doc.createTextNode( - value ? QString::fromLatin1("true") : QString::fromLatin1("false") ) ); + value ? TQString::tqfromLatin1("true") : TQString::tqfromLatin1("false") ) ); return el; } //! Used in KexiDB::emptyValueForType() -static KStaticDeleter< QValueVector<QVariant> > KexiDB_emptyValueForTypeCacheDeleter; -QValueVector<QVariant> *KexiDB_emptyValueForTypeCache = 0; +static KStaticDeleter< TQValueVector<TQVariant> > KexiDB_emptyValueForTypeCacheDeleter; +TQValueVector<TQVariant> *KexiDB_emptyValueForTypeCache = 0; -QVariant KexiDB::emptyValueForType( KexiDB::Field::Type type ) +TQVariant KexiDB::emptyValueForType( KexiDB::Field::Type type ) { if (!KexiDB_emptyValueForTypeCache) { KexiDB_emptyValueForTypeCacheDeleter.setObject( KexiDB_emptyValueForTypeCache, - new QValueVector<QVariant>(int(Field::LastType)+1) ); + new TQValueVector<TQVariant>(int(Field::LastType)+1) ); #define ADD(t, value) (*KexiDB_emptyValueForTypeCache)[t]=value; ADD(Field::Byte, 0); ADD(Field::ShortInteger, 0); ADD(Field::Integer, 0); ADD(Field::BigInteger, 0); - ADD(Field::Boolean, QVariant(false, 0)); + ADD(Field::Boolean, TQVariant(false, 0)); ADD(Field::Float, 0.0); ADD(Field::Double, 0.0); //! @todo ok? we have no better defaults - ADD(Field::Text, QString(" ")); - ADD(Field::LongText, QString(" ")); - ADD(Field::BLOB, QByteArray()); + ADD(Field::Text, TQString(" ")); + ADD(Field::LongText, TQString(" ")); + ADD(Field::BLOB, TQByteArray()); #undef ADD } - const QVariant val( KexiDB_emptyValueForTypeCache->at( + const TQVariant val( KexiDB_emptyValueForTypeCache->at( (type<=Field::LastType) ? type : Field::InvalidType) ); if (!val.isNull()) return val; else { //special cases if (type==Field::Date) - return QDate::currentDate(); + return TQDate::tqcurrentDate(); if (type==Field::DateTime) - return QDateTime::currentDateTime(); + return TQDateTime::tqcurrentDateTime(); if (type==Field::Time) - return QTime::currentTime(); + return TQTime::currentTime(); } KexiDBWarn << "KexiDB::emptyValueForType() no value for type " << Field::typeName(type) << endl; - return QVariant(); + return TQVariant(); } //! Used in KexiDB::notEmptyValueForType() -static KStaticDeleter< QValueVector<QVariant> > KexiDB_notEmptyValueForTypeCacheDeleter; -QValueVector<QVariant> *KexiDB_notEmptyValueForTypeCache = 0; +static KStaticDeleter< TQValueVector<TQVariant> > KexiDB_notEmptyValueForTypeCacheDeleter; +TQValueVector<TQVariant> *KexiDB_notEmptyValueForTypeCache = 0; -QVariant KexiDB::notEmptyValueForType( KexiDB::Field::Type type ) +TQVariant KexiDB::notEmptyValueForType( KexiDB::Field::Type type ) { if (!KexiDB_notEmptyValueForTypeCache) { KexiDB_notEmptyValueForTypeCacheDeleter.setObject( KexiDB_notEmptyValueForTypeCache, - new QValueVector<QVariant>(int(Field::LastType)+1) ); + new TQValueVector<TQVariant>(int(Field::LastType)+1) ); #define ADD(t, value) (*KexiDB_notEmptyValueForTypeCache)[t]=value; // copy most of the values for (int i = int(Field::InvalidType) + 1; i<=Field::LastType; i++) { if (i==Field::Date || i==Field::DateTime || i==Field::Time) continue; //'current' value will be returned if (i==Field::Text || i==Field::LongText) { - ADD(i, QVariant(QString(""))); + ADD(i, TQVariant(TQString(""))); continue; } if (i==Field::BLOB) { //! @todo blobs will contain other mime types too - QByteArray ba; - QBuffer buffer( ba ); + TQByteArray ba; + TQBuffer buffer( ba ); buffer.open( IO_WriteOnly ); - QPixmap pm(SmallIcon("filenew")); + TQPixmap pm(SmallIcon("filenew")); pm.save( &buffer, "PNG"/*! @todo default? */ ); ADD(i, ba); continue; @@ -1041,46 +1041,46 @@ QVariant KexiDB::notEmptyValueForType( KexiDB::Field::Type type ) } #undef ADD } - const QVariant val( KexiDB_notEmptyValueForTypeCache->at( + const TQVariant val( KexiDB_notEmptyValueForTypeCache->at( (type<=Field::LastType) ? type : Field::InvalidType) ); if (!val.isNull()) return val; else { //special cases if (type==Field::Date) - return QDate::currentDate(); + return TQDate::tqcurrentDate(); if (type==Field::DateTime) - return QDateTime::currentDateTime(); + return TQDateTime::tqcurrentDateTime(); if (type==Field::Time) - return QTime::currentTime(); + return TQTime::currentTime(); } KexiDBWarn << "KexiDB::notEmptyValueForType() no value for type " << Field::typeName(type) << endl; - return QVariant(); + return TQVariant(); } -QString KexiDB::escapeBLOB(const QByteArray& array, BLOBEscapingType type) +TQString KexiDB::escapeBLOB(const TQByteArray& array, BLOBEscapingType type) { const int size = array.size(); if (size==0) - return QString::null; + return TQString(); int escaped_length = size*2; if (type == BLOBEscape0xHex || type == BLOBEscapeOctal) escaped_length += 2/*0x or X'*/; else if (type == BLOBEscapeXHex) escaped_length += 3; //X' + ' - QString str; + TQString str; str.reserve(escaped_length); if (str.capacity() < (uint)escaped_length) { KexiDBWarn << "KexiDB::Driver::escapeBLOB(): no enough memory (cannot allocate "<< escaped_length<<" chars)" << endl; - return QString::null; + return TQString(); } if (type == BLOBEscapeXHex) - str = QString::fromLatin1("X'"); + str = TQString::tqfromLatin1("X'"); else if (type == BLOBEscape0xHex) - str = QString::fromLatin1("0x"); + str = TQString::tqfromLatin1("0x"); else if (type == BLOBEscapeOctal) - str = QString::fromLatin1("'"); + str = TQString::tqfromLatin1("'"); int new_length = str.length(); //after X' or 0x, etc. if (type == BLOBEscapeOctal) { @@ -1113,9 +1113,9 @@ QString KexiDB::escapeBLOB(const QByteArray& array, BLOBEscapingType type) return str; } -QByteArray KexiDB::pgsqlByteaToByteArray(const char* data, int length) +TQByteArray KexiDB::pgsqlByteaToByteArray(const char* data, int length) { - QByteArray array; + TQByteArray array; int output=0; for (int pass=0; pass<2; pass++) {//2 passes to avoid allocating buffer twice: // 0: count #of chars; 1: copy data @@ -1161,41 +1161,41 @@ QByteArray KexiDB::pgsqlByteaToByteArray(const char* data, int length) return array; } -QString KexiDB::variantToString( const QVariant& v ) +TQString KexiDB::variantToString( const TQVariant& v ) { - if (v.type()==QVariant::ByteArray) + if (v.type()==TQVariant::ByteArray) return KexiDB::escapeBLOB(v.toByteArray(), KexiDB::BLOBEscapeHex); return v.toString(); } -QVariant KexiDB::stringToVariant( const QString& s, QVariant::Type type, bool &ok ) +TQVariant KexiDB::stringToVariant( const TQString& s, TQVariant::Type type, bool &ok ) { if (s.isNull()) { ok = true; - return QVariant(); + return TQVariant(); } - if (QVariant::Invalid==type) { + if (TQVariant::Invalid==type) { ok = false; - return QVariant(); + return TQVariant(); } - if (type==QVariant::ByteArray) {//special case: hex string + if (type==TQVariant::ByteArray) {//special case: hex string const uint len = s.length(); - QByteArray ba(len/2 + len%2); + TQByteArray ba(len/2 + len%2); for (uint i=0; i<(len-1); i+=2) { int c = s.mid(i,2).toInt(&ok, 16); if (!ok) { KexiDBWarn << "KexiDB::stringToVariant(): Error in digit " << i << endl; - return QVariant(); + return TQVariant(); } ba[i/2] = (char)c; } ok = true; return ba; } - QVariant result(s); + TQVariant result(s); if (!result.cast( type )) { ok = false; - return QVariant(); + return TQVariant(); } ok = true; return result; @@ -1228,7 +1228,7 @@ void KexiDB::getLimitsForType(Field::Type type, int &minValue, int &maxValue) void KexiDB::debugRowData(const RowData& rowData) { - KexiDBDbg << QString("ROW DATA (%1 columns):").arg(rowData.count()) << endl; + KexiDBDbg << TQString("ROW DATA (%1 columns):").tqarg(rowData.count()) << endl; foreach(RowData::ConstIterator, it, rowData) KexiDBDbg << "- " << (*it) << endl; } @@ -1248,7 +1248,7 @@ Field::Type KexiDB::maximumForIntegerTypes(Field::Type t1, Field::Type t2) return KexiDB::maximumForIntegerTypes(t2, t1); //swap } -QString KexiDB::simplifiedTypeName(const Field& field) +TQString KexiDB::simplifiedTypeName(const Field& field) { if (field.isNumericType()) return i18n("Number"); //simplify diff --git a/kexi/kexidb/utils.h b/kexi/kexidb/utils.h index a455f5b8..fff7a071 100644 --- a/kexi/kexidb/utils.h +++ b/kexi/kexidb/utils.h @@ -21,51 +21,51 @@ #ifndef KEXIDB_UTILS_H #define KEXIDB_UTILS_H -#include <qvaluelist.h> -#include <qvariant.h> +#include <tqvaluelist.h> +#include <tqvariant.h> #include <kexidb/connection.h> #include <kexidb/driver.h> -class QDomNode; -class QDomElement; -class QDomDocument; +class TQDomNode; +class TQDomElement; +class TQDomDocument; namespace KexiDB { //! for convenience inline KEXI_DB_EXPORT bool deleteRow(Connection &conn, TableSchema *table, - const QString &keyname, const QString &keyval) + const TQString &keyname, const TQString &keyval) { return table!=0 && conn.executeSQL("DELETE FROM " + table->name() + " WHERE " - + keyname + "=" + conn.driver()->valueToSQL( Field::Text, QVariant(keyval) )); + + keyname + "=" + conn.driver()->valueToSQL( Field::Text, TQVariant(keyval) )); } - inline KEXI_DB_EXPORT bool deleteRow(Connection &conn, const QString &tableName, - const QString &keyname, const QString &keyval) + inline KEXI_DB_EXPORT bool deleteRow(Connection &conn, const TQString &tableName, + const TQString &keyname, const TQString &keyval) { return conn.executeSQL("DELETE FROM " + tableName + " WHERE " - + keyname + "=" + conn.driver()->valueToSQL( Field::Text, QVariant(keyval) )); + + keyname + "=" + conn.driver()->valueToSQL( Field::Text, TQVariant(keyval) )); } inline KEXI_DB_EXPORT bool deleteRow(Connection &conn, TableSchema *table, - const QString &keyname, int keyval) + const TQString &keyname, int keyval) { return table!=0 && conn.executeSQL("DELETE FROM " + table->name() + " WHERE " - + keyname + "=" + conn.driver()->valueToSQL( Field::Integer, QVariant(keyval) )); + + keyname + "=" + conn.driver()->valueToSQL( Field::Integer, TQVariant(keyval) )); } - inline KEXI_DB_EXPORT bool deleteRow(Connection &conn, const QString &tableName, - const QString &keyname, int keyval) + inline KEXI_DB_EXPORT bool deleteRow(Connection &conn, const TQString &tableName, + const TQString &keyname, int keyval) { return conn.executeSQL("DELETE FROM " + tableName + " WHERE " - + keyname + "=" + conn.driver()->valueToSQL( Field::Integer, QVariant(keyval) )); + + keyname + "=" + conn.driver()->valueToSQL( Field::Integer, TQVariant(keyval) )); } /*! Delete row with two generic criterias. */ - inline KEXI_DB_EXPORT bool deleteRow(Connection &conn, const QString &tableName, - const QString &keyname1, Field::Type keytype1, const QVariant& keyval1, - const QString &keyname2, Field::Type keytype2, const QVariant& keyval2) + inline KEXI_DB_EXPORT bool deleteRow(Connection &conn, const TQString &tableName, + const TQString &keyname1, Field::Type keytype1, const TQVariant& keyval1, + const TQString &keyname2, Field::Type keytype2, const TQVariant& keyval2) { return conn.executeSQL("DELETE FROM " + tableName + " WHERE " + keyname1 + "=" + conn.driver()->valueToSQL( keytype1, keyval1 ) @@ -73,26 +73,26 @@ namespace KexiDB } inline KEXI_DB_EXPORT bool replaceRow(Connection &conn, TableSchema *table, - const QString &keyname, const QString &keyval, const QString &valname, QVariant val, int ftype) + const TQString &keyname, const TQString &keyval, const TQString &valname, TQVariant val, int ftype) { if (!table || !KexiDB::deleteRow(conn, table, keyname, keyval)) return false; return conn.executeSQL("INSERT INTO " + table->name() + " (" + keyname + "," + valname + ") VALUES (" - + conn.driver()->valueToSQL( Field::Text, QVariant(keyval) ) + "," + + conn.driver()->valueToSQL( Field::Text, TQVariant(keyval) ) + "," + conn.driver()->valueToSQL( ftype, val) + ")"); } - typedef QValueList<uint> TypeGroupList; + typedef TQValueList<uint> TypeGroupList; /*! \return list of types for type group \a typeGroup. */ KEXI_DB_EXPORT const TypeGroupList typesForGroup(Field::TypeGroup typeGroup); /*! \return list of i18n'd type names for type group \a typeGroup. */ - KEXI_DB_EXPORT QStringList typeNamesForGroup(Field::TypeGroup typeGroup); + KEXI_DB_EXPORT TQStringList typeNamesForGroup(Field::TypeGroup typeGroup); /*! \return list of (not-i18n'd) type names for type group \a typeGroup. */ - KEXI_DB_EXPORT QStringList typeStringsForGroup(Field::TypeGroup typeGroup); + KEXI_DB_EXPORT TQStringList typeStringsForGroup(Field::TypeGroup typeGroup); /*! \return default field type for type group \a typeGroup, for example, Field::Integer for Field::IntegerGroup. @@ -105,11 +105,11 @@ namespace KexiDB For numbers (either floating-point or integer) it returns i18n'd "Number: string. For other types it the same string as Field::typeGroupName() is returned. */ //! @todo support names of other BLOB subtypes - KEXI_DB_EXPORT QString simplifiedTypeName(const Field& field); + KEXI_DB_EXPORT TQString simplifiedTypeName(const Field& field); /*! \return true if \a v represents an empty (but not null) value. Values of some types (as for strings) can be both empty and not null. */ - inline bool isEmptyValue(Field *f, const QVariant &v) { + inline bool isEmptyValue(Field *f, const TQVariant &v) { if (f->hasEmptyProperty() && v.toString().isEmpty() && !v.toString().isNull()) return true; return v.isNull(); @@ -121,11 +121,11 @@ namespace KexiDB \a msg and \a details strings are not overwritten. If \a msg is not empty, \a obj's error message is appended to \a details. */ - KEXI_DB_EXPORT void getHTMLErrorMesage(Object* obj, QString& msg, QString &details); + KEXI_DB_EXPORT void getHTMLErrorMesage(Object* obj, TQString& msg, TQString &details); /*! This methods works like above, but appends both a message and a description to \a msg. */ - KEXI_DB_EXPORT void getHTMLErrorMesage(Object* obj, QString& msg); + KEXI_DB_EXPORT void getHTMLErrorMesage(Object* obj, TQString& msg); /*! This methods works like above, but works on \a result's members instead. */ KEXI_DB_EXPORT void getHTMLErrorMesage(Object* obj, ResultInfo *result); @@ -134,8 +134,8 @@ namespace KexiDB Constructs an sql string like "fielname = value" for specific \a drv driver, field type \a t, \a fieldName and \a value. If \a value is null, "fieldname is NULL" string is returned. */ - inline KEXI_DB_EXPORT QString sqlWhere(Driver *drv, Field::Type t, - const QString fieldName, const QVariant value) + inline KEXI_DB_EXPORT TQString sqlWhere(Driver *drv, Field::Type t, + const TQString fieldName, const TQVariant value) { if (value.isNull()) return fieldName + " is NULL"; @@ -144,7 +144,7 @@ namespace KexiDB /*! \return identifier for object \a objName of type \a objType or 0 if such object does not exist. */ - KEXI_DB_EXPORT int idForObjectName( Connection &conn, const QString& objName, int objType ); + KEXI_DB_EXPORT int idForObjectName( Connection &conn, const TQString& objName, int objType ); /*! Variant class providing a pointer to table or query. */ class KEXI_DB_EXPORT TableOrQuerySchema { @@ -154,14 +154,14 @@ namespace KexiDB table has priority over query. You should check whether a query or table has been found by testing (query() || table()) expression. */ - TableOrQuerySchema(Connection *conn, const QCString& name); + TableOrQuerySchema(Connection *conn, const TQCString& name); /*! Creates a new TableOrQuerySchema variant object, retrieving table or query schema using \a conn connection and \a name. If \a table is true, \a name is assumed to be a table name, otherwise \a name is assumed to be a query name. You should check whether a query or table has been found by testing (query() || table()) expression. */ - TableOrQuerySchema(Connection *conn, const QCString& name, bool table); + TableOrQuerySchema(Connection *conn, const TQCString& name, bool table); /*! Creates a new TableOrQuerySchema variant object. \a tableOrQuery must be of class TableSchema or QuerySchema. @@ -190,10 +190,10 @@ namespace KexiDB TableSchema* table() const { return m_table; } //! \return name of a query or table - QCString name() const; + TQCString name() const; //! \return caption (if present) or name of the table/query - QString captionOrName() const; + TQString captionOrName() const; //! \return number of fields uint fieldCount() const; @@ -203,37 +203,37 @@ namespace KexiDB /*! \return a field of the table or the query schema for name \a name or 0 if there is no such field. */ - Field* field(const QString& name); + Field* field(const TQString& name); - /*! Like Field* field(const QString& name); + /*! Like Field* field(const TQString& name); but returns all information associated with field/column \a name. */ - QueryColumnInfo* columnInfo(const QString& name); + QueryColumnInfo* columnInfo(const TQString& name); /*! \return connection object, for table or query or 0 if there's no table or query defined. */ Connection* connection() const; /*! \return String for debugging purposes. */ - QString debugString(); + TQString debugString(); /*! Shows debug information about table or query. */ void debug(); protected: - QCString m_name; //!< the name is kept here because m_table and m_table can be 0 + TQCString m_name; //!< the name is kept here because m_table and m_table can be 0 //! and we still want name() and acptionOrName() work. TableSchema* m_table; QuerySchema* m_query; }; -//! @todo perhaps use Q_ULLONG here? +//! @todo perhaps use TQ_ULLONG here? /*! \return number of rows that can be retrieved after executing \a sql statement within a connection \a conn. The statement should be of type SELECT. For SQL data sources it does not fetch any records, only "COUNT(*)" SQL aggregation is used at the backed. -1 is returned if error occured. */ - int rowCount(Connection &conn, const QString& sql); + int rowCount(Connection &conn, const TQString& sql); -//! @todo perhaps use Q_ULLONG here? +//! @todo perhaps use TQ_ULLONG here? /*! \return number of rows that can be retrieved from \a tableSchema. The table must be created or retrieved using a Connection object, i.e. tableSchema.connection() must not return 0. @@ -242,11 +242,11 @@ namespace KexiDB -1 is returned if error occurred. */ KEXI_DB_EXPORT int rowCount(const TableSchema& tableSchema); -//! @todo perhaps use Q_ULLONG here? +//! @todo perhaps use TQ_ULLONG here? /*! Like above but operates on a query schema. */ KEXI_DB_EXPORT int rowCount(QuerySchema& querySchema); -//! @todo perhaps use Q_ULLONG here? +//! @todo perhaps use TQ_ULLONG here? /*! Like above but operates on a table or query schema variant. */ KEXI_DB_EXPORT int rowCount(TableOrQuerySchema& tableOrQuery); @@ -259,14 +259,14 @@ namespace KexiDB (within a second thread). \a data is used to perform a (temporary) test connection. \a msgHandler is used to display errors. On successful connecting, a message is displayed. After testing, temporary connection is closed. */ - KEXI_DB_EXPORT void connectionTestDialog(QWidget* parent, const ConnectionData& data, + KEXI_DB_EXPORT void connectionTestDialog(TQWidget* tqparent, const ConnectionData& data, MessageHandler& msgHandler); /*! Saves connection data \a data into \a map. */ - KEXI_DB_EXPORT QMap<QString,QString> toMap( const ConnectionData& data ); + KEXI_DB_EXPORT TQMap<TQString,TQString> toMap( const ConnectionData& data ); /*! Restores connection data \a data from \a map. */ - KEXI_DB_EXPORT void fromMap( const QMap<QString,QString>& map, ConnectionData& data ); + KEXI_DB_EXPORT void fromMap( const TQMap<TQString,TQString>& map, ConnectionData& data ); //! Used in splitToTableAndFieldParts(). enum SplitToTableAndFieldPartsOptions { @@ -284,13 +284,13 @@ namespace KexiDB or field name could become empty what is not allowed). If \a option is SetFieldNameIfNoTableName and \a string does not contain '.', - \a string is passed to \a fieldName and \a tableName is set to QString::null + \a string is passed to \a fieldName and \a tableName is set to TQString() without failure. If function fails, \a tableName and \a fieldName remain unchanged. \return true on success. */ - KEXI_DB_EXPORT bool splitToTableAndFieldParts(const QString& string, - QString& tableName, QString& fieldName, + KEXI_DB_EXPORT bool splitToTableAndFieldParts(const TQString& string, + TQString& tableName, TQString& fieldName, SplitToTableAndFieldPartsOptions option = FailIfNoTableOrFieldName); /*! \return true if \a type supports "visibleDecimalPlaces" property. */ @@ -307,17 +307,17 @@ namespace KexiDB KLocale::formatNumber() and KLocale::decimalSymbol() are used to get locale settings. @see KexiDB::Field::visibleDecimalPlaces() */ - KEXI_DB_EXPORT QString formatNumberForVisibleDecimalPlaces(double value, int decimalPlaces); + KEXI_DB_EXPORT TQString formatNumberForVisibleDecimalPlaces(double value, int decimalPlaces); //! \return true if \a propertyName is a builtin field property. - KEXI_DB_EXPORT bool isBuiltinTableFieldProperty( const QCString& propertyName ); + KEXI_DB_EXPORT bool isBuiltinTableFieldProperty( const TQCString& propertyName ); //! \return true if \a propertyName is an extended field property. - KEXI_DB_EXPORT bool isExtendedTableFieldProperty( const QCString& propertyName ); + KEXI_DB_EXPORT bool isExtendedTableFieldProperty( const TQCString& propertyName ); /*! \return type of field for integer value \a type. If \a type cannot be casted to KexiDB::Field::Type, KexiDB::Field::InvalidType is returned. - This can be used when type information is deserialized from a string or QVariant. */ + This can be used when type information is deserialized from a string or TQVariant. */ KEXI_DB_EXPORT Field::Type intToFieldType( int type ); /*! Sets property values for \a field. \return true if all the values are valid and allowed. @@ -325,65 +325,65 @@ namespace KexiDB Properties coming from extended schema are also supported. This function is used e.g. by AlterTableHandler when property information comes in form of text. */ - KEXI_DB_EXPORT bool setFieldProperties( Field& field, const QMap<QCString, QVariant>& values ); + KEXI_DB_EXPORT bool setFieldProperties( Field& field, const TQMap<TQCString, TQVariant>& values ); /*! Sets property value for \a field. \return true if the property has been found and the value is valid for this property. On failure contents of \a field is undefined. Properties coming from extended schema are also supported as well as - QVariant customProperty(const QString& propertyName) const; + TQVariant customProperty(const TQString& propertyName) const; This function is used e.g. by AlterTableHandler when property information comes in form of text. */ - KEXI_DB_EXPORT bool setFieldProperty(Field& field, const QCString& propertyName, - const QVariant& value); + KEXI_DB_EXPORT bool setFieldProperty(Field& field, const TQCString& propertyName, + const TQVariant& value); - /*! @return property value loaded from a DOM \a node, written in a QtDesigner-like + /*! @return property value loaded from a DOM \a node, written in a TQtDesigner-like notation: <number>int</number> or <bool>bool</bool>, etc. Supported types are - "string", "cstring", "bool", "number". For invalid values null QVariant is returned. - You can check the validity of the returned value using QVariant::type(). */ - KEXI_DB_EXPORT QVariant loadPropertyValueFromDom( const QDomNode& node ); + "string", "cstring", "bool", "number". For invalid values null TQVariant is returned. + You can check the validity of the returned value using TQVariant::type(). */ + KEXI_DB_EXPORT TQVariant loadPropertyValueFromDom( const TQDomNode& node ); /*! Convenience version of loadPropertyValueFromDom(). \return int value. */ - KEXI_DB_EXPORT int loadIntPropertyValueFromDom( const QDomNode& node, bool* ok ); + KEXI_DB_EXPORT int loadIntPropertyValueFromDom( const TQDomNode& node, bool* ok ); - /*! Convenience version of loadPropertyValueFromDom(). \return QString value. */ - KEXI_DB_EXPORT QString loadStringPropertyValueFromDom( const QDomNode& node, bool* ok ); + /*! Convenience version of loadPropertyValueFromDom(). \return TQString value. */ + KEXI_DB_EXPORT TQString loadStringPropertyValueFromDom( const TQDomNode& node, bool* ok ); - /*! Saves integer element for value \a value to \a doc document within parent element - \a parentEl. The value will be enclosed in "number" element and "elementName" element. - Example: saveNumberElementToDom(doc, parentEl, "height", 15) will create + /*! Saves integer element for value \a value to \a doc document within tqparent element + \a tqparentEl. The value will be enclosed in "number" element and "elementName" element. + Example: saveNumberElementToDom(doc, tqparentEl, "height", 15) will create \code <height><number>15</number></height> \endcode \return the reference to element created with tag elementName. */ - KEXI_DB_EXPORT QDomElement saveNumberElementToDom(QDomDocument& doc, QDomElement& parentEl, - const QString& elementName, int value); + KEXI_DB_EXPORT TQDomElement saveNumberElementToDom(TQDomDocument& doc, TQDomElement& tqparentEl, + const TQString& elementName, int value); - /*! Saves boolean element for value \a value to \a doc document within parent element - \a parentEl. Like saveNumberElementToDom() but creates "bool" tags. True/false values will be + /*! Saves boolean element for value \a value to \a doc document within tqparent element + \a tqparentEl. Like saveNumberElementToDom() but creates "bool" tags. True/false values will be saved as "true"/"false" strings. \return the reference to element created with tag elementName. */ - KEXI_DB_EXPORT QDomElement saveBooleanElementToDom(QDomDocument& doc, QDomElement& parentEl, - const QString& elementName, bool value); + KEXI_DB_EXPORT TQDomElement saveBooleanElementToDom(TQDomDocument& doc, TQDomElement& tqparentEl, + const TQString& elementName, bool value); /*! \return an empty value that can be set for a database field of type \a type having "null" property set. Empty string is returned for text type, 0 for integer or floating-point types, false for boolean type, empty null byte array for BLOB type. For date, time and date/time types current date, time, date+time is returned, respectively. - Returns null QVariant for unsupported values like KexiDB::Field::InvalidType. + Returns null TQVariant for unsupported values like KexiDB::Field::InvalidType. This function is efficient (uses a cache) and is heavily used by the AlterTableHandler for filling new columns. */ - KEXI_DB_EXPORT QVariant emptyValueForType( Field::Type type ); + KEXI_DB_EXPORT TQVariant emptyValueForType( Field::Type type ); /*! \return a value that can be set for a database field of type \a type having "notEmpty" property set. It works in a similar way as - @ref QVariant emptyValueForType( KexiDB::Field::Type type ) with the following differences: + @ref TQVariant emptyValueForType( KexiDB::Field::Type type ) with the following differences: - " " string (a single space) is returned for Text and LongText types - a byte array with saved "filenew" PNG image (icon) for BLOB type - Returns null QVariant for unsupported values like KexiDB::Field::InvalidType. + Returns null TQVariant for unsupported values like KexiDB::Field::InvalidType. This function is efficient (uses a cache) and is heavily used by the AlterTableHandler for filling new columns. */ - KEXI_DB_EXPORT QVariant notEmptyValueForType( Field::Type type ); + KEXI_DB_EXPORT TQVariant notEmptyValueForType( Field::Type type ); //! Escaping types used in escapeBLOB(). enum BLOBEscapingType { @@ -397,30 +397,30 @@ namespace KexiDB //! @todo reverse function for BLOBEscapeOctal is available: processBinaryData() in pqxxcursor.cpp - move it here /*! \return a string containing escaped, printable representation of \a array. - Escaping is controlled by \a type. For empty array QString::null is returned, + Escaping is controlled by \a type. For empty array TQString() is returned, so if you want to use this function in an SQL statement, empty arrays should be detected and "NULL" string should be put instead. This is helper, used in Driver::escapeBLOB() and KexiDB::variantToString(). */ - KEXI_DB_EXPORT QString escapeBLOB(const QByteArray& array, BLOBEscapingType type); + KEXI_DB_EXPORT TQString escapeBLOB(const TQByteArray& array, BLOBEscapingType type); /*! \return byte array converted from \a data of length \a length. \a data is escaped in format used by PostgreSQL's bytea datatype described at http://www.postgresql.org/docs/8.1/interactive/datatype-binary.html This function is used by PostgreSQL KexiDB and migration drivers. */ - KEXI_DB_EXPORT QByteArray pgsqlByteaToByteArray(const char* data, int length); + KEXI_DB_EXPORT TQByteArray pgsqlByteaToByteArray(const char* data, int length); /*! \return string value serialized from a variant value \a v. - This functions works like QVariant::toString() except the case when \a v is of type ByteArray. + This functions works like TQVariant::toString() except the case when \a v is of type ByteArray. In this case KexiDB::escapeBLOB(v.toByteArray(), KexiDB::BLOBEscapeHex) is used. This function is needed for handling values of random type, for example "defaultValue" property of table fields can contain value of any type. Note: the returned string is an unescaped string. */ - KEXI_DB_EXPORT QString variantToString( const QVariant& v ); + KEXI_DB_EXPORT TQString variantToString( const TQVariant& v ); /*! \return variant value of type \a type for a string \a s that was previously serialized using - \ref variantToString( const QVariant& v ) function. + \ref variantToString( const TQVariant& v ) function. \a ok is set to the result of the operation. */ - KEXI_DB_EXPORT QVariant stringToVariant( const QString& s, QVariant::Type type, bool &ok ); + KEXI_DB_EXPORT TQVariant stringToVariant( const TQString& s, TQVariant::Type type, bool &ok ); /*! \return true if setting default value for \a field field is allowed. Fields with unique (and thus primary key) flags set do not accept default values. @@ -442,33 +442,33 @@ namespace KexiDB If one of the types is not of the integer group, Field::InvalidType is returned. */ KEXI_DB_EXPORT Field::Type maximumForIntegerTypes(Field::Type t1, Field::Type t2); - /*! \return QVariant value converted from null-terminated \a data string. + /*! \return TQVariant value converted from null-terminated \a data string. In case of BLOB type, \a data is not nul lterminated, so passing length is needed. */ - inline QVariant cstringToVariant(const char* data, KexiDB::Field* f, int length = -1) + inline TQVariant cstringToVariant(const char* data, KexiDB::Field* f, int length = -1) { if (!data) - return QVariant(); + return TQVariant(); // from mo st to least frequently used types: if (!f || f->isTextType()) - return QString::fromUtf8(data, length); + return TQString::fromUtf8(data, length); if (f->isIntegerType()) { if (f->type()==KexiDB::Field::BigInteger) - return QVariant( QString::fromLatin1(data, length).toLongLong() ); - return QVariant( QString::fromLatin1(data, length).toInt() ); + return TQVariant( TQString::tqfromLatin1(data, length).toLongLong() ); + return TQVariant( TQString::tqfromLatin1(data, length).toInt() ); } if (f->isFPNumericType()) - return QString::fromLatin1(data, length).toDouble(); + return TQString::tqfromLatin1(data, length).toDouble(); if (f->type()==KexiDB::Field::BLOB) { - QByteArray ba; + TQByteArray ba; ba.duplicate(data, length); return ba; } // the default //! @todo date/time? - QVariant result(QString::fromUtf8(data, length)); + TQVariant result(TQString::fromUtf8(data, length)); if (!result.cast( KexiDB::Field::variantType(f->type()) )) - return QVariant(); + return TQVariant(); return result; } } diff --git a/kexi/kexidb/utils_p.h b/kexi/kexidb/utils_p.h index 6129196b..56c20267 100644 --- a/kexi/kexidb/utils_p.h +++ b/kexi/kexidb/utils_p.h @@ -20,8 +20,8 @@ #ifndef KEXIDB_UTILS_P_H #define KEXIDB_UTILS_P_H -#include <qtimer.h> -#include <qwaitcondition.h> +#include <tqtimer.h> +#include <tqwaitcondition.h> #include <kprogress.h> @@ -32,8 +32,9 @@ class ConnectionTestThread; class ConnectionTestDialog : protected KProgressDialog { Q_OBJECT + TQ_OBJECT public: - ConnectionTestDialog(QWidget* parent, + ConnectionTestDialog(TQWidget* tqparent, const KexiDB::ConnectionData& data, KexiDB::MessageHandler& msgHandler); virtual ~ConnectionTestDialog(); @@ -48,11 +49,11 @@ class ConnectionTestDialog : protected KProgressDialog protected: ConnectionTestThread* m_thread; KexiDB::ConnectionData m_connData; - QTimer m_timer; + TQTimer m_timer; KexiDB::MessageHandler* m_msgHandler; uint m_elapsedTime; KexiDB::Object *m_errorObj; - QWaitCondition m_wait; + TQWaitCondition m_wait; bool m_stopWaiting : 1; }; |