summaryrefslogtreecommitdiffstats
path: root/kexi/migration/pqxx/pqxxmigrate.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kexi/migration/pqxx/pqxxmigrate.cpp')
-rw-r--r--kexi/migration/pqxx/pqxxmigrate.cpp66
1 files changed, 33 insertions, 33 deletions
diff --git a/kexi/migration/pqxx/pqxxmigrate.cpp b/kexi/migration/pqxx/pqxxmigrate.cpp
index 15715897..c01d68fd 100644
--- a/kexi/migration/pqxx/pqxxmigrate.cpp
+++ b/kexi/migration/pqxx/pqxxmigrate.cpp
@@ -21,9 +21,9 @@
#include "pqxxmigrate.h"
#include "pg_type.h"
-#include <qstring.h>
+#include <tqstring.h>
#include <kdebug.h>
-#include <qstringlist.h>
+#include <tqstringlist.h>
//I maybe should not use stl?
#include <string>
@@ -50,15 +50,15 @@ KEXIMIGRATE_DRIVER_INFO( PqxxMigrate, pqxx )
//==================================================================================
//Constructor
/*PqxxMigrate::PqxxMigrate()
- : KexiMigrate(parent, name, args)
+ : KexiMigrate(tqparent, name, args)
{
m_res=0;
m_trans=0;
m_conn=0;
}*/
-PqxxMigrate::PqxxMigrate(QObject *parent, const char *name, const QStringList &args)
- : KexiMigrate(parent, name, args)
+PqxxMigrate::PqxxMigrate(TQObject *tqparent, const char *name, const TQStringList &args)
+ : KexiMigrate(tqparent, name, args)
{
m_res=0;
m_trans=0;
@@ -78,7 +78,7 @@ PqxxMigrate::~PqxxMigrate()
//any any other attributes required by kexi
//helped by reading the 'tables' test program
bool PqxxMigrate::drv_readTableSchema(
- const QString& originalName, KexiDB::TableSchema& tableSchema)
+ const TQString& originalName, KexiDB::TableSchema& tableSchema)
{
// m_table = new KexiDB::TableSchema(table);
@@ -91,9 +91,9 @@ bool PqxxMigrate::drv_readTableSchema(
//Loop round the fields
for (uint i = 0; i < (uint)m_res->columns(); i++)
{
- QString fldName(m_res->column_name(i));
+ TQString fldName(m_res->column_name(i));
KexiDB::Field::Type fldType = type(m_res->column_type(i), fldName);
- QString fldID( KexiUtils::string2Identifier(fldName) );
+ TQString fldID( KexiUtils::string2Identifier(fldName) );
const pqxx::oid toid = tableOid(originalName);
if (toid==0)
return false;
@@ -124,7 +124,7 @@ bool PqxxMigrate::drv_readTableSchema(
//==================================================================================
//get a list of tables and put into the supplied string list
-bool PqxxMigrate::drv_tableNames(QStringList& tableNames)
+bool PqxxMigrate::drv_tableNames(TQStringList& tableNames)
{
/*
//pg_ = standard postgresql tables, pga_ = tables added by pgaccess, sql_ = probably information schemas, kexi__ = existing kexi tables
@@ -135,7 +135,7 @@ bool PqxxMigrate::drv_tableNames(QStringList& tableNames)
for (pqxx::result::const_iterator c = m_res->begin(); c != m_res->end(); ++c)
{
// Copy the result into the return list
- tableNames << QString::fromLatin1 (c[0].c_str());
+ tableNames << TQString::tqfromLatin1 (c[0].c_str());
}
return true;
}
@@ -147,7 +147,7 @@ bool PqxxMigrate::drv_tableNames(QStringList& tableNames)
//==================================================================================
//Convert a postgresql type to a kexi type
-KexiDB::Field::Type PqxxMigrate::type(int t, const QString& fname)
+KexiDB::Field::Type PqxxMigrate::type(int t, const TQString& fname)
{
switch(t)
{
@@ -193,8 +193,8 @@ bool PqxxMigrate::drv_connect()
{
kdDebug() << "drv_connect: " << m_migrateData->sourceName << endl;
- QString conninfo;
- QString socket;
+ TQString conninfo;
+ TQString socket;
//Setup local/remote connection
if (m_migrateData->source->hostName.isEmpty())
@@ -217,15 +217,15 @@ bool PqxxMigrate::drv_connect()
if (m_migrateData->source->port == 0)
m_migrateData->source->port = 5432;
- conninfo += QString::fromLatin1(" port='%1'").arg(m_migrateData->source->port);
+ conninfo += TQString::tqfromLatin1(" port='%1'").tqarg(m_migrateData->source->port);
- conninfo += QString::fromLatin1(" dbname='%1'").arg(m_migrateData->sourceName);
+ conninfo += TQString::tqfromLatin1(" dbname='%1'").tqarg(m_migrateData->sourceName);
if (!m_migrateData->source->userName.isNull())
- conninfo += QString::fromLatin1(" user='%1'").arg(m_migrateData->source->userName);
+ conninfo += TQString::tqfromLatin1(" user='%1'").tqarg(m_migrateData->source->userName);
if (!m_migrateData->source->password.isNull())
- conninfo += QString::fromLatin1(" password='%1'").arg(m_migrateData->source->password);
+ conninfo += TQString::tqfromLatin1(" password='%1'").tqarg(m_migrateData->source->password);
try
{
@@ -257,7 +257,7 @@ bool PqxxMigrate::drv_disconnect()
}
//==================================================================================
//Perform a query on the database and store result in m_res
-bool PqxxMigrate::query(const QString& statement)
+bool PqxxMigrate::query(const TQString& statement)
{
kdDebug() << "query: " << statement.latin1() << endl;
@@ -303,10 +303,10 @@ void PqxxMigrate::clearResultInfo()
//=========================================================================
//Return the OID for a table
-pqxx::oid PqxxMigrate::tableOid(const QString& table)
+pqxx::oid PqxxMigrate::tableOid(const TQString& table)
{
- QString statement;
- static QString otable;
+ TQString statement;
+ static TQString otable;
static pqxx::oid toid;
pqxx::nontransaction* tran = 0;
@@ -368,7 +368,7 @@ pqxx::oid PqxxMigrate::tableOid(const QString& table)
//TODO: Add result caching for speed
bool PqxxMigrate::primaryKey(pqxx::oid table_uid, int col) const
{
- QString statement;
+ TQString statement;
bool pkey;
int keyf;
@@ -377,7 +377,7 @@ bool PqxxMigrate::primaryKey(pqxx::oid table_uid, int col) const
try
{
- statement = QString("SELECT indkey FROM pg_index WHERE ((indisprimary = true) AND (indrelid = %1))").arg(table_uid);
+ statement = TQString("SELECT indkey FROM pg_index WHERE ((indisprimary = true) AND (indrelid = %1))").tqarg(table_uid);
tran = new pqxx::nontransaction(*m_conn, "find_pkey");
tmpres = new pqxx::result(tran->exec(statement.latin1()));
@@ -425,7 +425,7 @@ bool PqxxMigrate::primaryKey(pqxx::oid table_uid, int col) const
On success the result is stored in \a string and true is returned.
\return cancelled if there are no records available. */
tristate PqxxMigrate::drv_queryStringListFromSQL(
- const QString& sqlStatement, uint columnNumber, QStringList& stringList, int numRecords)
+ const TQString& sqlStatement, uint columnNumber, TQStringList& stringList, int numRecords)
{
std::string result;
int i = 0;
@@ -436,7 +436,7 @@ tristate PqxxMigrate::drv_queryStringListFromSQL(
{
if (it.size() > 0 && it.size() > columnNumber) {
it.at(columnNumber).to(result);
- stringList.append( QString::fromUtf8(result.c_str()) );
+ stringList.append( TQString::fromUtf8(result.c_str()) );
}
else {
clearResultInfo();
@@ -480,7 +480,7 @@ tristate PqxxMigrate::drv_queryStringListFromSQL(
mysql_free_result(res);
return false;
}
- string = QString::fromLatin1(row[columnNumber], lengths[columnNumber]);
+ string = TQString::tqfromLatin1(row[columnNumber], lengths[columnNumber]);
mysql_free_result(res);
} else {
kdDebug() << "PqxxMigrate::drv_querySingleStringFromSQL(): null result" << endl;
@@ -491,7 +491,7 @@ tristate PqxxMigrate::drv_queryStringListFromSQL(
}*/
}
-tristate PqxxMigrate::drv_fetchRecordFromSQL(const QString& sqlStatement,
+tristate PqxxMigrate::drv_fetchRecordFromSQL(const TQString& sqlStatement,
KexiDB::RowData& data, bool &firstRecord)
{
if (firstRecord || !m_res) {
@@ -520,7 +520,7 @@ tristate PqxxMigrate::drv_fetchRecordFromSQL(const QString& sqlStatement,
//=========================================================================
/*! Copy PostgreSQL table to KexiDB database */
-bool PqxxMigrate::drv_copyTable(const QString& srcTable, KexiDB::Connection *destConn,
+bool PqxxMigrate::drv_copyTable(const TQString& srcTable, KexiDB::Connection *destConn,
KexiDB::TableSchema* dstTable)
{
std::vector<std::string> R;
@@ -533,7 +533,7 @@ bool PqxxMigrate::drv_copyTable(const QString& srcTable, KexiDB::Connection *des
const KexiDB::QueryColumnInfo::Vector fieldsExpanded( dstTable->query()->fieldsExpanded() );
for (int n=0; (stream >> R); ++n)
{
- QValueList<QVariant> vals;
+ TQValueList<TQVariant> vals;
std::vector<std::string>::const_iterator i, end( R.end() );
int index = 0;
for ( i = R.begin(); i != end; ++i, index++) {
@@ -560,7 +560,7 @@ bool PqxxMigrate::drv_copyTable(const QString& srcTable, KexiDB::Connection *des
//TODO: Add result caching for speed
bool PqxxMigrate::uniqueKey(pqxx::oid table_uid, int col) const
{
- QString statement;
+ TQString statement;
bool ukey;
int keyf;
@@ -569,7 +569,7 @@ bool PqxxMigrate::uniqueKey(pqxx::oid table_uid, int col) const
try
{
- statement = QString("SELECT indkey FROM pg_index WHERE ((indisunique = true) AND (indrelid = %1))").arg(table_uid);
+ statement = TQString("SELECT indkey FROM pg_index WHERE ((indisunique = true) AND (indrelid = %1))").tqarg(table_uid);
tran = new pqxx::nontransaction(*m_conn, "find_ukey");
tmpres = new pqxx::result(tran->exec(statement.latin1()));
@@ -635,7 +635,7 @@ bool PqxxMigrate::notEmpty(pqxx::oid /*table_uid*/, int /*col*/) const
//==================================================================================
//Return a list of database names
-/*bool PqxxMigrate::drv_getDatabasesList( QStringList &list )
+/*bool PqxxMigrate::drv_getDatabasesList( TQStringList &list )
{
KexiDBDrvDbg << "pqxxSqlConnection::drv_getDatabaseList" << endl;
@@ -647,7 +647,7 @@ bool PqxxMigrate::notEmpty(pqxx::oid /*table_uid*/, int /*col*/) const
// 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());
KexiDBDrvDbg << N.c_str() << endl;
}
return true;