diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
commit | f008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch) | |
tree | 8e9244c4d4957c36be81e15b566b4aa5ea26c982 /kexi/kexidb/driver.cpp | |
parent | 1210f27b660efb7b37ff43ec68763e85a403471f (diff) | |
download | koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.tar.gz koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.zip |
TQt4 port koffice
This should enable compilation under both Qt3 and Qt4; fixes for any missed components will be forthcoming
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238284 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kexi/kexidb/driver.cpp')
-rw-r--r-- | kexi/kexidb/driver.cpp | 112 |
1 files changed, 56 insertions, 56 deletions
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); |