summaryrefslogtreecommitdiffstats
path: root/kexi/migration/keximigrate.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kexi/migration/keximigrate.cpp')
-rw-r--r--kexi/migration/keximigrate.cpp162
1 files changed, 81 insertions, 81 deletions
diff --git a/kexi/migration/keximigrate.cpp b/kexi/migration/keximigrate.cpp
index 262293238..989a002a9 100644
--- a/kexi/migration/keximigrate.cpp
+++ b/kexi/migration/keximigrate.cpp
@@ -33,9 +33,9 @@
using namespace KexiDB;
using namespace KexiMigration;
-KexiMigrate::KexiMigrate(QObject *parent, const char *name,
- const QStringList&)
- : QObject( parent, name )
+KexiMigrate::KexiMigrate(TQObject *tqparent, const char *name,
+ const TQStringList&)
+ : TQObject( tqparent, name )
, m_migrateData(0)
, m_destPrj(0)
{
@@ -61,20 +61,20 @@ KexiMigrate::~KexiMigrate()
delete m_destPrj;
}
-bool KexiMigrate::checkIfDestinationDatabaseOverwritingNeedsAccepting(Kexi::ObjectStatus* result,
+bool KexiMigrate::checkIfDestinationDatabaseOverwritingNeedsAccepting(Kexi::ObjecttqStatus* result,
bool& acceptingNeeded)
{
acceptingNeeded = false;
if (result)
- result->clearStatus();
+ result->cleartqStatus();
KexiDB::DriverManager drvManager;
KexiDB::Driver *destDriver = drvManager.driver(
m_migrateData->destination->connectionData()->driverName);
if (!destDriver) {
- result->setStatus(&drvManager,
+ result->settqStatus(&drvManager,
i18n("Could not create database \"%1\".")
- .arg(m_migrateData->destination->databaseName()));
+ .tqarg(m_migrateData->destination->databaseName()));
return false;
}
@@ -113,30 +113,30 @@ bool KexiMigrate::isSourceAndDestinationDataSourceTheSame() const
//=============================================================================
// Perform Import operation
-bool KexiMigrate::performImport(Kexi::ObjectStatus* result)
+bool KexiMigrate::performImport(Kexi::ObjecttqStatus* result)
{
if (result)
- result->clearStatus();
+ result->cleartqStatus();
KexiDB::DriverManager drvManager;
KexiDB::Driver *destDriver = drvManager.driver(
m_migrateData->destination->connectionData()->driverName);
if (!destDriver) {
- result->setStatus(&drvManager,
+ result->settqStatus(&drvManager,
i18n("Could not create database \"%1\".")
- .arg(m_migrateData->destination->databaseName()));
+ .tqarg(m_migrateData->destination->databaseName()));
return false;
}
- QStringList tables;
+ TQStringList tables;
// Step 1 - connect
kdDebug() << "KexiMigrate::performImport() CONNECTING..." << endl;
if (!drv_connect()) {
kdDebug() << "Couldnt connect to database server" << endl;
if (result)
- result->setStatus(i18n("Could not connect to data source \"%1\".")
- .arg(m_migrateData->source->serverInfoString()), "");
+ result->settqStatus(i18n("Could not connect to data source \"%1\".")
+ .tqarg(m_migrateData->source->serverInfoString()), "");
return false;
}
@@ -145,9 +145,9 @@ bool KexiMigrate::performImport(Kexi::ObjectStatus* result)
if (!tableNames(tables)) {
kdDebug() << "Couldnt get list of tables" << endl;
if (result)
- result->setStatus(
+ result->settqStatus(
i18n("Could not get a list of table names for data source \"%1\".")
- .arg(m_migrateData->source->serverInfoString()), "");
+ .tqarg(m_migrateData->source->serverInfoString()), "");
return false;
}
@@ -155,9 +155,9 @@ bool KexiMigrate::performImport(Kexi::ObjectStatus* result)
if (tables.isEmpty()) {
kdDebug() << "There were no tables to import" << endl;
if (result)
- result->setStatus(
+ result->settqStatus(
i18n("No tables to import found in data source \"%1\".")
- .arg(m_migrateData->source->serverInfoString()), "");
+ .tqarg(m_migrateData->source->serverInfoString()), "");
return false;
}
@@ -165,20 +165,20 @@ bool KexiMigrate::performImport(Kexi::ObjectStatus* result)
tables.sort();
m_tableSchemas.clear();
if (!destDriver) {
- result->setStatus(&drvManager);
+ result->settqStatus(&drvManager);
return false;
}
- const bool kexi__objects_exists = tables.find("kexi__objects")!=tables.end();
- QStringList kexiDBTables;
+ const bool kexi__objects_exists = tables.tqfind("kexi__objects")!=tables.end();
+ TQStringList kexiDBTables;
if (kexi__objects_exists) {
tristate res = drv_queryStringListFromSQL(
- QString::fromLatin1("SELECT o_name FROM kexi__objects WHERE o_type=%1")
- .arg((int)KexiDB::TableObjectType), 0, kexiDBTables, -1);
+ TQString::tqfromLatin1("SELECT o_name FROM kexi__objects WHERE o_type=%1")
+ .tqarg((int)KexiDB::TableObjectType), 0, kexiDBTables, -1);
if (res == true) {
// prepend KexiDB-compatible tables to 'tables' list, so we'll copy KexiDB-compatible tables first,
// to make sure existing IDs will not be in conflict with IDs newly generated for non-KexiDB tables
kexiDBTables.sort();
- foreach(QStringList::ConstIterator, it, kexiDBTables)
+ foreach(TQStringList::ConstIterator, it, kexiDBTables)
tables.remove( *it );
//kdDebug() << "KexiDB-compat tables: " << kexiDBTables << endl;
//kdDebug() << "non-KexiDB tables: " << tables << endl;
@@ -187,21 +187,21 @@ bool KexiMigrate::performImport(Kexi::ObjectStatus* result)
// uint i=0;
// -- read table schemas and create them in memory (only for non-KexiDB-compat tables)
- foreach (QStringList::ConstIterator, it, tables) {
+ foreach (TQStringList::ConstIterator, it, tables) {
if (destDriver->isSystemObjectName( *it ) //"kexi__objects", etc.
|| (*it).lower().startsWith("kexi__")) //tables at KexiProject level, e.g. "kexi__blobs"
continue;
// this is a non-KexiDB table: generate schema from native data source
- const QString tableName( KexiUtils::string2Identifier(*it) );
+ const TQString tableName( KexiUtils::string2Identifier(*it) );
KexiDB::TableSchema *tableSchema = new KexiDB::TableSchema(tableName);
tableSchema->setCaption( *it ); //caption is equal to the original name
if (!drv_readTableSchema(*it, *tableSchema)) {
delete tableSchema;
if (result)
- result->setStatus(
+ result->settqStatus(
i18n("Could not import project from data source \"%1\". Error reading table \"%2\".")
- .arg(m_migrateData->source->serverInfoString()).arg(tableName), "");
+ .tqarg(m_migrateData->source->serverInfoString()).tqarg(tableName), "");
return false;
}
//yeah, got a table
@@ -228,9 +228,9 @@ bool KexiMigrate::performImport(Kexi::ObjectStatus* result)
if (trans.isNull()) {
ok = false;
if (result)
- result->setStatus(destConn,
+ result->settqStatus(destConn,
i18n("Could not create database \"%1\".")
- .arg(m_migrateData->destination->databaseName()));
+ .tqarg(m_migrateData->destination->databaseName()));
//later destConn->dropDatabase(m_migrateData->destination->databaseName());
//don't delete prj, otherwise eror message will be deleted delete prj;
//later return m_destPrj;
@@ -243,24 +243,24 @@ bool KexiMigrate::performImport(Kexi::ObjectStatus* result)
// Step 5 - Create the copies of KexiDB-compat tables in memory (to maintain the same IDs)
m_kexiDBCompatibleTableSchemasToRemoveFromMemoryAfterImport.clear();
- foreach (QStringList::ConstIterator, it, kexiDBTables) {
+ foreach (TQStringList::ConstIterator, it, kexiDBTables) {
//load the schema from kexi__objects and kexi__fields
TableSchema *t = new TableSchema();
RowData data;
bool firstRecord = true;
if (true == drv_fetchRecordFromSQL(
- QString("SELECT o_id, o_type, o_name, o_caption, o_desc FROM kexi__objects "
- "WHERE o_name='%1' AND o_type=%1").arg(*it).arg((int)KexiDB::TableObjectType),
+ TQString("SELECT o_id, o_type, o_name, o_caption, o_desc FROM kexi__objects "
+ "WHERE o_name='%1' AND o_type=%1").tqarg(*it).tqarg((int)KexiDB::TableObjectType),
data, firstRecord)
&& destConn->setupObjectSchemaData( data, *t ))
{
//! @todo to reuse Connection::setupTableSchema()'s statement somehow...
//load schema for every field and add it
firstRecord = true;
- QString sql(
- QString::fromLatin1("SELECT t_id, f_type, f_name, f_length, f_precision, f_constraints, "
+ TQString sql(
+ 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->id()) );
+ " FROM kexi__fields WHERE t_id=%1 ORDER BY f_order").tqarg(t->id()) );
while (ok) {
tristate res = drv_fetchRecordFromSQL(sql, data, firstRecord);
if (res != true) {
@@ -293,19 +293,19 @@ bool KexiMigrate::performImport(Kexi::ObjectStatus* result)
// Step 7 - Create the non-KexiDB-compatible tables: new IDs will be assigned to them
if (ok) {
KexiDB::TableSchema *ts;
- for (QPtrListIterator<TableSchema> it (m_tableSchemas); (ts = it.current()); ++it) {
+ for (TQPtrListIterator<TableSchema> it (m_tableSchemas); (ts = it.current()); ++it) {
ok = destConn->createTable( ts );
if (!ok) {
kdDebug() << "Failed to create a table " << ts->name() << endl;
destConn->debugError();
if (result)
- result->setStatus(destConn,
+ result->settqStatus(destConn,
i18n("Could not create database \"%1\".")
- .arg(m_migrateData->destination->databaseName()));
+ .tqarg(m_migrateData->destination->databaseName()));
m_tableSchemas.remove(ts);
break;
}
- updateProgress((Q_ULLONG)NUM_OF_ROWS_PER_CREATE_TABLE);
+ updateProgress((TQ_ULLONG)NUM_OF_ROWS_PER_CREATE_TABLE);
}
}
@@ -315,7 +315,7 @@ bool KexiMigrate::performImport(Kexi::ObjectStatus* result)
if (ok) {
//add compatible tables to the list, so data will be copied, if needed
if (m_migrateData->keepData) {
- for(QPtrListIterator<TableSchema> it (m_kexiDBCompatibleTableSchemasToRemoveFromMemoryAfterImport);
+ for(TQPtrListIterator<TableSchema> it (m_kexiDBCompatibleTableSchemasToRemoveFromMemoryAfterImport);
it.current(); ++it)
{
m_tableSchemas.append(it.current());
@@ -329,9 +329,9 @@ bool KexiMigrate::performImport(Kexi::ObjectStatus* result)
if (m_destPrj->error()) {
ok = false;
if (result)
- result->setStatus(m_destPrj,
+ result->settqStatus(m_destPrj,
i18n("Could not import project from data source \"%1\".")
- .arg(m_migrateData->source->serverInfoString()));
+ .tqarg(m_migrateData->source->serverInfoString()));
}
}
@@ -344,19 +344,19 @@ bool KexiMigrate::performImport(Kexi::ObjectStatus* result)
if (m_migrateData->keepData) {
//! @todo check detailed "copy forms/blobs/tables" flags here when we add them
// Copy data for "kexi__objectdata" as well, if available in the source db
- if (tables.find("kexi__objectdata")!=tables.end())
+ if (tables.tqfind("kexi__objectdata")!=tables.end())
m_tableSchemas.append(destConn->tableSchema("kexi__objectdata"));
// Copy data for "kexi__blobs" as well, if available in the source db
- if (tables.find("kexi__blobs")!=tables.end())
+ if (tables.tqfind("kexi__blobs")!=tables.end())
m_tableSchemas.append(destConn->tableSchema("kexi__blobs"));
// Copy data for "kexi__fields" as well, if available in the source db
- if (tables.find("kexi__fields")!=tables.end())
+ if (tables.tqfind("kexi__fields")!=tables.end())
m_tableSchemas.append(destConn->tableSchema("kexi__fields"));
}
- for(QPtrListIterator<TableSchema> ts(m_tableSchemas); ok && ts.current() != 0 ; ++ts)
+ for(TQPtrListIterator<TableSchema> ts(m_tableSchemas); ok && ts.current() != 0 ; ++ts)
{
- const QString tname( ts.current()->name().lower() );
+ const TQString tname( ts.current()->name().lower() );
if (destConn->driver()->isSystemObjectName( tname )
//! @todo what if these two tables are not compatible with tables created in destination db
//! because newer db format was used?
@@ -370,8 +370,8 @@ bool KexiMigrate::performImport(Kexi::ObjectStatus* result)
continue;
}
kdDebug() << "Copying data for table: " << tname << endl;
- QString originalTableName;
- if (kexiDBTables.find(tname)==kexiDBTables.end())
+ TQString originalTableName;
+ if (kexiDBTables.tqfind(tname)==kexiDBTables.end())
//caption is equal to the original name
originalTableName = ts.current()->caption().isEmpty() ? tname : ts.current()->caption();
else
@@ -380,8 +380,8 @@ bool KexiMigrate::performImport(Kexi::ObjectStatus* result)
if (!ok) {
kdDebug() << "Failed to copy table " << tname << endl;
if (result)
- result->setStatus(destConn,
- i18n("Could not copy table \"%1\" to destination database.").arg(tname));
+ result->settqStatus(destConn,
+ i18n("Could not copy table \"%1\" to destination database.").tqarg(tname));
break;
}
}//for
@@ -404,9 +404,9 @@ bool KexiMigrate::performImport(Kexi::ObjectStatus* result)
// Finally: error handling
if (result && result->error())
- result->setStatus(destConn,
+ result->settqStatus(destConn,
i18n("Could not import data from data source \"%1\".")
- .arg(m_migrateData->source->serverInfoString()));
+ .tqarg(m_migrateData->source->serverInfoString()));
if (destConn) {
destConn->debugError();
destConn->rollbackTransaction(trans);
@@ -420,10 +420,10 @@ bool KexiMigrate::performImport(Kexi::ObjectStatus* result)
}
//=============================================================================
-bool KexiMigrate::performExport(Kexi::ObjectStatus* result)
+bool KexiMigrate::performExport(Kexi::ObjecttqStatus* result)
{
if (result)
- result->clearStatus();
+ result->cleartqStatus();
//! @todo performExport
@@ -432,7 +432,7 @@ bool KexiMigrate::performExport(Kexi::ObjectStatus* result)
//=============================================================================
// Functions for getting table data
-bool KexiMigrate::tableNames(QStringList & tn)
+bool KexiMigrate::tableNames(TQStringList & tn)
{
//! @todo Cache list of table names
kdDebug() << "Reading list of tables..." << endl;
@@ -442,17 +442,17 @@ bool KexiMigrate::tableNames(QStringList & tn)
//=============================================================================
// Progress functions
bool KexiMigrate::progressInitialise() {
- Q_ULLONG sum = 0, size;
+ TQ_ULLONG sum = 0, size;
emit progressPercent(0);
//! @todo Don't copy table names here
- QStringList tables;
+ TQStringList tables;
if(!tableNames(tables))
return false;
// 1) Get the number of rows/bytes to import
int tableNumber = 1;
- for(QStringList::Iterator it = tables.begin();
+ for(TQStringList::Iterator it = tables.begin();
it != tables.end(); ++it, tableNumber++)
{
if(drv_getTableSize(*it, size)) {
@@ -475,7 +475,7 @@ bool KexiMigrate::progressInitialise() {
}
-void KexiMigrate::updateProgress(Q_ULLONG step) {
+void KexiMigrate::updateProgress(TQ_ULLONG step) {
m_progressDone += step;
if (m_progressDone >= m_progressNextReport) {
int percent = (m_progressDone+1) * 100 / m_progressTotal;
@@ -489,11 +489,11 @@ void KexiMigrate::updateProgress(Q_ULLONG step) {
//=============================================================================
// Prompt the user to choose a field type
-KexiDB::Field::Type KexiMigrate::userType(const QString& fname)
+KexiDB::Field::Type KexiMigrate::userType(const TQString& fname)
{
KInputDialog *dlg;
- QStringList types;
- QString res;
+ TQStringList types;
+ TQString res;
types << "Byte";
types << "Short Integer";
@@ -512,10 +512,10 @@ KexiDB::Field::Type KexiMigrate::userType(const QString& fname)
res = dlg->getItem( i18n("Field Type"),
i18n("The data type for %1 could not be determined. "
"Please select one of the following data "
- "types").arg(fname),
+ "types").tqarg(fname),
types, 0, false);
-//! @todo use QMap<QCString, KexiDB::Field::Type> here!
+//! @todo use TQMap<TQCString, KexiDB::Field::Type> here!
if (res == *types.at(0))
return KexiDB::Field::Byte;
else if (res == *types.at(1))
@@ -546,24 +546,24 @@ KexiDB::Field::Type KexiMigrate::userType(const QString& fname)
return KexiDB::Field::Text;
}
-QVariant KexiMigrate::propertyValue( const QCString& propName )
+TQVariant KexiMigrate::propertyValue( const TQCString& propName )
{
return m_properties[propName.lower()];
}
-QString KexiMigrate::propertyCaption( const QCString& propName ) const
+TQString KexiMigrate::propertyCaption( const TQCString& propName ) const
{
return m_propertyCaptions[propName.lower()];
}
-void KexiMigrate::setPropertyValue( const QCString& propName, const QVariant& value )
+void KexiMigrate::setPropertyValue( const TQCString& propName, const TQVariant& value )
{
m_properties[propName.lower()] = value;
}
-QValueList<QCString> KexiMigrate::propertyNames() const
+TQValueList<TQCString> KexiMigrate::propertyNames() const
{
- QValueList<QCString> names = m_properties.keys();
+ TQValueList<TQCString> names = m_properties.keys();
qHeapSort(names);
return names;
}
@@ -575,21 +575,21 @@ bool KexiMigrate::isValid()
{
setError(ERR_INCOMPAT_DRIVER_VERSION,
i18n("Incompatible migration driver's \"%1\" version: found version %2, expected version %3.")
- .arg(name())
- .arg(QString("%1.%2").arg(versionMajor()).arg(versionMinor()))
- .arg(QString("%1.%2").arg(KexiMigration::versionMajor()).arg(KexiMigration::versionMinor())));
+ .tqarg(name())
+ .tqarg(TQString("%1.%2").tqarg(versionMajor()).tqarg(versionMinor()))
+ .tqarg(TQString("%1.%2").tqarg(KexiMigration::versionMajor()).tqarg(KexiMigration::versionMinor())));
return false;
}
return true;
}
-bool KexiMigrate::drv_queryMaxNumber(const QString& tableName,
- const QString& columnName, int& result)
+bool KexiMigrate::drv_queryMaxNumber(const TQString& tableName,
+ const TQString& columnName, int& result)
{
- QString string;
+ TQString string;
tristate r = drv_querySingleStringFromSQL(
- QString::fromLatin1("SELECT MAX(%1) FROM %2").arg(drv_escapeIdentifier(columnName))
- .arg(drv_escapeIdentifier(tableName)), 0, string);
+ TQString::tqfromLatin1("SELECT MAX(%1) FROM %2").tqarg(drv_escapeIdentifier(columnName))
+ .tqarg(drv_escapeIdentifier(tableName)), 0, string);
if (r == false)
return false;
if (~r) {
@@ -604,9 +604,9 @@ bool KexiMigrate::drv_queryMaxNumber(const QString& tableName,
}
tristate KexiMigrate::drv_querySingleStringFromSQL(
- const QString& sqlStatement, uint columnNumber, QString& string)
+ const TQString& sqlStatement, uint columnNumber, TQString& string)
{
- QStringList stringList;
+ TQStringList stringList;
const tristate res = drv_queryStringListFromSQL(sqlStatement, columnNumber, stringList, 1);
if (true == res)
string = stringList.first();