summaryrefslogtreecommitdiffstats
path: root/kmymoney2/mymoney/storage/mymoneystoragesql.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kmymoney2/mymoney/storage/mymoneystoragesql.cpp')
-rw-r--r--kmymoney2/mymoney/storage/mymoneystoragesql.cpp1178
1 files changed, 585 insertions, 593 deletions
diff --git a/kmymoney2/mymoney/storage/mymoneystoragesql.cpp b/kmymoney2/mymoney/storage/mymoneystoragesql.cpp
index 97b4c55..34c9573 100644
--- a/kmymoney2/mymoney/storage/mymoneystoragesql.cpp
+++ b/kmymoney2/mymoney/storage/mymoneystoragesql.cpp
@@ -22,12 +22,12 @@
// ----------------------------------------------------------------------------
// QT Includes
-#include <qstring.h>
-#include <qdatetime.h>
-#include <qvaluelist.h>
-#include <qstringlist.h>
-#include <qiodevice.h>
-#include <qsqldriver.h>
+#include <tqstring.h>
+#include <tqdatetime.h>
+#include <tqvaluelist.h>
+#include <tqstringlist.h>
+#include <tqiodevice.h>
+#include <tqsqldriver.h>
// ----------------------------------------------------------------------------
// KDE Includes
@@ -52,60 +52,52 @@
//***************** THE CURRENT VERSION OF THE DATABASE LAYOUT ****************
unsigned int MyMoneyDbDef::m_currentVersion = 6;
-// subclass QSqlQuery for performance tracing
+// subclass TQSqlQuery for performance tracing
MyMoneySqlQuery::MyMoneySqlQuery (MyMoneyStorageSql* db)
- : QSqlQuery (static_cast<QSqlDatabase*>(db)) {
+ : TQSqlQuery (static_cast<TQSqlDatabase*>(db)) {
m_db = db;
}
bool MyMoneySqlQuery::exec () {
- TRACE(QString("start sql - %1").arg(lastQuery()));
- bool rc = QSqlQuery::exec();
- QString msg("end sql\n%1\n***Query returned %2, row count %3");
- TRACE (msg.arg(QSqlQuery::executedQuery()).arg(rc).arg(numRowsAffected()));
- //DBG (QString("%1\n***Query returned %2, row count %3").arg(QSqlQuery::executedQuery()).arg(rc).arg(size()));
+ TRACE(TQString("start sql - %1").tqarg(lastQuery()));
+ bool rc = TQSqlQuery::exec();
+ TQString msg("end sql\n%1\n***Query returned %2, row count %3");
+ TRACE (msg.tqarg(TQSqlQuery::executedQuery()).tqarg(rc).tqarg(numRowsAffected()));
+ //DBG (TQString("%1\n***Query returned %2, row count %3").tqarg(TQSqlQuery::executedQuery()).tqarg(rc).tqarg(size()));
return (rc);
}
-bool MyMoneySqlQuery::prepare ( const QString & query ) {
+bool MyMoneySqlQuery::prepare ( const TQString & query ) {
if (m_db->isSqlite3()) {
- QString newQuery = query;
- return (QSqlQuery::prepare (newQuery.replace("FOR UPDATE", "")));
+ TQString newQuery = query;
+ return (TQSqlQuery::prepare (newQuery.tqreplace("FOR UPDATE", "")));
}
- return (QSqlQuery::prepare (query));
+ return (TQSqlQuery::prepare (query));
}
//*****************************************************************************
MyMoneyDbDrivers::MyMoneyDbDrivers () {
- m_driverMap["QDB2"] = QString("IBM DB2");
- m_driverMap["QIBASE"] = QString("Borland Interbase");
- m_driverMap["QMYSQL3"] = QString("MySQL");
- m_driverMap["QOCI8"] = QString("Oracle Call Interface, version 8 and 9");
- m_driverMap["QODBC3"] = QString("Open Database Connectivity");
- m_driverMap["QPSQL7"] = QString("PostgreSQL v6.x and v7.x");
- m_driverMap["QTDS7"] = QString("Sybase Adaptive Server and Microsoft SQL Server");
-#if QT_VERSION < 0x040000
- m_driverMap["QSQLITE3"] = QString("SQLite Version 3");
-#else
- m_driverMap["QSQLITE"] = QString("SQLite Version 3");
-#endif
-}
-
-databaseTypeE MyMoneyDbDrivers::driverToType (const QString& driver) const {
- if (driver == "QDB2") return(Db2);
- else if (driver == "QIBASE") return(Interbase);
- else if (driver == "QMYSQL3") return(Mysql);
- else if (driver == "QOCI8") return(Oracle8);
- else if (driver == "QODBC3") return(ODBC3);
- else if (driver == "QPSQL7") return(Postgresql);
- else if (driver == "QTDS7") return(Sybase);
-#if QT_VERSION < 0x040000
- else if (driver == "QSQLITE3") return(Sqlite3);
-#else
- else if (driver == "QSQLITE") return(Sqlite3);
-#endif
- else throw new MYMONEYEXCEPTION (QString("Unknown database driver type").arg(driver));
+ m_driverMap["TQDB2"] = TQString("IBM DB2");
+ m_driverMap["TQIBASE"] = TQString("Borland Interbase");
+ m_driverMap["TQMYSQL3"] = TQString("MySQL");
+ m_driverMap["TQOCI8"] = TQString("Oracle Call Interface, version 8 and 9");
+ m_driverMap["TQODBC3"] = TQString("Open Database Connectivity");
+ m_driverMap["TQPSQL7"] = TQString("PostgreSQL v6.x and v7.x");
+ m_driverMap["TQTDS7"] = TQString("Sybase Adaptive Server and Microsoft SQL Server");
+ m_driverMap["TQSQLITE3"] = TQString("SQLite Version 3");
+}
+
+databaseTypeE MyMoneyDbDrivers::driverToType (const TQString& driver) const {
+ if (driver == "TQDB2") return(Db2);
+ else if (driver == "TQIBASE") return(Interbase);
+ else if (driver == "TQMYSQL3") return(Mysql);
+ else if (driver == "TQOCI8") return(Oracle8);
+ else if (driver == "TQODBC3") return(ODBC3);
+ else if (driver == "TQPSQL7") return(Postgresql);
+ else if (driver == "TQTDS7") return(Sybase);
+ else if (driver == "TQSQLITE3") return(Sqlite3);
+ else throw new MYMONEYEXCEPTION (TQString("Unknown database driver type").tqarg(driver));
}
bool MyMoneyDbDrivers::isTested (databaseTypeE dbType) const {
@@ -122,11 +114,11 @@ bool MyMoneyDbDrivers::isTested (databaseTypeE dbType) const {
//************************ Constructor/Destructor *****************************
MyMoneyStorageSql::MyMoneyStorageSql (IMyMoneySerialize *storage, const KURL& url)
- : QSqlDatabase (url.queryItem("driver"), QString("kmmdatabase")) {
+ : TQSqlDatabase (url.queryItem("driver"), TQString("kmmdatabase")) {
DBG("*** Entering MyMoneyStorageSql::MyMoneyStorageSql");
m_dbVersion = 0;
m_progressCallback = 0;
- m_displayStatus = false;
+ m_displaytqStatus = false;
m_storage = storage;
m_storagePtr = dynamic_cast<IMyMoneyStorage*>(storage);
m_newDatabase = false;
@@ -140,15 +132,15 @@ int MyMoneyStorageSql::open(const KURL& url, int openMode, bool clear) {
DBG("*** Entering MyMoneyStorageSql::open");
try {
int rc = 0;
- QString driverName = url.queryItem("driver");
+ TQString driverName = url.queryItem("driver");
m_dbType = m_drivers.driverToType(driverName);
//get the input options
- QStringList options = QStringList::split(',', url.queryItem("options"));
- m_loadAll = options.contains("loadAll")/*|| m_mode == 0*/;
- m_override = options.contains("override");
+ TQStringList options = TQStringList::split(',', url.queryItem("options"));
+ m_loadAll = options.tqcontains("loadAll")/*|| m_mode == 0*/;
+ m_override = options.tqcontains("override");
// create the database connection
- QString dbName = url.path().right(url.path().length() - 1); // remove separator slash
+ TQString dbName = url.path().right(url.path().length() - 1); // remove separator slash
setDatabaseName(dbName);
setHostName(url.host());
setUserName(url.user());
@@ -156,7 +148,7 @@ try {
switch (openMode) {
case IO_ReadOnly: // OpenDatabase menu entry (or open last file)
case IO_ReadWrite: // Save menu entry with database open
- if (!QSqlDatabase::open()) {
+ if (!TQSqlDatabase::open()) {
buildError(MyMoneySqlQuery(), __func__, "opening database");
rc = 1;
} else {
@@ -167,11 +159,11 @@ try {
// Try to open the database.
// If that fails, try to create the database, then try to open it again.
m_newDatabase = true;
- if (!QSqlDatabase::open()) {
+ if (!TQSqlDatabase::open()) {
if (createDatabase(url) != 0) {
rc = 1;
} else {
- if (!QSqlDatabase::open()) {
+ if (!TQSqlDatabase::open()) {
buildError(MyMoneySqlQuery(), __func__, "opening new database");
rc = 1;
} else {
@@ -190,7 +182,7 @@ try {
}
break;
default:
- qFatal("%s", QString("%1 - unknown open mode %2").arg(__func__).arg(openMode).data());
+ qFatal("%s", TQString("%1 - unknown open mode %2").tqarg(__func__).tqarg(openMode).data());
}
if (rc != 0) return (rc);
// bypass logon check if we are creating a database
@@ -198,21 +190,21 @@ try {
// check if the database is locked, if not lock it
readFileInfo();
if (!m_logonUser.isEmpty() && (!m_override)) {
- m_error = QString
- (i18n("Database apparently in use\nOpened by %1 on %2 at %3.\nOpen anyway?"))
- .arg(m_logonUser)
- .arg(m_logonAt.date().toString(Qt::ISODate))
- .arg(m_logonAt.time().toString("hh.mm.ss"));
+ m_error = TQString
+ (i18n("Database aptqparently in use\nOpened by %1 on %2 at %3.\nOpen anyway?"))
+ .tqarg(m_logonUser)
+ .tqarg(m_logonAt.date().toString(Qt::ISODate))
+ .tqarg(m_logonAt.time().toString("hh.mm.ss"));
qDebug("%s", m_error.data());
close(false);
rc = -1;
} else {
m_logonUser = url.user() + "@" + url.host();
- m_logonAt = QDateTime::currentDateTime();
+ m_logonAt = TQDateTime::tqcurrentDateTime();
writeFileInfo();
}
return(rc);
-} catch (QString& s) {
+} catch (TQString& s) {
qDebug("%s",s.data());
return (1);
}
@@ -220,15 +212,15 @@ try {
void MyMoneyStorageSql::close(bool logoff) {
DBG("*** Entering MyMoneyStorageSql::close");
- if (QSqlDatabase::open()) {
+ if (TQSqlDatabase::open()) {
if (logoff) {
startCommitUnit(__func__);
- m_logonUser = QString();
+ m_logonUser = TQString();
writeFileInfo();
endCommitUnit(__func__);
}
- QSqlDatabase::close();
- QSqlDatabase::removeDatabase(this);
+ TQSqlDatabase::close();
+ TQSqlDatabase::removeDatabase(this);
}
}
@@ -237,32 +229,32 @@ int MyMoneyStorageSql::createDatabase (const KURL& url) {
if (m_dbType == Sqlite3) return(0); // not needed for sqlite
if (!m_dbType == Mysql) {
m_error =
- QString(i18n("Cannot currently create database for driver %1; please create manually")).arg(driverName());
+ TQString(i18n("Cannot currently create database for driver %1; please create manually")).tqarg(driverName());
return (1);
}
// create the database (only works for mysql at present)
- QString dbName = url.path().right(url.path().length() - 1); // remove separator slash
- QSqlDatabase *maindb = QSqlDatabase::addDatabase(driverName());
+ TQString dbName = url.path().right(url.path().length() - 1); // remove separator slash
+ TQSqlDatabase *maindb = TQSqlDatabase::addDatabase(driverName());
maindb->setDatabaseName ("mysql");
maindb->setHostName (url.host());
maindb->setUserName (url.user());
maindb->setPassword (url.pass());
maindb->open();
- QSqlQuery qm(maindb);
- QString qs = QString("CREATE DATABASE %1;").arg(dbName);
+ TQSqlQuery qm(maindb);
+ TQString qs = TQString("CREATE DATABASE %1;").tqarg(dbName);
qm.prepare (qs);
if (!qm.exec()) {
- buildError (qm, __func__, QString(i18n("Error in create database %1; do you have create permissions?")).arg(dbName));
+ buildError (qm, __func__, TQString(i18n("Error in create database %1; do you have create permissions?")).tqarg(dbName));
return (1);
}
- QSqlDatabase::removeDatabase (maindb);
+ TQSqlDatabase::removeDatabase (maindb);
return (0);
}
int MyMoneyStorageSql::upgradeDb() {
DBG("*** Entering MyMoneyStorageSql::upgradeDb");
- //signalProgress(0, 1, QObject::tr("Upgrading database..."));
+ //signalProgress(0, 1, TQObject::tr("Upgrading database..."));
MyMoneySqlQuery q(this);
q.prepare ("SELECT version FROM kmmFileInfo;");
if (!q.exec() || !q.next()) {
@@ -272,7 +264,7 @@ int MyMoneyStorageSql::upgradeDb() {
} else {
m_dbVersion = m_db.currentVersion();
m_storage->setFileFixVersion(m_storage->currentFixVersion());
- QSqlQuery q(this);
+ TQSqlQuery q(this);
q.prepare("UPDATE kmmFileInfo SET version = :version, \
fixLevel = :fixLevel;");
q.bindValue(":version", m_dbVersion);
@@ -286,8 +278,8 @@ int MyMoneyStorageSql::upgradeDb() {
}
// prior to dbv6, 'version' format was 'dbversion.fixLevel+1'
// as of dbv6, these are separate fields
- QString version = q.value(0).toString();
- if (version.contains('.')) {
+ TQString version = q.value(0).toString();
+ if (version.tqcontains('.')) {
m_dbVersion = q.value(0).toString().section('.', 0, 0).toUInt();
m_storage->setFileFixVersion(q.value(0).toString().section('.', 1, 1).toUInt() - 1);
} else {
@@ -333,8 +325,8 @@ int MyMoneyStorageSql::upgradeDb() {
}
}
// write updated version to DB
- //setVersion(QString("%1.%2").arg(m_dbVersion).arg(m_minorVersion));
- q.prepare (QString("UPDATE kmmFileInfo SET version = :version;"));
+ //setVersion(TQString("%1.%2").tqarg(m_dbVersion).tqarg(m_minorVersion));
+ q.prepare (TQString("UPDATE kmmFileInfo SET version = :version;"));
q.bindValue(":version", m_dbVersion);
if (!q.exec()) {
buildError (q, __func__, "Error updating db version");
@@ -346,8 +338,8 @@ int MyMoneyStorageSql::upgradeDb() {
// SF bug 2779291
// check whether a column appears in a table already; if not, add it
bool MyMoneyStorageSql::addColumn
- (const QString& table, const QString& col,
- const QString& after)
+ (const TQString& table, const TQString& col,
+ const TQString& after)
{
MyMoneyDbTable t = m_db.m_tables[table];
MyMoneyDbTable::field_iterator ft;
@@ -363,20 +355,20 @@ bool MyMoneyStorageSql::addColumn
bool MyMoneyStorageSql::addColumn
(const MyMoneyDbTable& t, const MyMoneyDbColumn& c,
- const QString& after){
+ const TQString& after){
if ((m_dbType == Sqlite3) && (!after.isEmpty()))
qFatal("sqlite doesn't support 'AFTER'; use sqliteAlterTable");
- if (record(t.name()).contains(c.name()))
+ if (record(t.name()).tqcontains(c.name()))
return (true);
- QSqlQuery q(this);
- QString afterString = ";";
+ TQSqlQuery q(this);
+ TQString afterString = ";";
if (!after.isEmpty())
- afterString = QString("AFTER %1;").arg(after);
+ afterString = TQString("AFTER %1;").tqarg(after);
q.prepare("ALTER TABLE " + t.name() + " ADD COLUMN " +
c.generateDDL(m_dbType) + afterString);
if (!q.exec()) {
buildError (q, __func__,
- QString("Error adding column %1 to table %2").arg(c.name()).arg(t.name()));
+ TQString("Error adding column %1 to table %2").tqarg(c.name()).tqarg(t.name()));
return (false);
}
return (true);
@@ -384,23 +376,23 @@ bool MyMoneyStorageSql::addColumn
// analogous to above
bool MyMoneyStorageSql::dropColumn
- (const QString& table, const QString& col)
+ (const TQString& table, const TQString& col)
{
return (dropColumn(m_db.m_tables[table], col));
}
bool MyMoneyStorageSql::dropColumn
- (const MyMoneyDbTable& t, const QString& col){
+ (const MyMoneyDbTable& t, const TQString& col){
if (m_dbType == Sqlite3)
qFatal("sqlite doesn't support 'DROP COLUMN'; use sqliteAlterTable");
- if (!record(t.name()).contains(col))
+ if (!record(t.name()).tqcontains(col))
return (true);
- QSqlQuery q(this);
+ TQSqlQuery q(this);
q.prepare("ALTER TABLE " + t.name() + " DROP COLUMN "
+ col + ";");
if (!q.exec()) {
buildError (q, __func__,
- QString("Error dropping column %1 from table %2").arg(col).arg(t.name()));
+ TQString("Error dropping column %1 from table %2").tqarg(col).tqarg(t.name()));
return (false);
}
return (true);
@@ -434,9 +426,9 @@ int MyMoneyStorageSql::upgradeToV1() {
buildError (q, __func__, "Error priming kmmSplits.postDate");
return (1);
}
- QMap<QString, QDateTime> tids;
+ TQMap<TQString, TQDateTime> tids;
while (q.next()) tids[q.value(0).toString()] = q.value(1).toDateTime();
- QMap<QString, QDateTime>::ConstIterator it;
+ TQMap<TQString, TQDateTime>::ConstIterator it;
for (it = tids.begin(); it != tids.end(); ++it) {
q.prepare ("UPDATE kmmSplits SET postDate=:postDate WHERE transactionId = :id;");
q.bindValue(":postDate", it.data().toString(Qt::ISODate));
@@ -447,7 +439,7 @@ int MyMoneyStorageSql::upgradeToV1() {
}
}
// add index to kmmKeyValuePairs to (kvpType,kvpId)
- QStringList list;
+ TQStringList list;
list << "kvpType" << "kvpId";
q.prepare (MyMoneyDbIndex("kmmKeyValuePairs", "kmmKVPtype_id", list, false).generateDDL(m_dbType) + ";");
if (!q.exec()) {
@@ -519,18 +511,18 @@ int MyMoneyStorageSql::upgradeToV1() {
buildError (q, __func__, "Error retrieving splits for transaction counting");
return(1);
}
- QString lastAcc, lastTx;
+ TQString lastAcc, lastTx;
while (q.next()) {
- QString thisAcc = q.value(0).toCString();
- QString thisTx = q.value(1).toCString();
+ TQString thisAcc = q.value(0).toCString();
+ TQString thisTx = q.value(1).toCString();
if ((thisAcc != lastAcc) || (thisTx != lastTx)) ++m_transactionCountMap[thisAcc];
lastAcc = thisAcc;
lastTx = thisTx;
}
- QMap<QString, unsigned long>::ConstIterator itm;
+ TQMap<TQString, unsigned long>::ConstIterator itm;
q.prepare("UPDATE kmmAccounts SET transactionCount = :txCount WHERE id = :id;");
for (itm = m_transactionCountMap.begin(); itm != m_transactionCountMap.end(); ++itm) {
- q.bindValue (":txCount", QString::number(itm.data()));
+ q.bindValue (":txCount", TQString::number(itm.data()));
q.bindValue (":id", itm.key());
if (!q.exec()) {
buildError(q, __func__, "Error updating transaction count");
@@ -606,7 +598,7 @@ int MyMoneyStorageSql::upgradeToV4() {
DBG("*** Entering MyMoneyStorageSql::upgradeToV4");
startCommitUnit(__func__);
MyMoneySqlQuery q(this);
- QStringList list;
+ TQStringList list;
list << "transactionId" << "splitId";
q.prepare (MyMoneyDbIndex("kmmSplits", "kmmTx_Split", list, false).generateDDL(m_dbType) + ";");
if (!q.exec()) {
@@ -664,8 +656,8 @@ int MyMoneyStorageSql::upgradeToV6() {
return (1);
// upgrade Mysql to InnoDB transaction-safe engine
if (m_dbType == Mysql) {
- for (QMapConstIterator<QString, MyMoneyDbTable> tt = m_db.tableBegin(); tt != m_db.tableEnd(); ++tt) {
- q.prepare(QString("ALTER TABLE %1 ENGINE = InnoDB;").arg(tt.data().name()));
+ for (TQMapConstIterator<TQString, MyMoneyDbTable> tt = m_db.tableBegin(); tt != m_db.tableEnd(); ++tt) {
+ q.prepare(TQString("ALTER TABLE %1 ENGINE = InnoDB;").tqarg(tt.data().name()));
if (!q.exec()) {
buildError (q, __func__, "Error updating to InnoDB");
return (1);
@@ -678,7 +670,7 @@ int MyMoneyStorageSql::upgradeToV6() {
return(1);
// read and write reports to get ids inserted
readFileInfo();
- QMap<QString, MyMoneyReport> reportList =
+ TQMap<TQString, MyMoneyReport> reportList =
fetchReports();
// the V5 database allowed lots of duplicate reports with no
// way to distinguish between them. The fetchReports call
@@ -690,7 +682,7 @@ int MyMoneyStorageSql::upgradeToV6() {
return (1);
}
unsigned long long hiReportId = 0;
- QMap<QString, MyMoneyReport>::const_iterator it_r;
+ TQMap<TQString, MyMoneyReport>::const_iterator it_r;
for(it_r = reportList.begin(); it_r != reportList.end(); ++it_r) {
MyMoneyReport r = *it_r;
hiReportId = calcHighId(hiReportId, r.id());
@@ -719,22 +711,22 @@ int MyMoneyStorageSql::upgradeToV6() {
statement. It should enable us to drop a primary key, and drop columns */
bool MyMoneyStorageSql::sqliteAlterTable(const MyMoneyDbTable& t) {
DBG("*** Entering MyMoneyStorageSql::sqliteAlterTable");
- QString tempTableName = t.name();
- tempTableName.replace("kmm", "tmp");
- QSqlQuery q(this);
- q.prepare (QString("ALTER TABLE " + t.name() + " RENAME TO " + tempTableName + ";"));
+ TQString tempTableName = t.name();
+ tempTableName.tqreplace("kmm", "tmp");
+ TQSqlQuery q(this);
+ q.prepare (TQString("ALTER TABLE " + t.name() + " RENAME TO " + tempTableName + ";"));
if (!q.exec()) {
buildError (q, __func__, "Error renaming table");
return false;
}
createTable(t);
- q.prepare (QString("INSERT INTO " + t.name() + " (" + t.columnList() +
+ q.prepare (TQString("INSERT INTO " + t.name() + " (" + t.columnList() +
") SELECT " + t.columnList() + " FROM " + tempTableName + ";"));
if (!q.exec()) {
buildError (q, __func__, "Error inserting into new table");
return false;
}
- q.prepare (QString("DROP TABLE " + tempTableName + ";"));
+ q.prepare (TQString("DROP TABLE " + tempTableName + ";"));
if (!q.exec()) {
buildError (q, __func__, "Error dropping old table");
return false;
@@ -742,10 +734,10 @@ bool MyMoneyStorageSql::sqliteAlterTable(const MyMoneyDbTable& t) {
return true;
}
-long unsigned MyMoneyStorageSql::getRecCount (const QString& table) const {
+long unsigned MyMoneyStorageSql::getRecCount (const TQString& table) const {
DBG("*** Entering MyMoneyStorageSql::getRecCount");
MyMoneySqlQuery q(const_cast <MyMoneyStorageSql*> (this));
- q.prepare(QString("SELECT COUNT(*) FROM %1;").arg(table));
+ q.prepare(TQString("SELECT COUNT(*) FROM %1;").tqarg(table));
if ((!q.exec()) || (!q.next())) {
buildError (q, __func__, "error retrieving record count");
qFatal("Error retrieving record count"); // definitely shouldn't happen
@@ -758,20 +750,20 @@ int MyMoneyStorageSql::createTables () {
// check tables, create if required
// convert everything to lower case, since SQL standard is case insensitive
// table and column names (when not delimited), but some DBMSs disagree.
- QStringList lowerTables = tables(QSql::AllTables);
- for (QStringList::iterator i = lowerTables.begin(); i != lowerTables.end(); ++i) {
+ TQStringList lowerTables = tables(TQSql::AllTables);
+ for (TQStringList::iterator i = lowerTables.begin(); i != lowerTables.end(); ++i) {
(*i) = (*i).lower();
}
- for (QMapConstIterator<QString, MyMoneyDbTable> tt = m_db.tableBegin(); tt != m_db.tableEnd(); ++tt) {
- if (!lowerTables.contains(tt.key().lower())) createTable (tt.data());
+ for (TQMapConstIterator<TQString, MyMoneyDbTable> tt = m_db.tableBegin(); tt != m_db.tableEnd(); ++tt) {
+ if (!lowerTables.tqcontains(tt.key().lower())) createTable (tt.data());
}
MyMoneySqlQuery q(this);
- for (QMapConstIterator<QString, MyMoneyDbView> tt = m_db.viewBegin(); tt != m_db.viewEnd(); ++tt) {
- if (!lowerTables.contains(tt.key().lower())) {
+ for (TQMapConstIterator<TQString, MyMoneyDbView> tt = m_db.viewBegin(); tt != m_db.viewEnd(); ++tt) {
+ if (!lowerTables.tqcontains(tt.key().lower())) {
q.prepare (tt.data().createString());
- if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, QString ("creating view %1").arg(tt.key())));
+ if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString ("creating view %1").tqarg(tt.key())));
}
}
@@ -784,22 +776,22 @@ int MyMoneyStorageSql::createTables () {
void MyMoneyStorageSql::createTable (const MyMoneyDbTable& t) {
DBG("*** Entering MyMoneyStorageSql::createTable");
// create the tables
- QStringList ql = QStringList::split('\n', t.generateCreateSQL(m_dbType));
+ TQStringList ql = TQStringList::split('\n', t.generateCreateSQL(m_dbType));
MyMoneySqlQuery q(this);
for (unsigned int i = 0; i < ql.count(); ++i) {
q.prepare (ql[i]);
- if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, QString ("creating table/index %1").arg(t.name())));
+ if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString ("creating table/index %1").tqarg(t.name())));
}
}
int MyMoneyStorageSql::isEmpty () {
DBG("*** Entering MyMoneyStorageSql::isEmpty");
// check all tables are empty
- QMapConstIterator<QString, MyMoneyDbTable> tt = m_db.tableBegin();
+ TQMapConstIterator<TQString, MyMoneyDbTable> tt = m_db.tableBegin();
int recordCount = 0;
MyMoneySqlQuery q(this);
while ((tt != m_db.tableEnd()) && (recordCount == 0)) {
- q.prepare (QString("select count(*) from %1;").arg((*tt).name()));
+ q.prepare (TQString("select count(*) from %1;").tqarg((*tt).name()));
if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, "getting record count"));
if (!q.next()) throw new MYMONEYEXCEPTION(buildError (q, __func__, "retrieving record count"));
recordCount += q.value(0).toInt();
@@ -816,11 +808,11 @@ int MyMoneyStorageSql::isEmpty () {
void MyMoneyStorageSql::clean() {
DBG("*** Entering MyMoneyStorageSql::clean");
// delete all existing records
- QMapConstIterator<QString, MyMoneyDbTable> it = m_db.tableBegin();
+ TQMapConstIterator<TQString, MyMoneyDbTable> it = m_db.tableBegin();
MyMoneySqlQuery q(this);
while (it != m_db.tableEnd()) {
- q.prepare(QString("DELETE from %1;").arg(it.key()));
- if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, QString ("cleaning database")));
+ q.prepare(TQString("DELETE from %1;").tqarg(it.key()));
+ if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString ("cleaning database")));
++it;
}
}
@@ -829,15 +821,15 @@ void MyMoneyStorageSql::clean() {
bool MyMoneyStorageSql::readFile(void) {
DBG("*** Entering MyMoneyStorageSql::readFile");
- m_displayStatus = true;
+ m_displaytqStatus = true;
try {
readFileInfo();
readInstitutions();
if (m_loadAll) {
readPayees();
} else {
- QValueList<QString> user;
- user.append(QString("USER"));
+ TQValueList<TQString> user;
+ user.append(TQString("USER"));
readPayees(user);
}
//TRACE("done payees");
@@ -868,10 +860,10 @@ bool MyMoneyStorageSql::readFile(void) {
// FIXME?? if (m_mode == 0) m_storage = NULL;
// make sure the progress bar is not shown any longer
signalProgress(-1, -1);
- m_displayStatus = false;
+ m_displaytqStatus = false;
//MyMoneySqlQuery::traceOn();
return true;
- } catch (QString& s) {
+ } catch (TQString& s) {
return false;
}
}
@@ -884,7 +876,7 @@ bool MyMoneyStorageSql::writeFile(void) {
= m_securities = m_prices = m_currencies = m_schedules = m_reports = m_kvps = m_budgets = 0;
m_hiIdInstitutions = m_hiIdPayees = m_hiIdAccounts = m_hiIdTransactions =
m_hiIdSchedules = m_hiIdSecurities = m_hiIdReports = m_hiIdBudgets = 0;
- m_displayStatus = true;
+ m_displaytqStatus = true;
try{
startCommitUnit(__func__);
writeInstitutions ();
@@ -905,14 +897,14 @@ bool MyMoneyStorageSql::writeFile(void) {
endCommitUnit(__func__);
// make sure the progress bar is not shown any longer
signalProgress(-1, -1);
- m_displayStatus = false;
+ m_displaytqStatus = false;
return true;
-} catch (QString& s) {
+} catch (TQString& s) {
return false;
}
}
// --------------- SQL Transaction (commit unit) handling -----------------------------------
-void MyMoneyStorageSql::startCommitUnit (const QString& callingFunction) {
+void MyMoneyStorageSql::startCommitUnit (const TQString& callingFunction) {
DBG("*** Entering MyMoneyStorageSql::startCommitUnit");
if (m_commitUnitStack.isEmpty()) {
if (!transaction()) throw new MYMONEYEXCEPTION(buildError (MyMoneySqlQuery(), __func__, "starting commit unit"));
@@ -920,16 +912,16 @@ void MyMoneyStorageSql::startCommitUnit (const QString& callingFunction) {
m_commitUnitStack.push(callingFunction);
}
-bool MyMoneyStorageSql::endCommitUnit (const QString& callingFunction) {
+bool MyMoneyStorageSql::endCommitUnit (const TQString& callingFunction) {
DBG("*** Entering MyMoneyStorageSql::endCommitUnit");
// for now, we don't know if there were any changes made to the data so
// we expect the data to have changed. This assumption causes some unnecessary
- // repaints of the UI here and there, but for now it's ok. If we can determine
+ // tqrepaints of the UI here and there, but for now it's ok. If we can determine
// that the commit() really changes the data, we can return that information
// as value of this method.
bool rc = true;
if (callingFunction != m_commitUnitStack.top())
- qDebug("%s", QString("%1 - %2 s/be %3").arg(__func__).arg(callingFunction).arg(m_commitUnitStack.top()).data());
+ qDebug("%s", TQString("%1 - %2 s/be %3").tqarg(__func__).tqarg(callingFunction).tqarg(m_commitUnitStack.top()).data());
m_commitUnitStack.pop();
if (m_commitUnitStack.isEmpty()) {
if (!commit()) throw new MYMONEYEXCEPTION(buildError (MyMoneySqlQuery(), __func__, "ending commit unit"));
@@ -937,10 +929,10 @@ bool MyMoneyStorageSql::endCommitUnit (const QString& callingFunction) {
return rc;
}
-void MyMoneyStorageSql::cancelCommitUnit (const QString& callingFunction) {
+void MyMoneyStorageSql::cancelCommitUnit (const TQString& callingFunction) {
DBG("*** Entering MyMoneyStorageSql::cancelCommitUnit");
if (callingFunction != m_commitUnitStack.top())
- qDebug("%s", QString("%1 - %2 s/be %3").arg(__func__).arg(callingFunction).arg(m_commitUnitStack.top()).data());
+ qDebug("%s", TQString("%1 - %2 s/be %3").tqarg(__func__).tqarg(callingFunction).tqarg(m_commitUnitStack.top()).data());
if (m_commitUnitStack.isEmpty()) return;
m_commitUnitStack.clear();
if (!rollback()) throw new MYMONEYEXCEPTION(buildError (MyMoneySqlQuery(), __func__, "cancelling commit unit"));
@@ -967,20 +959,20 @@ void MyMoneyStorageSql::writeInstitutions() {
// one way would be to build the lists when reading the db
// unfortunately this object does not persist between read and write
// it would also be nice if we could tell which objects had been updated since we read them in
- QValueList<QString> dbList;
+ TQValueList<TQString> dbList;
MyMoneySqlQuery q(this);
q.prepare("SELECT id FROM kmmInstitutions;");
if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, "building Institution list"));
while (q.next()) dbList.append(q.value(0).toString());
- const QValueList<MyMoneyInstitution> list = m_storage->institutionList();
- QValueList<MyMoneyInstitution>::ConstIterator it;
+ const TQValueList<MyMoneyInstitution> list = m_storage->institutionList();
+ TQValueList<MyMoneyInstitution>::ConstIterator it;
MyMoneySqlQuery q2(this);
q.prepare (m_db.m_tables["kmmInstitutions"].updateString());
q2.prepare (m_db.m_tables["kmmInstitutions"].insertString());
signalProgress(0, list.count(), "Writing Institutions...");
for(it = list.begin(); it != list.end(); ++it) {
- if (dbList.contains((*it).id())) {
+ if (dbList.tqcontains((*it).id())) {
dbList.remove ((*it).id());
writeInstitution(*it, q);
} else {
@@ -990,7 +982,7 @@ void MyMoneyStorageSql::writeInstitutions() {
}
if (!dbList.isEmpty()) {
- QValueList<QString>::const_iterator it = dbList.begin();
+ TQValueList<TQString>::const_iterator it = dbList.begin();
q.prepare("DELETE FROM kmmInstitutions WHERE id = :id");
while (it != dbList.end()) {
q.bindValue(":id", (*it));
@@ -1030,7 +1022,7 @@ void MyMoneyStorageSql::removeInstitution(const MyMoneyInstitution& inst) {
MyMoneySqlQuery q(this);
q.prepare (m_db.m_tables["kmmInstitutions"].deleteString());
q.bindValue(":id", inst.id());
- if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, QString("deleting Institution")));
+ if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString("deleting Institution")));
--m_institutions;
writeFileInfo();
endCommitUnit(__func__);
@@ -1046,7 +1038,7 @@ void MyMoneyStorageSql::writeInstitution(const MyMoneyInstitution& i, MyMoneySql
q.bindValue(":addressCity", i.city());
q.bindValue(":addressZipcode", i.postcode());
q.bindValue(":telephone", i.telephone());
- if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, QString("writing Institution")));
+ if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString("writing Institution")));
writeKeyValuePairs("OFXSETTINGS", i.id(), i.pairs());
m_hiIdInstitutions = calcHighId(m_hiIdInstitutions, i.id());
}
@@ -1055,22 +1047,22 @@ void MyMoneyStorageSql::writeInstitution(const MyMoneyInstitution& i, MyMoneySql
void MyMoneyStorageSql::writePayees() {
DBG("*** Entering MyMoneyStorageSql::writePayees");
// first, get a list of what's on the database (see writeInstitutions)
- QValueList<QString> dbList;
+ TQValueList<TQString> dbList;
MyMoneySqlQuery q(this);
q.prepare("SELECT id FROM kmmPayees;");
if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, "building Payee list"));
while (q.next()) dbList.append(q.value(0).toString());
- QValueList<MyMoneyPayee> list = m_storage->payeeList();
- MyMoneyPayee user(QString("USER"), m_storage->user());
+ TQValueList<MyMoneyPayee> list = m_storage->payeeList();
+ MyMoneyPayee user(TQString("USER"), m_storage->user());
list.prepend(user);
signalProgress(0, list.count(), "Writing Payees...");
MyMoneySqlQuery q2(this);
q.prepare (m_db.m_tables["kmmPayees"].updateString());
q2.prepare (m_db.m_tables["kmmPayees"].insertString());
- QValueList<MyMoneyPayee>::ConstIterator it;
+ TQValueList<MyMoneyPayee>::ConstIterator it;
for(it = list.begin(); it != list.end(); ++it) {
- if (dbList.contains((*it).id())) {
+ if (dbList.tqcontains((*it).id())) {
dbList.remove ((*it).id());
writePayee(*it, q);
} else {
@@ -1080,7 +1072,7 @@ void MyMoneyStorageSql::writePayees() {
}
if (!dbList.isEmpty()) {
- QValueList<QString>::const_iterator it = dbList.begin();
+ TQValueList<TQString>::const_iterator it = dbList.begin();
q.prepare(m_db.m_tables["kmmPayees"].deleteString());
while (it != dbList.end()) {
q.bindValue(":id", (*it));
@@ -1128,7 +1120,7 @@ void MyMoneyStorageSql::removePayee(const MyMoneyPayee& payee) {
MyMoneySqlQuery q(this);
q.prepare (m_db.m_tables["kmmPayees"].deleteString());
q.bindValue(":id", payee.id());
- if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, QString("deleting Payee")));
+ if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString("deleting Payee")));
--m_payees;
writeFileInfo();
endCommitUnit(__func__);
@@ -1152,13 +1144,13 @@ void MyMoneyStorageSql::writePayee(const MyMoneyPayee& p, MyMoneySqlQuery& q, bo
q.bindValue(":notes", p.notes());
q.bindValue(":defaultAccountId", p.defaultAccountId());
bool ignoreCase;
- QString matchKeys;
+ TQString matchKeys;
MyMoneyPayee::payeeMatchType type = p.matchData(ignoreCase, matchKeys);
q.bindValue(":matchData", static_cast<unsigned int>(type));
if (ignoreCase) q.bindValue(":matchIgnoreCase", "Y");
else q.bindValue(":matchIgnoreCase", "N");
q.bindValue(":matchKeys", matchKeys);
- if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, QString ("writing Payee")));
+ if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString ("writing Payee")));
if (!isUserInfo) m_hiIdPayees = calcHighId(m_hiIdPayees, p.id());
}
@@ -1166,15 +1158,15 @@ void MyMoneyStorageSql::writePayee(const MyMoneyPayee& p, MyMoneySqlQuery& q, bo
void MyMoneyStorageSql::writeAccounts() {
DBG("*** Entering MyMoneyStorageSql::writeAccounts");
// first, get a list of what's on the database (see writeInstitutions)
- QValueList<QString> dbList;
+ TQValueList<TQString> dbList;
MyMoneySqlQuery q(this);
q.prepare("SELECT id FROM kmmAccounts;");
if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, "building Account list"));
while (q.next()) dbList.append(q.value(0).toString());
- QValueList<MyMoneyAccount> list;
+ TQValueList<MyMoneyAccount> list;
m_storage->accountList(list);
- QValueList<MyMoneyAccount>::ConstIterator it;
+ TQValueList<MyMoneyAccount>::ConstIterator it;
signalProgress(0, list.count(), "Writing Accounts...");
if (dbList.isEmpty()) { // new table, insert standard accounts
q.prepare (m_db.m_tables["kmmAccounts"].insertString());
@@ -1216,7 +1208,7 @@ void MyMoneyStorageSql::writeAccounts() {
MyMoneyAccount acc_q;
acc_q.setAccountType(MyMoneyAccount::Equity);
acc_q.setName("Equity");
- MyMoneyAccount equity(STD_ACC_EQUITY, acc_q);
+ MyMoneyAccount equity(STD_ACC_ETQUITY, acc_q);
writeAccount(asset, q); ++m_accounts;
writeAccount(expense, q); ++m_accounts;
@@ -1232,7 +1224,7 @@ void MyMoneyStorageSql::writeAccounts() {
// Update the accounts that exist; insert the ones that do not.
for(it = list.begin(); it != list.end(); ++it, ++i) {
m_transactionCountMap[(*it).id()] = m_storagePtr->transactionCount((*it).id());
- if (dbList.contains((*it).id())) {
+ if (dbList.tqcontains((*it).id())) {
dbList.remove ((*it).id());
writeAccount(*it, q);
} else {
@@ -1243,7 +1235,7 @@ void MyMoneyStorageSql::writeAccounts() {
// Delete the accounts that are in the db but no longer in memory.
if (!dbList.isEmpty()) {
- QValueList<QString>::const_iterator it = dbList.begin();
+ TQValueList<TQString>::const_iterator it = dbList.begin();
q.prepare("DELETE FROM kmmAccounts WHERE id = :id");
while (it != dbList.end()) {
if (!m_storagePtr->isStandardAccount(*it)) {
@@ -1288,7 +1280,7 @@ void MyMoneyStorageSql::removeAccount(const MyMoneyAccount& acc) {
MyMoneySqlQuery q(this);
q.prepare (m_db.m_tables["kmmAccounts"].deleteString());
q.bindValue(":id", acc.id());
- if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, QString("deleting Account")));
+ if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString("deleting Account")));
--m_accounts;
writeFileInfo();
endCommitUnit(__func__);
@@ -1296,20 +1288,20 @@ void MyMoneyStorageSql::removeAccount(const MyMoneyAccount& acc) {
void MyMoneyStorageSql::writeAccount(const MyMoneyAccount& acc, MyMoneySqlQuery& q) {
DBG("*** Entering MyMoneyStorageSql::writeAccount");
- //MyMoneyMoney balance = m_storagePtr->balance(acc.id(), QDate());
+ //MyMoneyMoney balance = m_storagePtr->balance(acc.id(), TQDate());
q.bindValue(":id", acc.id());
q.bindValue(":institutionId", acc.institutionId());
- q.bindValue(":parentId", acc.parentAccountId());
- if (acc.lastReconciliationDate() == QDate())
+ q.bindValue(":tqparentId", acc.tqparentAccountId());
+ if (acc.lastReconciliationDate() == TQDate())
q.bindValue(":lastReconciled", acc.lastReconciliationDate());
else
- q.bindValue(":lastReconciled", acc.lastReconciliationDate().toString(Qt::ISODate));
+ q.bindValue(":lastReconciled", TQString(acc.lastReconciliationDate().toString(Qt::ISODate)));
q.bindValue(":lastModified", acc.lastModified());
- if (acc.openingDate() == QDate())
+ if (acc.openingDate() == TQDate())
q.bindValue(":openingDate", acc.openingDate());
else
- q.bindValue(":openingDate", acc.openingDate().toString(Qt::ISODate));
+ q.bindValue(":openingDate", TQString(acc.openingDate().toString(Qt::ISODate)));
q.bindValue(":accountNumber", acc.number());
q.bindValue(":accountType", acc.accountType());
@@ -1330,7 +1322,7 @@ void MyMoneyStorageSql::writeAccount(const MyMoneyAccount& acc, MyMoneySqlQuery&
//FIXME: Using exceptions for branching always feels like a kludge.
// Look for a better way.
TRY
- MyMoneyMoney bal = m_storagePtr->balance(acc.id(), QDate());
+ MyMoneyMoney bal = m_storagePtr->balance(acc.id(), TQDate());
q.bindValue(":balance", bal.toString());
q.bindValue(":balanceFormatted",
bal.formatMoney("", -1, false));
@@ -1341,8 +1333,8 @@ void MyMoneyStorageSql::writeAccount(const MyMoneyAccount& acc, MyMoneySqlQuery&
acc.balance().formatMoney("", -1, false));
ECATCH
- q.bindValue(":transactionCount", Q_ULLONG(m_transactionCountMap[acc.id()]));
- if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, QString("writing Account")));
+ q.bindValue(":transactionCount", TQ_ULLONG(m_transactionCountMap[acc.id()]));
+ if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString("writing Account")));
//Add in Key-Value Pairs for accounts.
//MMAccount inherits from KVPContainer AND has a KVPContainer member
@@ -1356,7 +1348,7 @@ void MyMoneyStorageSql::writeAccount(const MyMoneyAccount& acc, MyMoneySqlQuery&
void MyMoneyStorageSql::writeTransactions() {
DBG("*** Entering MyMoneyStorageSql::writeTransactions");
// first, get a list of what's on the database (see writeInstitutions)
- QValueList<QString> dbList;
+ TQValueList<TQString> dbList;
MyMoneySqlQuery q(this);
q.prepare("SELECT id FROM kmmTransactions WHERE txType = 'N';");
if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, "building Transaction list"));
@@ -1364,16 +1356,16 @@ void MyMoneyStorageSql::writeTransactions() {
MyMoneyTransactionFilter filter;
filter.setReportAllSplits(false);
- QValueList<MyMoneyTransaction> list;
+ TQValueList<MyMoneyTransaction> list;
m_storage->transactionList(list, filter);
signalProgress(0, list.count(), "Writing Transactions...");
- QValueList<MyMoneyTransaction>::ConstIterator it;
+ TQValueList<MyMoneyTransaction>::ConstIterator it;
int i = 0;
MyMoneySqlQuery q2(this);
q.prepare (m_db.m_tables["kmmTransactions"].updateString());
q2.prepare (m_db.m_tables["kmmTransactions"].insertString());
for(it = list.begin(); it != list.end(); ++it, ++i) {
- if (dbList.contains((*it).id())) {
+ if (dbList.tqcontains((*it).id())) {
dbList.remove ((*it).id());
writeTransaction((*it).id(), *it, q, "N");
} else {
@@ -1383,7 +1375,7 @@ void MyMoneyStorageSql::writeTransactions() {
}
if (!dbList.isEmpty()) {
- QValueList<QString>::const_iterator it = dbList.begin();
+ TQValueList<TQString>::const_iterator it = dbList.begin();
while (it != dbList.end()) {
deleteTransaction(*it);
++it;
@@ -1400,7 +1392,7 @@ void MyMoneyStorageSql::addTransaction (const MyMoneyTransaction& tx) {
writeTransaction(tx.id(), tx, q, "N");
++m_transactions;
// for each split account, update lastMod date, balance, txCount
- QValueList<MyMoneySplit>::ConstIterator it_s;
+ TQValueList<MyMoneySplit>::ConstIterator it_s;
for(it_s = tx.splits().begin(); it_s != tx.splits().end(); ++it_s) {
//MyMoneyAccount acc = m_storagePtr->account((*it_s).accountId());
MyMoneyAccount acc = MyMoneyFile::instance()->account((*it_s).accountId());
@@ -1421,14 +1413,14 @@ void MyMoneyStorageSql::modifyTransaction (const MyMoneyTransaction& tx) {
q.bindValue(":txId", tx.id());
if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, "retrieving old splits"));
while (q.next()) {
- QString id = q.value(0).toCString();
+ TQString id = q.value(0).toCString();
--m_transactionCountMap[id];
}
// add the transaction and splits
q.prepare (m_db.m_tables["kmmTransactions"].updateString());
writeTransaction(tx.id(), tx, q, "N");
// for each split account, update lastMod date, balance, txCount
- QValueList<MyMoneySplit>::ConstIterator it_s;
+ TQValueList<MyMoneySplit>::ConstIterator it_s;
for(it_s = tx.splits().begin(); it_s != tx.splits().end(); ++it_s) {
//MyMoneyAccount acc = m_storagePtr->account((*it_s).accountId());
MyMoneyAccount acc = MyMoneyFile::instance()->account((*it_s).accountId());
@@ -1448,7 +1440,7 @@ void MyMoneyStorageSql::removeTransaction(const MyMoneyTransaction& tx) {
--m_transactions;
// for each split account, update lastMod date, balance, txCount
- QValueList<MyMoneySplit>::ConstIterator it_s;
+ TQValueList<MyMoneySplit>::ConstIterator it_s;
for(it_s = tx.splits().begin(); it_s != tx.splits().end(); ++it_s) {
MyMoneyAccount acc = m_storagePtr->account((*it_s).accountId());
--m_transactionCountMap[acc.id()];
@@ -1459,7 +1451,7 @@ void MyMoneyStorageSql::removeTransaction(const MyMoneyTransaction& tx) {
endCommitUnit(__func__);
}
-void MyMoneyStorageSql::deleteTransaction(const QString& id) {
+void MyMoneyStorageSql::deleteTransaction(const TQString& id) {
DBG("*** Entering MyMoneyStorageSql::deleteTransaction");
MyMoneySqlQuery q(this);
q.prepare("DELETE FROM kmmSplits WHERE transactionId = :transactionId;");
@@ -1477,19 +1469,19 @@ void MyMoneyStorageSql::deleteTransaction(const QString& id) {
if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, "deleting Transaction"));
}
-void MyMoneyStorageSql::writeTransaction(const QString& txId, const MyMoneyTransaction& tx, MyMoneySqlQuery& q, const QString& type) {
+void MyMoneyStorageSql::writeTransaction(const TQString& txId, const MyMoneyTransaction& tx, MyMoneySqlQuery& q, const TQString& type) {
DBG("*** Entering MyMoneyStorageSql::writeTransaction");
q.bindValue(":id", txId);
q.bindValue(":txType", type);
- q.bindValue(":postDate", tx.postDate().toString(Qt::ISODate));
+ q.bindValue(":postDate", TQString(tx.postDate().toString(Qt::ISODate)));
q.bindValue(":memo", tx.memo());
- q.bindValue(":entryDate", tx.entryDate().toString(Qt::ISODate));
+ q.bindValue(":entryDate", TQString(tx.entryDate().toString(Qt::ISODate)));
q.bindValue(":currencyId", tx.commodity());
q.bindValue(":bankId", tx.bankID());
- if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, QString("writing Transaction")));
+ if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString("writing Transaction")));
m_txPostDate = tx.postDate(); // FIXME: TEMP till Tom puts date in split object
- QValueList<MyMoneySplit> splitList = tx.splits();
+ TQValueList<MyMoneySplit> splitList = tx.splits();
writeSplits(txId, type, splitList);
//Add in Key-Value Pairs for transactions.
@@ -1498,23 +1490,23 @@ void MyMoneyStorageSql::writeTransaction(const QString& txId, const MyMoneyTrans
m_hiIdTransactions = calcHighId(m_hiIdTransactions, tx.id());
}
-void MyMoneyStorageSql::writeSplits(const QString& txId, const QString& type, const QValueList<MyMoneySplit>& splitList) {
+void MyMoneyStorageSql::writeSplits(const TQString& txId, const TQString& type, const TQValueList<MyMoneySplit>& splitList) {
DBG("*** Entering MyMoneyStorageSql::writeSplits");
// first, get a list of what's on the database (see writeInstitutions)
- QValueList<unsigned int> dbList;
+ TQValueList<unsigned int> dbList;
MyMoneySqlQuery q(this);
q.prepare("SELECT splitId FROM kmmSplits where transactionId = :id;");
q.bindValue(":id", txId);
if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, "building Split list"));
while (q.next()) dbList.append(q.value(0).toUInt());
- QValueList<MyMoneySplit>::const_iterator it;
+ TQValueList<MyMoneySplit>::const_iterator it;
unsigned int i;
MyMoneySqlQuery q2(this);
q.prepare (m_db.m_tables["kmmSplits"].updateString());
q2.prepare (m_db.m_tables["kmmSplits"].insertString());
for(it = splitList.begin(), i = 0; it != splitList.end(); ++it, ++i) {
- if (dbList.contains(i)) {
+ if (dbList.tqcontains(i)) {
dbList.remove (i);
writeSplit(txId, (*it), type, i, q);
} else {
@@ -1525,7 +1517,7 @@ void MyMoneyStorageSql::writeSplits(const QString& txId, const QString& type, co
if (!dbList.isEmpty()) {
q.prepare("DELETE FROM kmmSplits WHERE transactionId = :txId AND splitId = :splitId");
- QValueList<unsigned int>::const_iterator it = dbList.begin();
+ TQValueList<unsigned int>::const_iterator it = dbList.begin();
while (it != dbList.end()) {
q.bindValue(":txId", txId);
q.bindValue(":splitId", *it);
@@ -1535,62 +1527,62 @@ void MyMoneyStorageSql::writeSplits(const QString& txId, const QString& type, co
}
}
-void MyMoneyStorageSql::writeSplit(const QString& txId, const MyMoneySplit& split,
- const QString& type, const int splitId, MyMoneySqlQuery& q) {
+void MyMoneyStorageSql::writeSplit(const TQString& txId, const MyMoneySplit& split,
+ const TQString& type, const int splitId, MyMoneySqlQuery& q) {
DBG("*** Entering MyMoneyStorageSql::writeSplit");
q.bindValue(":transactionId", txId);
q.bindValue(":txType", type);
q.bindValue(":splitId", splitId);
q.bindValue(":payeeId", split.payeeId());
- if (split.reconcileDate() == QDate())
+ if (split.reconcileDate() == TQDate())
q.bindValue(":reconcileDate", split.reconcileDate());
else
- q.bindValue(":reconcileDate", split.reconcileDate().toString(Qt::ISODate));
+ q.bindValue(":reconcileDate", TQString(split.reconcileDate().toString(Qt::ISODate)));
q.bindValue(":action", split.action());
q.bindValue(":reconcileFlag", split.reconcileFlag());
q.bindValue(":value", split.value().toString());
q.bindValue(":valueFormatted", split.value()
.formatMoney("", -1, false)
- .replace(QChar(','), QChar('.')));
+ .tqreplace(TQChar(','), TQChar('.')));
q.bindValue(":shares", split.shares().toString());
MyMoneyAccount acc = m_storagePtr->account(split.accountId());
MyMoneySecurity sec = m_storagePtr->security(acc.currencyId());
q.bindValue(":sharesFormatted",
split.shares().
formatMoney("", MyMoneyMoney::denomToPrec(sec.smallestAccountFraction()), false).
- replace(QChar(','), QChar('.')));
+ tqreplace(TQChar(','), TQChar('.')));
MyMoneyMoney price = split.actualPrice();
if (!price.isZero()) {
q.bindValue(":price", price.toString());
q.bindValue(":priceFormatted", price.formatMoney
("", KMyMoneySettings::pricePrecision(), false)
- .replace(QChar(','), QChar('.')));
+ .tqreplace(TQChar(','), TQChar('.')));
} else {
- q.bindValue(":price", QString());
- q.bindValue(":priceFormatted", QString());
+ q.bindValue(":price", TQString());
+ q.bindValue(":priceFormatted", TQString());
}
q.bindValue(":memo", split.memo());
q.bindValue(":accountId", split.accountId());
q.bindValue(":checkNumber", split.number());
q.bindValue(":postDate", m_txPostDate.toString(Qt::ISODate)); // FIXME: when Tom puts date into split object
q.bindValue(":bankId", split.bankID());
- if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, QString("writing Split")));
- deleteKeyValuePairs("SPLIT", txId + QString::number(splitId));
- writeKeyValuePairs("SPLIT", txId + QString::number(splitId), split.pairs());
+ if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString("writing Split")));
+ deleteKeyValuePairs("SPLIT", txId + TQString::number(splitId));
+ writeKeyValuePairs("SPLIT", txId + TQString::number(splitId), split.pairs());
}
// **** Schedules ****
void MyMoneyStorageSql::writeSchedules() {
DBG("*** Entering MyMoneyStorageSql::writeSchedules");
// first, get a list of what's on the database (see writeInstitutions)
- QValueList<QString> dbList;
+ TQValueList<TQString> dbList;
MyMoneySqlQuery q(this);
q.prepare("SELECT id FROM kmmSchedules;");
if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, "building Schedule list"));
while (q.next()) dbList.append(q.value(0).toString());
- const QValueList<MyMoneySchedule> list = m_storage->scheduleList();
- QValueList<MyMoneySchedule>::ConstIterator it;
+ const TQValueList<MyMoneySchedule> list = m_storage->scheduleList();
+ TQValueList<MyMoneySchedule>::ConstIterator it;
MyMoneySqlQuery q2(this);
//TODO: find a way to prepare the queries outside of the loop. writeSchedule()
// modifies the query passed to it, so they have to be re-prepared every pass.
@@ -1599,7 +1591,7 @@ void MyMoneyStorageSql::writeSchedules() {
q.prepare (m_db.m_tables["kmmSchedules"].updateString());
q2.prepare (m_db.m_tables["kmmSchedules"].insertString());
bool insert = true;
- if (dbList.contains((*it).id())) {
+ if (dbList.tqcontains((*it).id())) {
dbList.remove ((*it).id());
insert = false;
writeSchedule(*it, q, insert);
@@ -1610,7 +1602,7 @@ void MyMoneyStorageSql::writeSchedules() {
}
if (!dbList.isEmpty()) {
- QValueList<QString>::const_iterator it = dbList.begin();
+ TQValueList<TQString>::const_iterator it = dbList.begin();
while (it != dbList.end()) {
deleteSchedule(*it);
++it;
@@ -1648,7 +1640,7 @@ void MyMoneyStorageSql::removeSchedule(const MyMoneySchedule& sched) {
endCommitUnit(__func__);
}
-void MyMoneyStorageSql::deleteSchedule (const QString& id) {
+void MyMoneyStorageSql::deleteSchedule (const TQString& id) {
DBG("*** Entering MyMoneyStorageSql::deleteSchedule");
deleteTransaction(id);
MyMoneySqlQuery q(this);
@@ -1673,8 +1665,8 @@ void MyMoneyStorageSql::writeSchedule(const MyMoneySchedule& sch, MyMoneySqlQuer
q.bindValue(":occurenceString", sch.occurenceToString());
q.bindValue(":paymentType", sch.paymentType());
q.bindValue(":paymentTypeString", MyMoneySchedule::paymentMethodToString(sch.paymentType()));
- q.bindValue(":startDate", sch.startDate().toString(Qt::ISODate));
- q.bindValue(":endDate", sch.endDate().toString(Qt::ISODate));
+ q.bindValue(":startDate", TQString(sch.startDate().toString(Qt::ISODate)));
+ q.bindValue(":endDate", TQString(sch.endDate().toString(Qt::ISODate)));
if (sch.isFixed()) {
q.bindValue(":fixed", "Y");
} else {
@@ -1686,24 +1678,24 @@ void MyMoneyStorageSql::writeSchedule(const MyMoneySchedule& sch, MyMoneySqlQuer
q.bindValue(":autoEnter", "N");
}
q.bindValue(":lastPayment", sch.lastPayment());
- q.bindValue(":nextPaymentDue", sch.nextDueDate().toString(Qt::ISODate));
+ q.bindValue(":nextPaymentDue", TQString(sch.nextDueDate().toString(Qt::ISODate)));
q.bindValue(":weekendOption", sch.weekendOption());
q.bindValue(":weekendOptionString", MyMoneySchedule::weekendOptionToString(sch.weekendOption()));
- if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, QString("writing Schedules")));
+ if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString("writing Schedules")));
//store the payment history for this scheduled task.
//easiest way is to delete all and re-insert; it's not a high use table
q.prepare("DELETE FROM kmmSchedulePaymentHistory WHERE schedId = :id;");
q.bindValue(":id", sch.id());
- if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, QString("deleting Schedule Payment History")));
+ if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString("deleting Schedule Payment History")));
q.prepare (m_db.m_tables["kmmSchedulePaymentHistory"].insertString());
- QValueList<QDate> payments = sch.recordedPayments();
- QValueList<QDate>::ConstIterator it;
+ TQValueList<TQDate> payments = sch.recordedPayments();
+ TQValueList<TQDate>::ConstIterator it;
for (it=payments.begin(); it!=payments.end(); ++it) {
q.bindValue(":schedId", sch.id());
- q.bindValue(":payDate", (*it).toString(Qt::ISODate));
- if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, QString("writing Schedule Payment History")));
+ q.bindValue(":payDate", TQString((*it).toString(Qt::ISODate)));
+ if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString("writing Schedule Payment History")));
}
//store the transaction data for this task.
@@ -1726,19 +1718,19 @@ void MyMoneyStorageSql::writeSchedule(const MyMoneySchedule& sch, MyMoneySqlQuer
void MyMoneyStorageSql::writeSecurities() {
DBG("*** Entering MyMoneyStorageSql::writeSecurities");
// first, get a list of what's on the database (see writeInstitutions)
- QValueList<QString> dbList;
+ TQValueList<TQString> dbList;
MyMoneySqlQuery q(this);
MyMoneySqlQuery q2(this);
q.prepare("SELECT id FROM kmmSecurities;");
if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, "building security list"));
while (q.next()) dbList.append(q.value(0).toString());
- const QValueList<MyMoneySecurity> securityList = m_storage->securityList();
+ const TQValueList<MyMoneySecurity> securityList = m_storage->securityList();
signalProgress(0, securityList.count(), "Writing Securities...");
q.prepare (m_db.m_tables["kmmSecurities"].updateString());
q2.prepare (m_db.m_tables["kmmSecurities"].insertString());
- for(QValueList<MyMoneySecurity>::ConstIterator it = securityList.begin(); it != securityList.end(); ++it) {
- if (dbList.contains((*it).id())) {
+ for(TQValueList<MyMoneySecurity>::ConstIterator it = securityList.begin(); it != securityList.end(); ++it) {
+ if (dbList.tqcontains((*it).id())) {
dbList.remove ((*it).id());
writeSecurity((*it), q);
} else {
@@ -1750,7 +1742,7 @@ void MyMoneyStorageSql::writeSecurities() {
if (!dbList.isEmpty()) {
q.prepare("DELETE FROM kmmSecurities WHERE id = :id");
q2.prepare("DELETE FROM kmmPrices WHERE fromId = :id OR toId = :id");
- QValueList<QString>::const_iterator it = dbList.begin();
+ TQValueList<TQString>::const_iterator it = dbList.begin();
while (it != dbList.end()) {
q.bindValue(":id", (*it));
if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, "deleting Security"));
@@ -1792,7 +1784,7 @@ void MyMoneyStorageSql::removeSecurity(const MyMoneySecurity& sec) {
MyMoneySqlQuery q(this);
q.prepare (m_db.m_tables["kmmSecurities"].deleteString());
q.bindValue(":id", sec.id());
- if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, QString("deleting Security")));
+ if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString("deleting Security")));
--m_securities;
writeFileInfo();
endCommitUnit(__func__);
@@ -1808,7 +1800,7 @@ void MyMoneyStorageSql::writeSecurity(const MyMoneySecurity& security, MyMoneySq
q.bindValue(":smallestAccountFraction", security.smallestAccountFraction());
q.bindValue(":tradingCurrency", security.tradingCurrency());
q.bindValue(":tradingMarket", security.tradingMarket());
- if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, QString ("writing Securities")));
+ if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString ("writing Securities")));
//Add in Key-Value Pairs for security
writeKeyValuePairs("SECURITY", security.id(), security.pairs());
@@ -1822,7 +1814,7 @@ void MyMoneyStorageSql::writePrices() {
// easiest way is to delete all and re-insert
MyMoneySqlQuery q(this);
q.prepare("DELETE FROM kmmPrices");
- if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, QString("deleting Prices")));
+ if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString("deleting Prices")));
m_prices = 0;
const MyMoneyPriceList list = m_storage->priceList();
@@ -1849,13 +1841,13 @@ void MyMoneyStorageSql::addPrice(const MyMoneyPrice& p) {
startCommitUnit(__func__);
bool newRecord = false;
MyMoneySqlQuery q(this);
- QString s = m_db.m_tables["kmmPrices"].selectAllString(false);
+ TQString s = m_db.m_tables["kmmPrices"].selectAllString(false);
s += " WHERE fromId = :fromId AND toId = :toId AND priceDate = :priceDate;";
q.prepare (s);
q.bindValue(":fromId", p.from());
q.bindValue(":toId", p.to());
- q.bindValue(":priceDate", p.date().toString(Qt::ISODate));
- if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, QString("finding Price")));
+ q.bindValue(":priceDate", TQString(p.date().toString(Qt::ISODate)));
+ if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString("finding Price")));
if (q.next()) {
q.prepare(m_db.m_tables["kmmPrices"].updateString());
} else {
@@ -1865,12 +1857,12 @@ void MyMoneyStorageSql::addPrice(const MyMoneyPrice& p) {
}
q.bindValue(":fromId", p.from());
q.bindValue(":toId", p.to());
- q.bindValue(":priceDate", p.date().toString(Qt::ISODate));
- q.bindValue(":price", p.rate(QString()).toString());
+ q.bindValue(":priceDate", TQString(p.date().toString(Qt::ISODate)));
+ q.bindValue(":price", p.rate(TQString()).toString());
q.bindValue(":priceFormatted",
- p.rate(QString()).formatMoney("", KMyMoneySettings::pricePrecision()));
+ p.rate(TQString()).formatMoney("", KMyMoneySettings::pricePrecision()));
q.bindValue(":priceSource", p.source());
- if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, QString("writing Price")));
+ if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString("writing Price")));
if (newRecord) writeFileInfo();
endCommitUnit(__func__);
@@ -1883,8 +1875,8 @@ void MyMoneyStorageSql::removePrice(const MyMoneyPrice& p) {
q.prepare (m_db.m_tables["kmmPrices"].deleteString());
q.bindValue(":fromId", p.from());
q.bindValue(":toId", p.to());
- q.bindValue(":priceDate", p.date().toString(Qt::ISODate));
- if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, QString("deleting Price")));
+ q.bindValue(":priceDate", TQString(p.date().toString(Qt::ISODate)));
+ if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString("deleting Price")));
--m_prices;
writeFileInfo();
endCommitUnit(__func__);
@@ -1896,30 +1888,30 @@ void MyMoneyStorageSql::writePrice(const MyMoneyPrice& p) {
q.prepare (m_db.m_tables["kmmPrices"].insertString());
q.bindValue(":fromId", p.from());
q.bindValue(":toId", p.to());
- q.bindValue(":priceDate", p.date().toString(Qt::ISODate));
- q.bindValue(":price", p.rate(QString()).toString());
- q.bindValue(":priceFormatted", p.rate(QString()).formatMoney("", 2));
+ q.bindValue(":priceDate", TQString(p.date().toString(Qt::ISODate)));
+ q.bindValue(":price", p.rate(TQString()).toString());
+ q.bindValue(":priceFormatted", p.rate(TQString()).formatMoney("", 2));
q.bindValue(":priceSource", p.source());
- if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, QString("writing Prices")));
+ if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString("writing Prices")));
}
// **** Currencies ****
void MyMoneyStorageSql::writeCurrencies() {
DBG("*** Entering MyMoneyStorageSql::writeCurrencies");
// first, get a list of what's on the database (see writeInstitutions)
- QValueList<QString> dbList;
+ TQValueList<TQString> dbList;
MyMoneySqlQuery q(this);
MyMoneySqlQuery q2(this);
q.prepare("SELECT ISOCode FROM kmmCurrencies;");
if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, "building Currency list"));
while (q.next()) dbList.append(q.value(0).toString());
- const QValueList<MyMoneySecurity> currencyList = m_storage->currencyList();
+ const TQValueList<MyMoneySecurity> currencyList = m_storage->currencyList();
signalProgress(0, currencyList.count(), "Writing Currencies...");
q.prepare (m_db.m_tables["kmmCurrencies"].updateString());
q2.prepare (m_db.m_tables["kmmCurrencies"].insertString());
- for(QValueList<MyMoneySecurity>::ConstIterator it = currencyList.begin(); it != currencyList.end(); ++it) {
- if (dbList.contains((*it).id())) {
+ for(TQValueList<MyMoneySecurity>::ConstIterator it = currencyList.begin(); it != currencyList.end(); ++it) {
+ if (dbList.tqcontains((*it).id())) {
dbList.remove ((*it).id());
writeCurrency((*it), q);
} else {
@@ -1930,7 +1922,7 @@ void MyMoneyStorageSql::writeCurrencies() {
if (!dbList.isEmpty()) {
q.prepare("DELETE FROM kmmCurrencies WHERE ISOCode = :ISOCode");
- QValueList<QString>::const_iterator it = dbList.begin();
+ TQValueList<TQString>::const_iterator it = dbList.begin();
while (it != dbList.end()) {
q.bindValue(":ISOCode", (*it));
if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, "deleting Currency"));
@@ -1966,7 +1958,7 @@ void MyMoneyStorageSql::removeCurrency(const MyMoneySecurity& sec) {
MyMoneySqlQuery q(this);
q.prepare (m_db.m_tables["kmmCurrencies"].deleteString());
q.bindValue(":ISOcode", sec.id());
- if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, QString("deleting Currency")));
+ if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString("deleting Currency")));
--m_currencies;
writeFileInfo();
endCommitUnit(__func__);
@@ -1980,35 +1972,35 @@ void MyMoneyStorageSql::writeCurrency(const MyMoneySecurity& currency, MyMoneySq
q.bindValue(":typeString", MyMoneySecurity::securityTypeToString(currency.securityType()));
// writing the symbol as three short ints is a PITA, but the
// problem is that database drivers have incompatible ways of declaring UTF8
- QString symbol = currency.tradingSymbol() + " ";
- q.bindValue(":symbol1", symbol.mid(0,1).unicode()->unicode());
- q.bindValue(":symbol2", symbol.mid(1,1).unicode()->unicode());
- q.bindValue(":symbol3", symbol.mid(2,1).unicode()->unicode());
+ TQString symbol = currency.tradingSymbol() + " ";
+ q.bindValue(":symbol1", symbol.mid(0,1).tqunicode()->tqunicode());
+ q.bindValue(":symbol2", symbol.mid(1,1).tqunicode()->tqunicode());
+ q.bindValue(":symbol3", symbol.mid(2,1).tqunicode()->tqunicode());
q.bindValue(":symbolString", symbol);
q.bindValue(":partsPerUnit", currency.partsPerUnit());
q.bindValue(":smallestCashFraction", currency.smallestCashFraction());
q.bindValue(":smallestAccountFraction", currency.smallestAccountFraction());
- if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, QString("writing Currencies")));
+ if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString("writing Currencies")));
}
void MyMoneyStorageSql::writeReports() {
DBG("*** Entering MyMoneyStorageSql::writeReports");
// first, get a list of what's on the database (see writeInstitutions)
- QValueList<QString> dbList;
+ TQValueList<TQString> dbList;
MyMoneySqlQuery q(this);
MyMoneySqlQuery q2(this);
q.prepare("SELECT id FROM kmmReportConfig;");
if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, "building Report list"));
while (q.next()) dbList.append(q.value(0).toString());
- QValueList<MyMoneyReport> list = m_storage->reportList();
+ TQValueList<MyMoneyReport> list = m_storage->reportList();
signalProgress(0, list.count(), "Writing Reports...");
- QValueList<MyMoneyReport>::ConstIterator it;
+ TQValueList<MyMoneyReport>::ConstIterator it;
q.prepare (m_db.m_tables["kmmReportConfig"].updateString());
q2.prepare (m_db.m_tables["kmmReportConfig"].insertString());
for(it = list.begin(); it != list.end(); ++it){
- if (dbList.contains((*it).id())) {
+ if (dbList.tqcontains((*it).id())) {
dbList.remove ((*it).id());
writeReport(*it, q);
} else {
@@ -2019,7 +2011,7 @@ void MyMoneyStorageSql::writeReports() {
if (!dbList.isEmpty()) {
q.prepare("DELETE FROM kmmReportConfig WHERE id = :id");
- QValueList<QString>::const_iterator it = dbList.begin();
+ TQValueList<TQString>::const_iterator it = dbList.begin();
while (it != dbList.end()) {
q.bindValue(":id", (*it));
if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, "deleting Report"));
@@ -2055,7 +2047,7 @@ void MyMoneyStorageSql::removeReport(const MyMoneyReport& rep) {
MyMoneySqlQuery q(this);
q.prepare("DELETE FROM kmmReportConfig WHERE id = :id");
q.bindValue(":id", rep.id());
- if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, QString("deleting Report")));
+ if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString("deleting Report")));
--m_reports;
writeFileInfo();
endCommitUnit(__func__);
@@ -2063,34 +2055,34 @@ void MyMoneyStorageSql::removeReport(const MyMoneyReport& rep) {
void MyMoneyStorageSql::writeReport (const MyMoneyReport& rep, MyMoneySqlQuery& q) {
DBG("*** Entering MyMoneyStorageSql::writeReport");
- QDomDocument d; // create a dummy XML document
- QDomElement e = d.createElement("REPORTS");
+ TQDomDocument d; // create a dummy XML document
+ TQDomElement e = d.createElement("REPORTS");
d.appendChild (e);
rep.writeXML(d, e); // write the XML to document
q.bindValue(":id", rep.id());
q.bindValue(":name", rep.name());
q.bindValue(":XML", d.toString());
- if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, QString("writing Reports")));
+ if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString("writing Reports")));
//m_hiIdReports = calcHighId(m_hiIdReports, rep.id());
}
void MyMoneyStorageSql::writeBudgets() {
DBG("*** Entering MyMoneyStorageSql::writeBudgets");
// first, get a list of what's on the database (see writeInstitutions)
- QValueList<QString> dbList;
+ TQValueList<TQString> dbList;
MyMoneySqlQuery q(this);
MyMoneySqlQuery q2(this);
q.prepare("SELECT name FROM kmmBudgetConfig;");
if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, "building Budget list"));
while (q.next()) dbList.append(q.value(0).toString());
- QValueList<MyMoneyBudget> list = m_storage->budgetList();
+ TQValueList<MyMoneyBudget> list = m_storage->budgetList();
signalProgress(0, list.count(), "Writing Budgets...");
- QValueList<MyMoneyBudget>::ConstIterator it;
+ TQValueList<MyMoneyBudget>::ConstIterator it;
q.prepare (m_db.m_tables["kmmBudgetConfig"].updateString());
q2.prepare (m_db.m_tables["kmmBudgetConfig"].insertString());
for(it = list.begin(); it != list.end(); ++it){
- if (dbList.contains((*it).name())) {
+ if (dbList.tqcontains((*it).name())) {
dbList.remove ((*it).name());
writeBudget(*it, q);
} else {
@@ -2101,7 +2093,7 @@ void MyMoneyStorageSql::writeBudgets() {
if (!dbList.isEmpty()) {
q.prepare("DELETE FROM kmmBudgetConfig WHERE id = :id");
- QValueList<QString>::const_iterator it = dbList.begin();
+ TQValueList<TQString>::const_iterator it = dbList.begin();
while (it != dbList.end()) {
q.bindValue(":name", (*it));
if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, "deleting Budget"));
@@ -2137,7 +2129,7 @@ void MyMoneyStorageSql::removeBudget(const MyMoneyBudget& bud) {
MyMoneySqlQuery q(this);
q.prepare (m_db.m_tables["kmmBudgetConfig"].deleteString());
q.bindValue(":id", bud.id());
- if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, QString("deleting Budget")));
+ if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString("deleting Budget")));
--m_budgets;
writeFileInfo();
endCommitUnit(__func__);
@@ -2145,15 +2137,15 @@ void MyMoneyStorageSql::removeBudget(const MyMoneyBudget& bud) {
void MyMoneyStorageSql::writeBudget (const MyMoneyBudget& bud, MyMoneySqlQuery& q) {
DBG("*** Entering MyMoneyStorageSql::writeBudget");
- QDomDocument d; // create a dummy XML document
- QDomElement e = d.createElement("BUDGETS");
+ TQDomDocument d; // create a dummy XML document
+ TQDomElement e = d.createElement("BUDGETS");
d.appendChild (e);
bud.writeXML(d, e); // write the XML to document
q.bindValue(":id", bud.id());
q.bindValue(":name", bud.name());
q.bindValue(":start", bud.budgetStart());
q.bindValue(":XML", d.toString());
- if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, QString("writing Budgets")));
+ if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString("writing Budgets")));
}
void MyMoneyStorageSql::writeFileInfo() {
@@ -2165,7 +2157,7 @@ void MyMoneyStorageSql::writeFileInfo() {
MyMoneySqlQuery q(this);
q.prepare ("SELECT * FROM kmmFileInfo;");
if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, "checking fileinfo"));
- QString qs;
+ TQString qs;
if (q.next())
qs = m_db.m_tables["kmmFileInfo"].updateString();
else
@@ -2173,9 +2165,9 @@ void MyMoneyStorageSql::writeFileInfo() {
q.prepare(qs);
q.bindValue(":version", m_dbVersion);
q.bindValue(":fixLevel", m_storage->fileFixVersion());
- q.bindValue(":created", m_storage->creationDate().toString(Qt::ISODate));
+ q.bindValue(":created", TQString(m_storage->creationDate().toString(Qt::ISODate)));
//q.bindValue(":lastModified", m_storage->lastModificationDate().toString(Qt::ISODate));
- q.bindValue(":lastModified", QDate::currentDate().toString(Qt::ISODate));
+ q.bindValue(":lastModified", TQString(TQDate::tqcurrentDate().toString(Qt::ISODate)));
q.bindValue(":baseCurrency", m_storage->pairs()["kmm-baseCurrency"]);
q.bindValue(":institutions", (unsigned long long) m_institutions);
q.bindValue(":accounts", (unsigned long long) m_accounts);
@@ -2189,8 +2181,8 @@ void MyMoneyStorageSql::writeFileInfo() {
q.bindValue(":reports", (unsigned long long) m_reports);
q.bindValue(":kvps", (unsigned long long) m_kvps);
q.bindValue(":budgets", (unsigned long long) m_budgets);
- q.bindValue(":dateRangeStart", QDate());
- q.bindValue(":dateRangeEnd", QDate());
+ q.bindValue(":dateRangeStart", TQDate());
+ q.bindValue(":dateRangeEnd", TQDate());
//FIXME: This modifies all m_<variable> used in this function.
// Sometimes the memory has been updated.
@@ -2217,19 +2209,19 @@ void MyMoneyStorageSql::writeFileInfo() {
q.bindValue(":updateInProgress", "N");
q.bindValue(":logonUser", m_logonUser);
q.bindValue(":logonAt", m_logonAt.toString(Qt::ISODate));
- if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, QString("writing FileInfo")));
+ if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString("writing FileInfo")));
}
// **** Key/value pairs ****
-void MyMoneyStorageSql::writeKeyValuePairs(const QString& kvpType, const QString& kvpId, const QMap<QString, QString>& pairs) {
+void MyMoneyStorageSql::writeKeyValuePairs(const TQString& kvpType, const TQString& kvpId, const TQMap<TQString, TQString>& pairs) {
DBG("*** Entering MyMoneyStorageSql::writeKeyValuePairs");
- QMap<QString, QString>::const_iterator it;
+ TQMap<TQString, TQString>::const_iterator it;
for(it = pairs.begin(); it != pairs.end(); ++it) {
writeKeyValuePair (kvpType, kvpId, it.key(), it.data());
}
}
-void MyMoneyStorageSql::writeKeyValuePair (const QString& kvpType, const QString& kvpId, const QString& kvpKey, const QString& kvpData) {
+void MyMoneyStorageSql::writeKeyValuePair (const TQString& kvpType, const TQString& kvpId, const TQString& kvpKey, const TQString& kvpData) {
DBG("*** Entering MyMoneyStorageSql::writeKeyValuePair");
MyMoneySqlQuery q(this);
q.prepare (m_db.m_tables["kmmKeyValuePairs"].insertString());
@@ -2237,17 +2229,17 @@ void MyMoneyStorageSql::writeKeyValuePair (const QString& kvpType, const QString
q.bindValue(":kvpId", kvpId);
q.bindValue(":kvpKey", kvpKey);
q.bindValue(":kvpData", kvpData);
- if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, QString("writing KVP")));
+ if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString("writing KVP")));
++m_kvps;
}
-void MyMoneyStorageSql::deleteKeyValuePairs (const QString& kvpType, const QString& kvpId) {
+void MyMoneyStorageSql::deleteKeyValuePairs (const TQString& kvpType, const TQString& kvpId) {
DBG("*** Entering MyMoneyStorageSql::deleteKeyValuePairs");
MyMoneySqlQuery q(this);
q.prepare ("DELETE FROM kmmKeyValuePairs WHERE kvpType = :kvpType AND kvpId = :kvpId;");
q.bindValue(":kvpType", kvpType);
q.bindValue(":kvpId", kvpId);
- if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, QString("deleting kvp for %1 %2").arg(kvpType).arg(kvpId)));
+ if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString("deleting kvp for %1 %2").tqarg(kvpType).tqarg(kvpId)));
m_kvps -= q.numRowsAffected();
}
@@ -2262,12 +2254,12 @@ void MyMoneyStorageSql::deleteKeyValuePairs (const QString& kvpType, const QStri
void MyMoneyStorageSql::readFileInfo(void) {
DBG("*** Entering MyMoneyStorageSql::readFileInfo");
- signalProgress(0, 18, QObject::tr("Loading file information..."));
+ signalProgress(0, 18, TQObject::tr("Loading file information..."));
MyMoneyDbTable& t = m_db.m_tables["kmmFileInfo"];
MyMoneySqlQuery q(this);
q.prepare (t.selectAllString());
- if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, QString("reading FileInfo")));
- if (!q.next()) throw new MYMONEYEXCEPTION(buildError (q, __func__, QString("retrieving FileInfo")));
+ if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString("reading FileInfo")));
+ if (!q.next()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString("retrieving FileInfo")));
MyMoneyDbTable::field_iterator ft = t.begin();
int i = 0;
while (ft != t.end()) {
@@ -2302,10 +2294,10 @@ void MyMoneyStorageSql::readFileInfo(void) {
++ft; ++i;
signalProgress(i,0);
}
- m_storage->setPairs(readKeyValuePairs("STORAGE", QString("")).pairs());
+ m_storage->setPairs(readKeyValuePairs("STORAGE", TQString("")).pairs());
}
-/*void MyMoneyStorageSql::setVersion (const QString& version) {
+/*void MyMoneyStorageSql::setVersion (const TQString& version) {
DBG("*** Entering MyMoneyStorageSql::setVersion");
m_dbVersion = version.section('.', 0, 0).toUInt();
m_minorVersion = version.section('.', 1, 1).toUInt();
@@ -2318,31 +2310,31 @@ void MyMoneyStorageSql::readFileInfo(void) {
void MyMoneyStorageSql::readInstitutions(void) {
TRY
- QMap<QString, MyMoneyInstitution> iList = fetchInstitutions();
+ TQMap<TQString, MyMoneyInstitution> iList = fetchInstitutions();
m_storage->loadInstitutions(iList);
readFileInfo();
m_storage->loadInstitutionId(m_hiIdInstitutions);
PASS
}
-const QMap<QString, MyMoneyInstitution> MyMoneyStorageSql::fetchInstitutions (const QStringList& idList, bool forUpdate) const {
+const TQMap<TQString, MyMoneyInstitution> MyMoneyStorageSql::fetchInstitutions (const TQStringList& idList, bool forUpdate) const {
DBG("*** Entering MyMoneyStorageSql::readInstitutions");
- signalProgress(0, m_institutions, QObject::tr("Loading institutions..."));
+ signalProgress(0, m_institutions, TQObject::tr("Loading institutions..."));
int progress = 0;
- QMap<QString, MyMoneyInstitution> iList;
+ TQMap<TQString, MyMoneyInstitution> iList;
unsigned long lastId = 0;
const MyMoneyDbTable& t = m_db.m_tables["kmmInstitutions"];
MyMoneySqlQuery sq(const_cast <MyMoneyStorageSql*> (this));
sq.prepare ("SELECT id from kmmAccounts where institutionId = :id");
MyMoneySqlQuery q(const_cast <MyMoneyStorageSql*> (this));
- QString queryString (t.selectAllString(false));
+ TQString queryString (t.selectAllString(false));
// Use bind variables, instead of just inserting the values in the queryString,
// so that values containing a ':' will work.
if (! idList.empty()) {
queryString += " WHERE";
for (unsigned i = 0; i < idList.count(); ++i)
- queryString += " id = :id" + QString::number(i) + " OR";
+ queryString += " id = :id" + TQString::number(i) + " OR";
queryString = queryString.left(queryString.length() - 2);
}
if (forUpdate)
@@ -2353,17 +2345,17 @@ const QMap<QString, MyMoneyInstitution> MyMoneyStorageSql::fetchInstitutions (co
q.prepare (queryString);
if (! idList.empty()) {
- QStringList::const_iterator bindVal = idList.begin();
+ TQStringList::const_iterator bindVal = idList.begin();
for (int i = 0; bindVal != idList.end(); ++i, ++bindVal) {
- q.bindValue (":id" + QString::number(i), *bindVal);
+ q.bindValue (":id" + TQString::number(i), *bindVal);
}
}
- if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, QString("reading Institution")));
+ if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString("reading Institution")));
while (q.next()) {
MyMoneyDbTable::field_iterator ft = t.begin();
int i = 0;
- QString iid;
+ TQString iid;
MyMoneyInstitution inst;
while (ft != t.end()) {
CASE(id) iid = GETSTRING;
@@ -2378,10 +2370,10 @@ const QMap<QString, MyMoneyInstitution> MyMoneyStorageSql::fetchInstitutions (co
}
// get list of subaccounts
sq.bindValue(":id", iid);
- if (!sq.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, QString("reading Institution AccountList")));
- QStringList aList;
+ if (!sq.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString("reading Institution AccountList")));
+ TQStringList aList;
while (sq.next()) aList.append(sq.value(0).toString());
- for (QStringList::ConstIterator it = aList.begin(); it != aList.end(); ++it)
+ for (TQStringList::ConstIterator it = aList.begin(); it != aList.end(); ++it)
inst.addAccountId(*it);
iList[iid] = MyMoneyInstitution(iid, inst);
@@ -2394,18 +2386,18 @@ const QMap<QString, MyMoneyInstitution> MyMoneyStorageSql::fetchInstitutions (co
return iList;
}
-void MyMoneyStorageSql::readPayees (const QString& id) {
+void MyMoneyStorageSql::readPayees (const TQString& id) {
DBG("*** Entering MyMoneyStorageSql::readPayees");
- QValueList<QString> list;
+ TQValueList<TQString> list;
list.append(id);
readPayees(list);
}
-void MyMoneyStorageSql::readPayees(const QValueList<QString> pid) {
+void MyMoneyStorageSql::readPayees(const TQValueList<TQString> pid) {
DBG("*** Entering MyMoneyStorageSql::readPayees");
TRY
- QStringList pidList;
- qCopy(pid.begin(), pid.end(), qBackInserter(pidList));
+ TQStringList pidList;
+ tqCopy(pid.begin(), pid.end(), qBackInserter(pidList));
m_storage->loadPayees(fetchPayees(pidList));
readFileInfo();
@@ -2416,15 +2408,15 @@ void MyMoneyStorageSql::readPayees(const QValueList<QString> pid) {
// if (pid.isEmpty()) m_payeeListRead = true;
}
-const QMap<QString, MyMoneyPayee> MyMoneyStorageSql::fetchPayees (const QStringList& idList, bool /*forUpdate*/) const {
+const TQMap<TQString, MyMoneyPayee> MyMoneyStorageSql::fetchPayees (const TQStringList& idList, bool /*forUpdate*/) const {
DBG("*** Entering MyMoneyStorageSql::readPayees");
- if (m_displayStatus) {
- signalProgress(0, m_payees, QObject::tr("Loading payees..."));
+ if (m_displaytqStatus) {
+ signalProgress(0, m_payees, TQObject::tr("Loading payees..."));
} else {
// if (m_payeeListRead) return;
}
int progress = 0;
- QMap<QString, MyMoneyPayee> pList;
+ TQMap<TQString, MyMoneyPayee> pList;
//unsigned long lastId;
const MyMoneyDbTable& t = m_db.m_tables["kmmPayees"];
MyMoneyDbTable::field_iterator payeeEnd = t.end();
@@ -2432,26 +2424,26 @@ const QMap<QString, MyMoneyPayee> MyMoneyStorageSql::fetchPayees (const QStringL
if (idList.isEmpty()) {
q.prepare (t.selectAllString());
} else {
- QString whereClause = " where (";
- QString itemConnector = "";
- QStringList::ConstIterator it;
+ TQString whereClause = " where (";
+ TQString itemConnector = "";
+ TQStringList::ConstIterator it;
for (it = idList.begin(); it != idList.end(); ++it) {
- whereClause.append(QString("%1id = '%2'").arg(itemConnector).arg(*it));
+ whereClause.append(TQString("%1id = '%2'").tqarg(itemConnector).tqarg(*it));
itemConnector = " or ";
}
whereClause += ")";
q.prepare (t.selectAllString(false) + whereClause);
}
- if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, QString("reading Payee")));
+ if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString("reading Payee")));
while (q.next()) {
MyMoneyDbTable::field_iterator ft = t.begin();
int i = 0;
- QString pid;
- QString boolChar;
+ TQString pid;
+ TQString boolChar;
MyMoneyPayee payee;
unsigned int type;
bool ignoreCase;
- QString matchKeys;
+ TQString matchKeys;
while (ft != payeeEnd) {
CASE(id) pid = GETCSTRING;
else CASE(name) payee.setName(GETSTRING);
@@ -2476,48 +2468,48 @@ const QMap<QString, MyMoneyPayee> MyMoneyStorageSql::fetchPayees (const QStringL
PASS
} else {
pList[pid] = MyMoneyPayee(pid, payee);
- //unsigned long id = extractId(QString(pid));
+ //unsigned long id = extractId(TQString(pid));
//if(id > lastId)
// lastId = id;
}
- if (m_displayStatus) signalProgress(++progress, 0);
+ if (m_displaytqStatus) signalProgress(++progress, 0);
}
return pList;
}
-const QMap<QString, MyMoneyAccount> MyMoneyStorageSql::fetchAccounts (const QStringList& idList, bool forUpdate) const {
+const TQMap<TQString, MyMoneyAccount> MyMoneyStorageSql::fetchAccounts (const TQStringList& idList, bool forUpdate) const {
DBG("*** Entering MyMoneyStorageSql::fetchAccounts");
- signalProgress(0, m_accounts, QObject::tr("Loading accounts..."));
+ signalProgress(0, m_accounts, TQObject::tr("Loading accounts..."));
int progress = 0;
- QMap<QString, MyMoneyAccount> accList;
- QStringList kvpAccountList;
+ TQMap<TQString, MyMoneyAccount> accList;
+ TQStringList kvpAccountList;
const MyMoneyDbTable& t = m_db.m_tables["kmmAccounts"];
MyMoneyDbTable::field_iterator accEnd = t.end();
MyMoneySqlQuery q(const_cast <MyMoneyStorageSql*> (this));
MyMoneySqlQuery sq(const_cast <MyMoneyStorageSql*> (this));
- QString childQueryString = "SELECT id, parentId FROM kmmAccounts WHERE ";
- QString queryString (t.selectAllString(false));
+ TQString childQueryString = "SELECT id, tqparentId FROM kmmAccounts WHERE ";
+ TQString queryString (t.selectAllString(false));
// Use bind variables, instead of just inserting the values in the queryString,
// so that values containing a ':' will work.
if (! idList.empty()) {
kvpAccountList = idList;
queryString += " WHERE id IN (";
- childQueryString += " parentId IN (";
+ childQueryString += " tqparentId IN (";
for (unsigned i = 0; i < idList.count(); ++i) {
- queryString += " :id" + QString::number(i) + ", ";
- childQueryString += ":id" + QString::number(i) + ", ";
+ queryString += " :id" + TQString::number(i) + ", ";
+ childQueryString += ":id" + TQString::number(i) + ", ";
}
queryString = queryString.left(queryString.length() - 2) + ")";
childQueryString = childQueryString.left(childQueryString.length() - 2) + ")";
} else {
- childQueryString += " NOT parentId IS NULL";
+ childQueryString += " NOT tqparentId IS NULL";
}
queryString += " ORDER BY id";
- childQueryString += " ORDER BY parentid, id";
+ childQueryString += " ORDER BY tqparentid, id";
if (forUpdate) {
queryString += " FOR UPDATE";
@@ -2528,26 +2520,26 @@ const QMap<QString, MyMoneyAccount> MyMoneyStorageSql::fetchAccounts (const QStr
sq.prepare (childQueryString);
if (! idList.empty()) {
- QStringList::const_iterator bindVal = idList.begin();
+ TQStringList::const_iterator bindVal = idList.begin();
for (int i = 0; bindVal != idList.end(); ++i, ++bindVal) {
- q.bindValue (":id" + QString::number(i), *bindVal);
- sq.bindValue (":id" + QString::number(i), *bindVal);
+ q.bindValue (":id" + TQString::number(i), *bindVal);
+ sq.bindValue (":id" + TQString::number(i), *bindVal);
}
}
- if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, QString("reading Account")));
- if (!sq.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, QString("reading subAccountList")));
+ if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString("reading Account")));
+ if (!sq.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString("reading subAccountList")));
while (q.next()) {
MyMoneyDbTable::field_iterator ft = t.begin();
int i = 0;
- QString aid;
- QString balance;
+ TQString aid;
+ TQString balance;
MyMoneyAccount acc;
while (ft != accEnd) {
CASE(id) aid = GETCSTRING;
else CASE(institutionId) acc.setInstitutionId(GETCSTRING);
- else CASE(parentId) acc.setParentAccountId(GETCSTRING);
+ else CASE(tqparentId) acc.setParentAccountId(GETCSTRING);
else CASE(lastReconciled) acc.setLastReconciliationDate(GETDATE);
else CASE(lastModified) acc.setLastModified(GETDATE);
else CASE(openingDate) acc.setOpeningDate(GETDATE);
@@ -2575,10 +2567,10 @@ const QMap<QString, MyMoneyAccount> MyMoneyStorageSql::fetchAccounts (const QStr
signalProgress(++progress, 0);
}
- QMapIterator<QString, MyMoneyAccount> it_acc;
- QMapIterator<QString, MyMoneyAccount> accListEnd = accList.end();
+ TQMapIterator<TQString, MyMoneyAccount> it_acc;
+ TQMapIterator<TQString, MyMoneyAccount> accListEnd = accList.end();
while (sq.next()) {
- it_acc = accList.find(sq.value(1).toString());
+ it_acc = accList.tqfind(sq.value(1).toString());
if (it_acc != accListEnd && it_acc.data().id() == sq.value(1).toString()) {
while (sq.isValid() && it_acc != accListEnd
&& it_acc.data().id() == sq.value(1).toString()) {
@@ -2593,16 +2585,16 @@ const QMap<QString, MyMoneyAccount> MyMoneyStorageSql::fetchAccounts (const QStr
// where it may be able to be done in O(n), if things are just right.
// The operator[] call in the loop is the most expensive call in this function, according
// to several profile runs.
- QMap <QString, MyMoneyKeyValueContainer> kvpResult = readKeyValuePairs("ACCOUNT", kvpAccountList);
- QMap <QString, MyMoneyKeyValueContainer>::const_iterator kvp_end = kvpResult.end();
- for (QMap <QString, MyMoneyKeyValueContainer>::const_iterator it_kvp = kvpResult.begin();
+ TQMap <TQString, MyMoneyKeyValueContainer> kvpResult = readKeyValuePairs("ACCOUNT", kvpAccountList);
+ TQMap <TQString, MyMoneyKeyValueContainer>::const_iterator kvp_end = kvpResult.end();
+ for (TQMap <TQString, MyMoneyKeyValueContainer>::const_iterator it_kvp = kvpResult.begin();
it_kvp != kvp_end; ++it_kvp) {
accList[it_kvp.key()].setPairs(it_kvp.data().pairs());
}
kvpResult = readKeyValuePairs("ONLINEBANKING", kvpAccountList);
kvp_end = kvpResult.end();
- for (QMap <QString, MyMoneyKeyValueContainer>::const_iterator it_kvp = kvpResult.begin();
+ for (TQMap <TQString, MyMoneyKeyValueContainer>::const_iterator it_kvp = kvpResult.begin();
it_kvp != kvp_end; ++it_kvp) {
accList[it_kvp.key()].setOnlineBankingSettings(it_kvp.data());
}
@@ -2615,15 +2607,15 @@ void MyMoneyStorageSql::readAccounts(void) {
m_storage->loadAccountId(m_hiIdAccounts);
}
-const QMap<QString, MyMoneyMoney> MyMoneyStorageSql::fetchBalance(const QStringList& idList, const QDate& date) const {
+const TQMap<TQString, MyMoneyMoney> MyMoneyStorageSql::fetchBalance(const TQStringList& idList, const TQDate& date) const {
- QMap<QString, MyMoneyMoney> returnValue;
+ TQMap<TQString, MyMoneyMoney> returnValue;
MyMoneySqlQuery q(const_cast <MyMoneyStorageSql*> (this));
- QString queryString = "SELECT action, shares, accountId, postDate "
+ TQString queryString = "SELECT action, shares, accountId, postDate "
"FROM kmmSplits WHERE txType = 'N' AND accountId in (";
for (unsigned i = 0; i < idList.count(); ++i) {
- queryString += " :id" + QString::number(i) + ", ";
+ queryString += " :id" + TQString::number(i) + ", ";
}
queryString = queryString.left(queryString.length() - 2) + " )";
@@ -2631,20 +2623,20 @@ const QMap<QString, MyMoneyMoney> MyMoneyStorageSql::fetchBalance(const QStringL
// the <= operator misbehave when the date matches. To avoid this, add a day to the
// requested date and use the < operator.
if (date.isValid() && !date.isNull())
- queryString += QString(" AND postDate < '%1'").arg(date.addDays(1).toString(Qt::ISODate));
+ queryString += TQString(" AND postDate < '%1'").tqarg(date.addDays(1).toString(Qt::ISODate));
DBG (queryString);
q.prepare(queryString);
- QStringList::const_iterator bindVal = idList.begin();
+ TQStringList::const_iterator bindVal = idList.begin();
for (int i = 0; bindVal != idList.end(); ++i, ++bindVal) {
- q.bindValue (":id" + QString::number(i), *bindVal);
+ q.bindValue (":id" + TQString::number(i), *bindVal);
returnValue[*bindVal] = MyMoneyMoney(0);
}
if (!q.exec())
- throw new MYMONEYEXCEPTION(buildError (q, __func__, QString("fetching balance")));
- QString id;
- QString shares;
- QString action;
+ throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString("fetching balance")));
+ TQString id;
+ TQString shares;
+ TQString action;
while (q.next()) {
id = q.value(2).toString();
shares = q.value(1).toString();
@@ -2657,7 +2649,7 @@ const QMap<QString, MyMoneyMoney> MyMoneyStorageSql::fetchBalance(const QStringL
return returnValue;
}
-void MyMoneyStorageSql::readTransactions(const QString& tidList, const QString& dateClause) {
+void MyMoneyStorageSql::readTransactions(const TQString& tidList, const TQString& dateClause) {
TRY
m_storage->loadTransactions(fetchTransactions(tidList, dateClause));
m_storage->loadTransactionId(m_hiIdTransactions);
@@ -2671,13 +2663,13 @@ void MyMoneyStorageSql::readTransactions(const MyMoneyTransactionFilter& filter)
PASS
}
-const QMap<QString, MyMoneyTransaction> MyMoneyStorageSql::fetchTransactions (const QString& tidList, const QString& dateClause, bool /*forUpdate*/) const {
+const TQMap<TQString, MyMoneyTransaction> MyMoneyStorageSql::fetchTransactions (const TQString& tidList, const TQString& dateClause, bool /*forUpdate*/) const {
DBG("*** Entering MyMoneyStorageSql::readTransactions");
// if (m_transactionListRead) return; // all list already in memory
- if (m_displayStatus) signalProgress(0, m_transactions, QObject::tr("Loading transactions..."));
+ if (m_displaytqStatus) signalProgress(0, m_transactions, TQObject::tr("Loading transactions..."));
int progress = 0;
// m_payeeList.clear();
- QString whereClause;
+ TQString whereClause;
whereClause = " WHERE txType = 'N' ";
if (! tidList.isEmpty()) {
whereClause += " AND id IN " + tidList;
@@ -2686,7 +2678,7 @@ const QMap<QString, MyMoneyTransaction> MyMoneyStorageSql::fetchTransactions (co
const MyMoneyDbTable& t = m_db.m_tables["kmmTransactions"];
MyMoneySqlQuery q(const_cast <MyMoneyStorageSql*> (this));
q.prepare (t.selectAllString(false) + whereClause + " ORDER BY id;");
- if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, QString("reading Transaction")));
+ if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString("reading Transaction")));
const MyMoneyDbTable& ts = m_db.m_tables["kmmSplits"];
whereClause = " WHERE txType = 'N' ";
if (! tidList.isEmpty()) {
@@ -2694,11 +2686,11 @@ const QMap<QString, MyMoneyTransaction> MyMoneyStorageSql::fetchTransactions (co
}
if (!dateClause.isEmpty()) whereClause += " and " + dateClause;
MyMoneySqlQuery qs(const_cast <MyMoneyStorageSql*> (this));
- QString splitQuery = ts.selectAllString(false) + whereClause
+ TQString splitQuery = ts.selectAllString(false) + whereClause
+ " ORDER BY transactionId, splitId;";
qs.prepare (splitQuery);
if (!qs.exec()) throw new MYMONEYEXCEPTION(buildError (qs, __func__, "reading Splits"));
- QString splitTxId = "ZZZ";
+ TQString splitTxId = "ZZZ";
MyMoneySplit s;
if (qs.next()) {
splitTxId = qs.value(0).toString();
@@ -2706,12 +2698,12 @@ const QMap<QString, MyMoneyTransaction> MyMoneyStorageSql::fetchTransactions (co
} else {
splitTxId = "ZZZ";
}
- QMap <QString, MyMoneyTransaction> txMap;
- QStringList txList;
+ TQMap <TQString, MyMoneyTransaction> txMap;
+ TQStringList txList;
MyMoneyDbTable::field_iterator txEnd = t.end();
while (q.next()) {
MyMoneyTransaction tx;
- QString txId;
+ TQString txId;
MyMoneyDbTable::field_iterator ft = t.begin();
int i = 0;
while (ft != txEnd) {
@@ -2749,14 +2741,14 @@ const QMap<QString, MyMoneyTransaction> MyMoneyStorageSql::fetchTransactions (co
txMap.insert(tx.uniqueSortKey(), tx);
}
}
- QMap <QString, MyMoneyKeyValueContainer> kvpMap = readKeyValuePairs("TRANSACTION", txList);
- QMap<QString, MyMoneyTransaction> tList;
- QMapIterator<QString, MyMoneyTransaction> txMapEnd = txMap.end();
- for (QMapIterator<QString, MyMoneyTransaction> i = txMap.begin();
+ TQMap <TQString, MyMoneyKeyValueContainer> kvpMap = readKeyValuePairs("TRANSACTION", txList);
+ TQMap<TQString, MyMoneyTransaction> tList;
+ TQMapIterator<TQString, MyMoneyTransaction> txMapEnd = txMap.end();
+ for (TQMapIterator<TQString, MyMoneyTransaction> i = txMap.begin();
i != txMapEnd; ++i) {
i.data().setPairs(kvpMap[i.data().id()].pairs());
- if (m_displayStatus) signalProgress(++progress, 0);
+ if (m_displaytqStatus) signalProgress(++progress, 0);
}
if ((tidList.isEmpty()) && (dateClause.isEmpty())) {
@@ -2789,20 +2781,20 @@ int MyMoneyStorageSql::splitState(const MyMoneyTransactionFilter::stateOptionE&
return rc;
}
-const QMap<QString, MyMoneyTransaction> MyMoneyStorageSql::fetchTransactions (const MyMoneyTransactionFilter& filter) const {
+const TQMap<TQString, MyMoneyTransaction> MyMoneyStorageSql::fetchTransactions (const MyMoneyTransactionFilter& filter) const {
DBG("*** Entering MyMoneyStorageSql::readTransactions");
// analyze the filter
// if (m_transactionListRead) return; // all list already in memory
// if the filter is restricted to certain accounts/categories
// check if we already have them all in memory
- QStringList accounts;
- QString inQuery;
+ TQStringList accounts;
+ TQString inQuery;
filter.accounts(accounts);
filter.categories(accounts);
-// QStringList::iterator it;
+// TQStringList::iterator it;
// bool allAccountsLoaded = true;
// for (it = accounts.begin(); it != accounts.end(); ++it) {
-// if (m_accountsLoaded.find(*it) == m_accountsLoaded.end()) {
+// if (m_accountsLoaded.tqfind(*it) == m_accountsLoaded.end()) {
// allAccountsLoaded = false;
// break;
// }
@@ -2817,7 +2809,7 @@ const QMap<QString, MyMoneyTransaction> MyMoneyStorageSql::fetchTransactions (co
alert ("Amount Filter Set");
canImplementFilter = false;
}
- QString n1, n2;
+ TQString n1, n2;
if (filter.numberFilter(n1, n2)) {
alert("Number filter set");
canImplementFilter = false;
@@ -2832,7 +2824,7 @@ const QMap<QString, MyMoneyTransaction> MyMoneyStorageSql::fetchTransactions (co
// alert("State filter set");
// canImplementFilter = false;
// }
- QRegExp t2;
+ TQRegExp t2;
if (filter.textFilter(t2)) {
alert("text filter set");
canImplementFilter = false;
@@ -2843,9 +2835,9 @@ const QMap<QString, MyMoneyTransaction> MyMoneyStorageSql::fetchTransactions (co
canImplementFilter = false;
}
if (!canImplementFilter) {
- QMap<QString, MyMoneyTransaction> transactionList = fetchTransactions();
- QMap<QString, MyMoneyTransaction>::ConstIterator it_t;
- QMap<QString, MyMoneyTransaction>::ConstIterator txListEnd = transactionList.end();
+ TQMap<TQString, MyMoneyTransaction> transactionList = fetchTransactions();
+ TQMap<TQString, MyMoneyTransaction>::ConstIterator it_t;
+ TQMap<TQString, MyMoneyTransaction>::ConstIterator txListEnd = transactionList.end();
std::remove_if(transactionList.begin(), transactionList.end(), FilterFail(filter, m_storagePtr));
return transactionList;
@@ -2854,27 +2846,27 @@ const QMap<QString, MyMoneyTransaction> MyMoneyStorageSql::fetchTransactions (co
bool accountsOnlyFilter = true;
bool splitFilterActive = false; // the split filter is active if we are selecting on fields in the split table
// get start and end dates
- QDate start = filter.fromDate();
- QDate end = filter.toDate();
+ TQDate start = filter.fromDate();
+ TQDate end = filter.toDate();
// not entirely sure if the following is correct, but at best, saves a lot of reads, at worst
// it only causes us to read a few more transactions that strictly necessary (I think...)
- if (start == KMyMoneySettings::startDate().date()) start = QDate();
- bool txFilterActive = ((start != QDate()) || (end != QDate())); // and this for fields in the transaction table
+ if (start == KMyMoneySettings::startDate().date()) start = TQDate();
+ bool txFilterActive = ((start != TQDate()) || (end != TQDate())); // and this for fields in the transaction table
if (txFilterActive) accountsOnlyFilter = false;
- QString whereClause = "";
- QString subClauseconnector = " where txType = 'N' and ";
+ TQString whereClause = "";
+ TQString subClauseconnector = " where txType = 'N' and ";
// payees
- QStringList payees;
+ TQStringList payees;
//filter.payees(payees);
if (filter.payees(payees)) {
accountsOnlyFilter = false;
- QString itemConnector = "payeeId in (";
- QString payeesClause = "";
- QStringList::const_iterator it;
+ TQString itemConnector = "payeeId in (";
+ TQString payeesClause = "";
+ TQStringList::const_iterator it;
for (it = payees.begin(); it != payees.end(); ++it) {
- payeesClause.append(QString("%1'%2'")
- .arg(itemConnector).arg(*it));
+ payeesClause.append(TQString("%1'%2'")
+ .tqarg(itemConnector).tqarg(*it));
itemConnector = ", ";
}
if (!payeesClause.isEmpty()) {
@@ -2887,13 +2879,13 @@ const QMap<QString, MyMoneyTransaction> MyMoneyStorageSql::fetchTransactions (co
// accounts and categories
if (!accounts.isEmpty()) {
splitFilterActive = true;
- QString itemConnector = "accountId in (";
- QString accountsClause = "";
- QStringList::const_iterator it;
+ TQString itemConnector = "accountId in (";
+ TQString accountsClause = "";
+ TQStringList::const_iterator it;
for (it = accounts.begin(); it != accounts.end(); ++it) {
-// if (m_accountsLoaded.find(*it) == m_accountsLoaded.end()) {
- accountsClause.append(QString("%1 '%2'")
- .arg(itemConnector).arg(*it));
+// if (m_accountsLoaded.tqfind(*it) == m_accountsLoaded.end()) {
+ accountsClause.append(TQString("%1 '%2'")
+ .tqarg(itemConnector).tqarg(*it));
itemConnector = ", ";
//if (accountsOnlyFilter) m_accountsLoaded.append(*it); // a bit premature...
// }
@@ -2905,15 +2897,15 @@ const QMap<QString, MyMoneyTransaction> MyMoneyStorageSql::fetchTransactions (co
}
// split states
- QValueList <int> splitStates;
+ TQValueList <int> splitStates;
if (filter.states(splitStates)) {
splitFilterActive = true;
- QString itemConnector = " reconcileFlag IN (";
- QString statesClause = "";
- for (QValueList<int>::ConstIterator it = splitStates.begin(); it != splitStates.end(); ++it) {
- statesClause.append(QString(" %1 '%2'")
- .arg(itemConnector)
- .arg(splitState(MyMoneyTransactionFilter::stateOptionE(*it))));
+ TQString itemConnector = " reconcileFlag IN (";
+ TQString statesClause = "";
+ for (TQValueList<int>::ConstIterator it = splitStates.begin(); it != splitStates.end(); ++it) {
+ statesClause.append(TQString(" %1 '%2'")
+ .tqarg(itemConnector)
+ .tqarg(splitState(MyMoneyTransactionFilter::stateOptionE(*it))));
itemConnector = ",";
}
if (!statesClause.isEmpty()) {
@@ -2922,8 +2914,8 @@ const QMap<QString, MyMoneyTransaction> MyMoneyStorageSql::fetchTransactions (co
}
}
// I've given up trying to work out the logic. we keep getting the wrong number of close brackets
- int obc = whereClause.contains('(');
- int cbc = whereClause.contains(')');
+ int obc = whereClause.tqcontains('(');
+ int cbc = whereClause.tqcontains(')');
if (cbc > obc) {
qFatal("invalid where clause - %s", whereClause.latin1());
}
@@ -2946,22 +2938,22 @@ const QMap<QString, MyMoneyTransaction> MyMoneyStorageSql::fetchTransactions (co
return fetchTransactions();
}
// build a date clause for the transaction table
- QString dateClause;
- QString connector = "";
- if (end != QDate()) {
- dateClause = QString("(postDate < '%1')").arg(end.addDays(1).toString(Qt::ISODate));
+ TQString dateClause;
+ TQString connector = "";
+ if (end != TQDate()) {
+ dateClause = TQString("(postDate < '%1')").tqarg(end.addDays(1).toString(Qt::ISODate));
connector = " and ";
}
- if (start != QDate()) {
- dateClause += QString("%1 (postDate >= '%2')").arg(connector).arg(start.toString(Qt::ISODate));
+ if (start != TQDate()) {
+ dateClause += TQString("%1 (postDate >= '%2')").tqarg(connector).tqarg(start.toString(Qt::ISODate));
}
// now get a list of transaction ids
// if we have only a date filter, we need to build the list from the tx table
// otherwise we need to build from the split table
if (splitFilterActive) {
- inQuery = QString("(select distinct transactionId from kmmSplits %1)").arg(whereClause);
+ inQuery = TQString("(select distinct transactionId from kmmSplits %1)").tqarg(whereClause);
} else {
- inQuery = QString("(select distinct id from kmmTransactions where %1)").arg(dateClause);
+ inQuery = TQString("(select distinct id from kmmTransactions where %1)").tqarg(dateClause);
txFilterActive = false; // kill off the date filter now
}
@@ -2969,7 +2961,7 @@ const QMap<QString, MyMoneyTransaction> MyMoneyStorageSql::fetchTransactions (co
//FIXME: if we have an accounts-only filter, recalc balances on loaded accounts
}
-unsigned long MyMoneyStorageSql::transactionCount (const QString& aid) const {
+unsigned long MyMoneyStorageSql::transactionCount (const TQString& aid) const {
DBG("*** Entering MyMoneyStorageSql::transactionCount");
if (aid.length() == 0)
return m_transactions;
@@ -2984,17 +2976,17 @@ void MyMoneyStorageSql::readSplit (MyMoneySplit& s, const MyMoneySqlQuery& q, co
MyMoneyDbTable::field_iterator splitEnd = t.end();
int i = 0;
- // Use the QString here instead of CASE, since this is called so often.
- QString fieldName;
+ // Use the TQString here instead of CASE, since this is called so often.
+ TQString fieldName;
while (ft != splitEnd) {
fieldName = (*ft)->name();
if (fieldName == "payeeId") s.setPayeeId(GETCSTRING);
else if (fieldName == "reconcileDate") s.setReconcileDate(GETDATE);
else if (fieldName == "action") s.setAction(GETCSTRING);
else if (fieldName == "reconcileFlag") s.setReconcileFlag(static_cast<MyMoneySplit::reconcileFlagE>(GETINT));
- else if (fieldName == "value") s.setValue(MyMoneyMoney(QStringEmpty(GETSTRING)));
- else if (fieldName == "shares") s.setShares(MyMoneyMoney(QStringEmpty(GETSTRING)));
- else if (fieldName == "price") s.setPrice(MyMoneyMoney(QStringEmpty(GETSTRING)));
+ else if (fieldName == "value") s.setValue(MyMoneyMoney(TQStringEmpty(GETSTRING)));
+ else if (fieldName == "shares") s.setShares(MyMoneyMoney(TQStringEmpty(GETSTRING)));
+ else if (fieldName == "price") s.setPrice(MyMoneyMoney(TQStringEmpty(GETSTRING)));
else if (fieldName == "memo") s.setMemo(GETSTRING);
else if (fieldName == "accountId") s.setAccountId(GETCSTRING);
else if (fieldName == "checkNumber") s.setNumber(GETSTRING);
@@ -3006,7 +2998,7 @@ void MyMoneyStorageSql::readSplit (MyMoneySplit& s, const MyMoneySqlQuery& q, co
return;
}
-bool MyMoneyStorageSql::isReferencedByTransaction(const QString& id) const {
+bool MyMoneyStorageSql::isReferencedByTransaction(const TQString& id) const {
DBG("*** Entering MyMoneyStorageSql::isReferencedByTransaction");
MyMoneySqlQuery q(const_cast <MyMoneyStorageSql*> (this));
q.prepare("SELECT COUNT(*) FROM kmmTransactions "
@@ -3030,13 +3022,13 @@ void MyMoneyStorageSql::readSchedules(void) {
PASS
}
-const QMap<QString, MyMoneySchedule> MyMoneyStorageSql::fetchSchedules (const QStringList& idList, bool forUpdate) const {
+const TQMap<TQString, MyMoneySchedule> MyMoneyStorageSql::fetchSchedules (const TQStringList& idList, bool forUpdate) const {
DBG("*** Entering MyMoneyStorageSql::readSchedules");
- signalProgress(0, m_schedules, QObject::tr("Loading schedules..."));
+ signalProgress(0, m_schedules, TQObject::tr("Loading schedules..."));
int progress = 0;
const MyMoneyDbTable& t = m_db.m_tables["kmmSchedules"];
MyMoneySqlQuery q(const_cast <MyMoneyStorageSql*> (this));
- QMap<QString, MyMoneySchedule> sList;
+ TQMap<TQString, MyMoneySchedule> sList;
//unsigned long lastId = 0;
const MyMoneyDbTable& ts = m_db.m_tables["kmmSplits"];
MyMoneySqlQuery qs(const_cast <MyMoneyStorageSql*> (this));
@@ -3044,14 +3036,14 @@ const QMap<QString, MyMoneySchedule> MyMoneyStorageSql::fetchSchedules (const QS
MyMoneySqlQuery sq(const_cast <MyMoneyStorageSql*> (this));
sq.prepare ("SELECT payDate from kmmSchedulePaymentHistory where schedId = :id");
- QString queryString (t.selectAllString(false));
+ TQString queryString (t.selectAllString(false));
// Use bind variables, instead of just inserting the values in the queryString,
// so that values containing a ':' will work.
if (! idList.empty()) {
queryString += " WHERE";
for (unsigned i = 0; i < idList.count(); ++i)
- queryString += " id = :id" + QString::number(i) + " OR";
+ queryString += " id = :id" + TQString::number(i) + " OR";
queryString = queryString.left(queryString.length() - 2);
}
queryString += " ORDER BY id;";
@@ -3064,20 +3056,20 @@ const QMap<QString, MyMoneySchedule> MyMoneyStorageSql::fetchSchedules (const QS
q.prepare (queryString);
if (! idList.empty()) {
- QStringList::const_iterator bindVal = idList.begin();
+ TQStringList::const_iterator bindVal = idList.begin();
for (int i = 0; bindVal != idList.end(); ++i, ++bindVal) {
- q.bindValue (":id" + QString::number(i), *bindVal);
+ q.bindValue (":id" + TQString::number(i), *bindVal);
}
}
- if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, QString("reading Schedules")));
+ if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString("reading Schedules")));
while (q.next()) {
MyMoneyDbTable::field_iterator ft = t.begin();
int i = 0;
MyMoneySchedule s;
- QString sId;
- QString boolChar;
- QDate nextPaymentDue;
+ TQString sId;
+ TQString boolChar;
+ TQDate nextPaymentDue;
while (ft != t.end()) {
CASE(id) sId = GETCSTRING;
else CASE(name) s.setName (GETSTRING);
@@ -3110,8 +3102,8 @@ const QMap<QString, MyMoneySchedule> MyMoneyStorageSql::fetchSchedules (const QS
MyMoneySqlQuery q(const_cast <MyMoneyStorageSql*> (this));
q.prepare (t.selectAllString(false) + " WHERE id = :id;");
q.bindValue(":id", s.id());
- if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, QString("reading Scheduled Transaction")));
- if (!q.next()) throw new MYMONEYEXCEPTION(buildError (q, __func__, QString("retrieving scheduled transaction")));
+ if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString("reading Scheduled Transaction")));
+ if (!q.next()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString("retrieving scheduled transaction")));
MyMoneyTransaction tx(s.id(), MyMoneyTransaction());
ft = t.begin();
i = 0;
@@ -3138,7 +3130,7 @@ const QMap<QString, MyMoneySchedule> MyMoneyStorageSql::fetchSchedules (const QS
// If the transaction doesn't have a post date, setTransaction will reject it.
// The old way of handling things was to store the next post date in the schedule object
- // and set the transaction post date to QDate().
+ // and set the transaction post date to TQDate().
// For compatibility, if this is the case, copy the next post date from the schedule object
// to the transaction object post date.
if (!tx.postDate().isValid()) {
@@ -3149,7 +3141,7 @@ const QMap<QString, MyMoneySchedule> MyMoneyStorageSql::fetchSchedules (const QS
// read in the recorded payments
sq.bindValue(":id", s.id());
- if (!sq.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, QString("reading schedule payment history")));
+ if (!sq.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString("reading schedule payment history")));
while (sq.next()) s.recordPayment (sq.value(0).toDate());
sList[s.id()] = s;
@@ -3174,21 +3166,21 @@ void MyMoneyStorageSql::readSecurities(void) {
PASS
}
-const QMap<QString, MyMoneySecurity> MyMoneyStorageSql::fetchSecurities (const QStringList& /*idList*/, bool /*forUpdate*/) const {
+const TQMap<TQString, MyMoneySecurity> MyMoneyStorageSql::fetchSecurities (const TQStringList& /*idList*/, bool /*forUpdate*/) const {
DBG("*** Entering MyMoneyStorageSql::readSecurities");
- signalProgress(0, m_securities, QObject::tr("Loading securities..."));
+ signalProgress(0, m_securities, TQObject::tr("Loading securities..."));
int progress = 0;
- QMap<QString, MyMoneySecurity> sList;
+ TQMap<TQString, MyMoneySecurity> sList;
unsigned long lastId = 0;
const MyMoneyDbTable& t = m_db.m_tables["kmmSecurities"];
MyMoneySqlQuery q(const_cast <MyMoneyStorageSql*> (this));
q.prepare (t.selectAllString(false) + " ORDER BY id;");
- if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, QString("reading Securities")));
+ if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString("reading Securities")));
while (q.next()) {
MyMoneyDbTable::field_iterator ft = t.begin();
int i = 0;
MyMoneySecurity e;
- QString eid;
+ TQString eid;
int saf = 0;
while (ft != t.end()) {
CASE(id) eid = GETSTRING;
@@ -3232,12 +3224,12 @@ void MyMoneyStorageSql::readPrices(void) {
}
-const MyMoneyPrice MyMoneyStorageSql::fetchSinglePrice (const QString& fromIdList, const QString& toIdList, const QDate& date_, bool exactDate, bool /*forUpdate*/) const {
+const MyMoneyPrice MyMoneyStorageSql::fetchSinglePrice (const TQString& fromIdList, const TQString& toIdList, const TQDate& date_, bool exactDate, bool /*forUpdate*/) const {
DBG("*** Entering MyMoneyStorageSql::fetchSinglePrice");
const MyMoneyDbTable& t = m_db.m_tables["kmmPrices"];
MyMoneyDbTable::field_iterator tableEnd = t.end();
MyMoneySqlQuery q(const_cast <MyMoneyStorageSql*> (this));
- QString queryString = t.selectAllString(false);
+ TQString queryString = t.selectAllString(false);
// Use bind variables, instead of just inserting the values in the queryString,
// so that values containing a ':' will work.
@@ -3250,28 +3242,28 @@ const MyMoneyPrice MyMoneyStorageSql::fetchSinglePrice (const QString& fromIdLi
q.prepare(queryString);
- QDate date (date_);
+ TQDate date (date_);
if(!date.isValid())
- date = QDate::currentDate();
+ date = TQDate::tqcurrentDate();
q.bindValue(":fromId", fromIdList);
q.bindValue(":toId", toIdList);
- q.bindValue(":priceDate", date.addDays(1).toString(Qt::ISODate));
+ q.bindValue(":priceDate", TQString(date.addDays(1).toString(Qt::ISODate)));
if (exactDate)
- q.bindValue(":exactDate", date.toString(Qt::ISODate));
+ q.bindValue(":exactDate", TQString(date.toString(Qt::ISODate)));
if (! q.exec()) {}
if (q.next()) {
MyMoneyDbTable::field_iterator ft = t.begin();
int i = 0;
- QString from;
- QString to;
- QDate date;
+ TQString from;
+ TQString to;
+ TQDate date;
MyMoneyMoney rate;
- QString source;
+ TQString source;
bool foundFromId = false;
bool foundToId = false;
bool foundPriceDate = false;
@@ -3303,30 +3295,30 @@ const MyMoneyPrice MyMoneyStorageSql::fetchSinglePrice (const QString& fromIdLi
return MyMoneyPrice();
}
-const MyMoneyPriceList MyMoneyStorageSql::fetchPrices (const QStringList& fromIdList, const QStringList& toIdList, bool forUpdate) const {
+const MyMoneyPriceList MyMoneyStorageSql::fetchPrices (const TQStringList& fromIdList, const TQStringList& toIdList, bool forUpdate) const {
DBG("*** Entering MyMoneyStorageSql::readPrices");
- signalProgress(0, m_prices, QObject::tr("Loading prices..."));
+ signalProgress(0, m_prices, TQObject::tr("Loading prices..."));
int progress = 0;
const_cast <MyMoneyStorageSql*> (this)->m_readingPrices = true;
MyMoneyPriceList pList;
const MyMoneyDbTable& t = m_db.m_tables["kmmPrices"];
MyMoneyDbTable::field_iterator tableEnd = t.end();
MyMoneySqlQuery q(const_cast <MyMoneyStorageSql*> (this));
- QString queryString = t.selectAllString(false);
+ TQString queryString = t.selectAllString(false);
// Use bind variables, instead of just inserting the values in the queryString,
// so that values containing a ':' will work.
if (! fromIdList.empty()) {
queryString += " WHERE (";
for (unsigned i = 0; i < fromIdList.count(); ++i) {
- queryString += " fromId = :fromId" + QString::number(i) + " OR";
+ queryString += " fromId = :fromId" + TQString::number(i) + " OR";
}
queryString = queryString.left(queryString.length() - 2) + ")";
}
if (! toIdList.empty()) {
queryString += " AND (";
for (unsigned i = 0; i < toIdList.count(); ++i) {
- queryString += " toId = :toId" + QString::number(i) + " OR";
+ queryString += " toId = :toId" + TQString::number(i) + " OR";
}
queryString = queryString.left(queryString.length() - 2) + ")";
}
@@ -3340,27 +3332,27 @@ const MyMoneyPriceList MyMoneyStorageSql::fetchPrices (const QStringList& fromI
q.prepare (queryString);
if (! fromIdList.empty()) {
- QStringList::const_iterator bindVal = fromIdList.begin();
+ TQStringList::const_iterator bindVal = fromIdList.begin();
for (int i = 0; bindVal != fromIdList.end(); ++i, ++bindVal) {
- q.bindValue (":fromId" + QString::number(i), *bindVal);
+ q.bindValue (":fromId" + TQString::number(i), *bindVal);
}
}
if (! toIdList.empty()) {
- QStringList::const_iterator bindVal = toIdList.begin();
+ TQStringList::const_iterator bindVal = toIdList.begin();
for (int i = 0; bindVal != toIdList.end(); ++i, ++bindVal) {
- q.bindValue (":toId" + QString::number(i), *bindVal);
+ q.bindValue (":toId" + TQString::number(i), *bindVal);
}
}
- if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, QString("reading Prices")));
+ if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString("reading Prices")));
while (q.next()) {
MyMoneyDbTable::field_iterator ft = t.begin();
int i = 0;
- QString from;
- QString to;
- QDate date;
+ TQString from;
+ TQString to;
+ TQDate date;
MyMoneyMoney rate;
- QString source;
+ TQString source;
while (ft != tableEnd) {
CASE(fromId) from = GETCSTRING;
@@ -3384,22 +3376,22 @@ void MyMoneyStorageSql::readCurrencies(void) {
PASS
}
-const QMap<QString, MyMoneySecurity> MyMoneyStorageSql::fetchCurrencies (const QStringList& idList, bool forUpdate) const {
+const TQMap<TQString, MyMoneySecurity> MyMoneyStorageSql::fetchCurrencies (const TQStringList& idList, bool forUpdate) const {
DBG("*** Entering MyMoneyStorageSql::readCurrencies");
- signalProgress(0, m_currencies, QObject::tr("Loading currencies..."));
+ signalProgress(0, m_currencies, TQObject::tr("Loading currencies..."));
int progress = 0;
- QMap<QString, MyMoneySecurity> cList;
+ TQMap<TQString, MyMoneySecurity> cList;
const MyMoneyDbTable& t = m_db.m_tables["kmmCurrencies"];
MyMoneySqlQuery q(const_cast <MyMoneyStorageSql*> (this));
- QString queryString (t.selectAllString(false));
+ TQString queryString (t.selectAllString(false));
// Use bind variables, instead of just inserting the values in the queryString,
// so that values containing a ':' will work.
if (! idList.empty()) {
queryString += " WHERE";
for (unsigned i = 0; i < idList.count(); ++i)
- queryString += " isocode = :id" + QString::number(i) + " OR";
+ queryString += " isocode = :id" + TQString::number(i) + " OR";
queryString = queryString.left(queryString.length() - 2);
}
@@ -3413,32 +3405,32 @@ const QMap<QString, MyMoneySecurity> MyMoneyStorageSql::fetchCurrencies (const Q
q.prepare (queryString);
if (! idList.empty()) {
- QStringList::const_iterator bindVal = idList.begin();
+ TQStringList::const_iterator bindVal = idList.begin();
for (int i = 0; bindVal != idList.end(); ++i, ++bindVal) {
- q.bindValue (":id" + QString::number(i), *bindVal);
+ q.bindValue (":id" + TQString::number(i), *bindVal);
}
}
- if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, QString("reading Currencies")));
+ if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString("reading Currencies")));
while (q.next()) {
MyMoneyDbTable::field_iterator ft = t.begin();
int i = 0;
- QString id;
+ TQString id;
MyMoneySecurity c;
- QChar symbol[3];
+ TQChar symbol[3];
while (ft != t.end()) {
CASE(ISOcode) id = GETCSTRING;
else CASE(name) c.setName(GETSTRING);
else CASE(type) c.setSecurityType(static_cast<MyMoneySecurity::eSECURITYTYPE>(GETINT));
- else CASE(symbol1) symbol[0] = QChar(GETINT);
- else CASE(symbol2) symbol[1] = QChar(GETINT);
- else CASE(symbol3) symbol[2] = QChar(GETINT);
+ else CASE(symbol1) symbol[0] = TQChar(GETINT);
+ else CASE(symbol2) symbol[1] = TQChar(GETINT);
+ else CASE(symbol3) symbol[2] = TQChar(GETINT);
else CASE(partsPerUnit) c.setPartsPerUnit(GETINT);
else CASE(smallestCashFraction) c.setSmallestCashFraction(GETINT);
else CASE(smallestAccountFraction) c.setSmallestAccountFraction(GETINT);
++ft; ++i;
}
- c.setTradingSymbol(QString(symbol, 3).stripWhiteSpace());
+ c.setTradingSymbol(TQString(symbol, 3).stripWhiteSpace());
cList[id] = MyMoneySecurity(id, c);
@@ -3455,24 +3447,24 @@ void MyMoneyStorageSql::readReports(void) {
PASS
}
-const QMap<QString, MyMoneyReport> MyMoneyStorageSql::fetchReports (const QStringList& /*idList*/, bool /*forUpdate*/) const {
+const TQMap<TQString, MyMoneyReport> MyMoneyStorageSql::fetchReports (const TQStringList& /*idList*/, bool /*forUpdate*/) const {
DBG("*** Entering MyMoneyStorageSql::readReports");
- signalProgress(0, m_reports, QObject::tr("Loading reports..."));
+ signalProgress(0, m_reports, TQObject::tr("Loading reports..."));
int progress = 0;
const MyMoneyDbTable& t = m_db.m_tables["kmmReportConfig"];
MyMoneySqlQuery q(const_cast <MyMoneyStorageSql*> (this));
q.prepare (t.selectAllString(true));
- if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, QString("reading reports")));
- QMap<QString, MyMoneyReport> rList;
+ if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString("reading reports")));
+ TQMap<TQString, MyMoneyReport> rList;
while (q.next()) {
MyMoneyDbTable::field_iterator ft = t.begin();
int i = 0;
- QDomDocument d;
+ TQDomDocument d;
while (ft != t.end()) {
CASE(XML) d.setContent(GETSTRING, false);
++ft; ++i;
}
- QDomNode child = d.firstChild();
+ TQDomNode child = d.firstChild();
child = child.firstChild();
MyMoneyReport report;
@@ -3484,13 +3476,13 @@ const QMap<QString, MyMoneyReport> MyMoneyStorageSql::fetchReports (const QStrin
return rList;
}
-const QMap<QString, MyMoneyBudget> MyMoneyStorageSql::fetchBudgets (const QStringList& idList, bool forUpdate) const {
+const TQMap<TQString, MyMoneyBudget> MyMoneyStorageSql::fetchBudgets (const TQStringList& idList, bool forUpdate) const {
DBG("*** Entering MyMoneyStorageSql::readBudgets");
- signalProgress(0, m_budgets, QObject::tr("Loading budgets..."));
+ signalProgress(0, m_budgets, TQObject::tr("Loading budgets..."));
int progress = 0;
const MyMoneyDbTable& t = m_db.m_tables["kmmBudgetConfig"];
MyMoneySqlQuery q(const_cast <MyMoneyStorageSql*> (this));
- QString queryString (t.selectAllString(false));
+ TQString queryString (t.selectAllString(false));
if (! idList.empty()) {
queryString += " WHERE id = '" + idList.join("' OR id = '") + "'";
}
@@ -3500,17 +3492,17 @@ const QMap<QString, MyMoneyBudget> MyMoneyStorageSql::fetchBudgets (const QStrin
queryString += ";";
q.prepare (queryString);
- if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, QString("reading budgets")));
- QMap<QString, MyMoneyBudget> budgets;
+ if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString("reading budgets")));
+ TQMap<TQString, MyMoneyBudget> budgets;
while (q.next()) {
MyMoneyDbTable::field_iterator ft = t.begin();
int i = 0;
- QDomDocument d;
+ TQDomDocument d;
while (ft != t.end()) {
CASE(XML) d.setContent(GETSTRING, false);
++ft; ++i;
}
- QDomNode child = d.firstChild();
+ TQDomNode child = d.firstChild();
child = child.firstChild();
MyMoneyBudget budget (child.toElement());
budgets.insert(budget.id(), budget);
@@ -3523,25 +3515,25 @@ void MyMoneyStorageSql::readBudgets(void) {
m_storage->loadBudgets(fetchBudgets());
}
-const MyMoneyKeyValueContainer MyMoneyStorageSql::readKeyValuePairs (const QString& kvpType, const QString& kvpId) const {
+const MyMoneyKeyValueContainer MyMoneyStorageSql::readKeyValuePairs (const TQString& kvpType, const TQString& kvpId) const {
DBG("*** Entering MyMoneyStorageSql::readKeyValuePairs");
MyMoneyKeyValueContainer list;
MyMoneySqlQuery q(const_cast <MyMoneyStorageSql*> (this));
q.prepare ("SELECT kvpKey, kvpData from kmmKeyValuePairs where kvpType = :type and kvpId = :id;");
q.bindValue(":type", kvpType);
q.bindValue(":id", kvpId);
- if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, QString("reading Kvp for %1 %2").arg(kvpType)
- .arg(kvpId)));
+ if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString("reading Kvp for %1 %2").tqarg(kvpType)
+ .tqarg(kvpId)));
while (q.next()) list.setValue(q.value(0).toString(), q.value(1).toString());
return (list);
}
-const QMap<QString, MyMoneyKeyValueContainer> MyMoneyStorageSql::readKeyValuePairs (const QString& kvpType, const QStringList& kvpIdList) const {
+const TQMap<TQString, MyMoneyKeyValueContainer> MyMoneyStorageSql::readKeyValuePairs (const TQString& kvpType, const TQStringList& kvpIdList) const {
DBG("*** Entering MyMoneyStorageSql::readKeyValuePairs");
- QMap<QString, MyMoneyKeyValueContainer> retval;
+ TQMap<TQString, MyMoneyKeyValueContainer> retval;
MyMoneySqlQuery q(const_cast <MyMoneyStorageSql*> (this));
- QString query ("SELECT kvpId, kvpKey, kvpData from kmmKeyValuePairs where kvpType = :type");
+ TQString query ("SELECT kvpId, kvpKey, kvpData from kmmKeyValuePairs where kvpType = :type");
if (!kvpIdList.empty()) {
query += " and kvpId IN ('" + kvpIdList.join("', '") + "')";
@@ -3550,7 +3542,7 @@ const QMap<QString, MyMoneyKeyValueContainer> MyMoneyStorageSql::readKeyValuePai
query += " order by kvpId;";
q.prepare (query);
q.bindValue(":type", kvpType);
- if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, QString("reading Kvp List for %1").arg(kvpType)));
+ if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString("reading Kvp List for %1").tqarg(kvpType)));
while (q.next()) {
retval [q.value(0).toString()].setValue(q.value(1).toString(), q.value(2).toString());
}
@@ -3607,7 +3599,7 @@ long unsigned MyMoneyStorageSql::incrementBudgetId() {
q.next();
long unsigned returnValue = (unsigned long) q.value(0).toULongLong();
++returnValue;
- q.prepare("UPDATE kmmFileInfo SET hiBudgetId = " + QString::number(returnValue));
+ q.prepare("UPDATE kmmFileInfo SET hiBudgetId = " + TQString::number(returnValue));
q.exec();
endCommitUnit (__func__);
m_hiIdBudgets = returnValue;
@@ -3623,7 +3615,7 @@ long unsigned MyMoneyStorageSql::incrementAccountId() {
q.next();
long unsigned returnValue = (unsigned long) q.value(0).toULongLong();
++returnValue;
- q.prepare("UPDATE kmmFileInfo SET hiAccountId = " + QString::number(returnValue));
+ q.prepare("UPDATE kmmFileInfo SET hiAccountId = " + TQString::number(returnValue));
q.exec();
endCommitUnit (__func__);
m_hiIdAccounts = returnValue;
@@ -3639,7 +3631,7 @@ long unsigned MyMoneyStorageSql::incrementInstitutionId() {
q.next();
long unsigned returnValue = (unsigned long) q.value(0).toULongLong();
++returnValue;
- q.prepare("UPDATE kmmFileInfo SET hiInstitutionId = " + QString::number(returnValue));
+ q.prepare("UPDATE kmmFileInfo SET hiInstitutionId = " + TQString::number(returnValue));
q.exec();
endCommitUnit (__func__);
m_hiIdInstitutions = returnValue;
@@ -3655,7 +3647,7 @@ long unsigned MyMoneyStorageSql::incrementPayeeId() {
q.next();
long unsigned returnValue = (unsigned long) q.value(0).toULongLong();
++returnValue;
- q.prepare("UPDATE kmmFileInfo SET hiPayeeId = " + QString::number(returnValue));
+ q.prepare("UPDATE kmmFileInfo SET hiPayeeId = " + TQString::number(returnValue));
q.exec();
endCommitUnit (__func__);
m_hiIdPayees = returnValue;
@@ -3671,7 +3663,7 @@ long unsigned MyMoneyStorageSql::incrementReportId() {
q.next();
long unsigned returnValue = (unsigned long) q.value(0).toULongLong();
++returnValue;
- q.prepare("UPDATE kmmFileInfo SET hiReportId = " + QString::number(returnValue));
+ q.prepare("UPDATE kmmFileInfo SET hiReportId = " + TQString::number(returnValue));
q.exec();
endCommitUnit (__func__);
m_hiIdReports = returnValue;
@@ -3687,7 +3679,7 @@ long unsigned MyMoneyStorageSql::incrementScheduleId() {
q.next();
long unsigned returnValue = (unsigned long) q.value(0).toULongLong();
++returnValue;
- q.prepare("UPDATE kmmFileInfo SET hiScheduleId = " + QString::number(returnValue));
+ q.prepare("UPDATE kmmFileInfo SET hiScheduleId = " + TQString::number(returnValue));
q.exec();
endCommitUnit (__func__);
m_hiIdSchedules = returnValue;
@@ -3703,7 +3695,7 @@ long unsigned MyMoneyStorageSql::incrementSecurityId() {
q.next();
long unsigned returnValue = (unsigned long) q.value(0).toULongLong();
++returnValue;
- q.prepare("UPDATE kmmFileInfo SET hiSecurityId = " + QString::number(returnValue));
+ q.prepare("UPDATE kmmFileInfo SET hiSecurityId = " + TQString::number(returnValue));
q.exec();
endCommitUnit (__func__);
m_hiIdSecurities = returnValue;
@@ -3719,7 +3711,7 @@ long unsigned MyMoneyStorageSql::incrementTransactionId() {
q.next();
long unsigned returnValue = (unsigned long) q.value(0).toULongLong();
++returnValue;
- q.prepare("UPDATE kmmFileInfo SET hiTransactionId = " + QString::number(returnValue));
+ q.prepare("UPDATE kmmFileInfo SET hiTransactionId = " + TQString::number(returnValue));
q.exec();
endCommitUnit (__func__);
m_hiIdTransactions = returnValue;
@@ -3776,33 +3768,33 @@ void MyMoneyStorageSql::loadBudgetId(const unsigned long& id)
//****************************************************
long unsigned MyMoneyStorageSql::calcHighId
- (const long unsigned& i, const QString& id) {
+ (const long unsigned& i, const TQString& id) {
DBG("*** Entering MyMoneyStorageSql::calcHighId");
- QString nid = id;
- long unsigned high = (unsigned long) nid.replace(QRegExp("[A-Z]*"), "").toULongLong();
+ TQString nid = id;
+ long unsigned high = (unsigned long) nid.tqreplace(TQRegExp("[A-Z]*"), "").toULongLong();
return std::max(high, i);
}
-void MyMoneyStorageSql::setProgressCallback(void(*callback)(int, int, const QString&)) {
+void MyMoneyStorageSql::setProgressCallback(void(*callback)(int, int, const TQString&)) {
m_progressCallback = callback;
}
-void MyMoneyStorageSql::signalProgress(int current, int total, const QString& msg) const {
+void MyMoneyStorageSql::signalProgress(int current, int total, const TQString& msg) const {
if (m_progressCallback != 0)
(*m_progressCallback)(current, total, msg);
}
// **************************** Error display routine *******************************
-QString& MyMoneyStorageSql::buildError (const QSqlQuery& q, const QString& function, const QString& message) const {
- QString s = QString("Error in function %1 : %2").arg(function).arg(message);
- QSqlError e = lastError();
- s += QString ("\nDriver = %1, Host = %2, User = %3, Database = %4")
- .arg(driverName()).arg(hostName()).arg(userName()).arg(databaseName());
- s += QString ("\nDriver Error: %1").arg(e.driverText());
- s += QString ("\nDatabase Error No %1: %2").arg(e.number()).arg(e.databaseText());
+TQString& MyMoneyStorageSql::buildError (const TQSqlQuery& q, const TQString& function, const TQString& message) const {
+ TQString s = TQString("Error in function %1 : %2").tqarg(function).tqarg(message);
+ TQSqlError e = lastError();
+ s += TQString ("\nDriver = %1, Host = %2, User = %3, Database = %4")
+ .tqarg(driverName()).tqarg(hostName()).tqarg(userName()).tqarg(databaseName());
+ s += TQString ("\nDriver Error: %1").tqarg(e.driverText());
+ s += TQString ("\nDatabase Error No %1: %2").tqarg(e.number()).tqarg(e.databaseText());
e = q.lastError();
- s += QString ("\nExecuted: %1").arg(q.executedQuery());
- s += QString ("\nQuery error No %1: %2").arg(e.number()).arg(e.text());
+ s += TQString ("\nExecuted: %1").tqarg(q.executedQuery());
+ s += TQString ("\nQuery error No %1: %2").tqarg(e.number()).tqarg(e.text());
const_cast <MyMoneyStorageSql*> (this)->m_error = s;
qDebug("%s", s.ascii());
@@ -3841,7 +3833,7 @@ MyMoneyDbDef::MyMoneyDbDef () {
//#define ISKEY true
void MyMoneyDbDef::FileInfo(void){
- QValueList<KSharedPtr <MyMoneyDbColumn> > fields;
+ TQValueList<KSharedPtr <MyMoneyDbColumn> > fields;
fields.append(new MyMoneyDbColumn("version", "varchar(16)"));
fields.append(new MyMoneyDbColumn("created", "date"));
fields.append(new MyMoneyDbColumn("lastModified", "date"));
@@ -3880,7 +3872,7 @@ void MyMoneyDbDef::FileInfo(void){
}
void MyMoneyDbDef::Institutions(void){
- QValueList<KSharedPtr <MyMoneyDbColumn> > fields;
+ TQValueList<KSharedPtr <MyMoneyDbColumn> > fields;
fields.append(new MyMoneyDbColumn("id", "varchar(32)", PRIMARYKEY, NOTNULL));
fields.append(new MyMoneyDbTextColumn("name", MyMoneyDbTextColumn::NORMAL, false, NOTNULL));
fields.append(new MyMoneyDbTextColumn("manager"));
@@ -3895,7 +3887,7 @@ void MyMoneyDbDef::Institutions(void){
}
void MyMoneyDbDef::Payees(void){
- QValueList<KSharedPtr <MyMoneyDbColumn> > fields;
+ TQValueList<KSharedPtr <MyMoneyDbColumn> > fields;
fields.append(new MyMoneyDbColumn("id", "varchar(32)", PRIMARYKEY, NOTNULL));
fields.append(new MyMoneyDbTextColumn("name"));
fields.append(new MyMoneyDbTextColumn("reference"));
@@ -3916,10 +3908,10 @@ void MyMoneyDbDef::Payees(void){
}
void MyMoneyDbDef::Accounts(void){
- QValueList<KSharedPtr <MyMoneyDbColumn> > fields;
+ TQValueList<KSharedPtr <MyMoneyDbColumn> > fields;
fields.append(new MyMoneyDbColumn("id", "varchar(32)", PRIMARYKEY, NOTNULL));
fields.append(new MyMoneyDbColumn("institutionId", "varchar(32)"));
- fields.append(new MyMoneyDbColumn("parentId", "varchar(32)"));
+ fields.append(new MyMoneyDbColumn("tqparentId", "varchar(32)"));
fields.append(new MyMoneyDbDatetimeColumn("lastReconciled"));
fields.append(new MyMoneyDbDatetimeColumn("lastModified"));
fields.append(new MyMoneyDbColumn("openingDate", "date"));
@@ -3939,7 +3931,7 @@ void MyMoneyDbDef::Accounts(void){
}
void MyMoneyDbDef::Transactions(void){
- QValueList<KSharedPtr <MyMoneyDbColumn> > fields;
+ TQValueList<KSharedPtr <MyMoneyDbColumn> > fields;
fields.append(new MyMoneyDbColumn("id", "varchar(32)", PRIMARYKEY, NOTNULL));
fields.append(new MyMoneyDbColumn("txType", "char(1)"));
fields.append(new MyMoneyDbDatetimeColumn("postDate"));
@@ -3953,7 +3945,7 @@ void MyMoneyDbDef::Transactions(void){
}
void MyMoneyDbDef::Splits(void){
- QValueList<KSharedPtr <MyMoneyDbColumn> > fields;
+ TQValueList<KSharedPtr <MyMoneyDbColumn> > fields;
fields.append(new MyMoneyDbColumn("transactionId", "varchar(32)", PRIMARYKEY, NOTNULL));
fields.append(new MyMoneyDbColumn("txType", "char(1)"));
fields.append(new MyMoneyDbIntColumn("splitId", MyMoneyDbIntColumn::SMALL, UNSIGNED, PRIMARYKEY, NOTNULL));
@@ -3973,7 +3965,7 @@ void MyMoneyDbDef::Splits(void){
fields.append(new MyMoneyDbDatetimeColumn("postDate"));
fields.append(new MyMoneyDbTextColumn("bankId"));
MyMoneyDbTable t("kmmSplits", fields);
- QStringList list;
+ TQStringList list;
list << "accountId" << "txType";
t.addIndex("kmmSplitsaccount_type", list, false);
t.buildSQLStrings();
@@ -3981,13 +3973,13 @@ void MyMoneyDbDef::Splits(void){
}
void MyMoneyDbDef::KeyValuePairs(void){
- QValueList<KSharedPtr <MyMoneyDbColumn> > fields;
+ TQValueList<KSharedPtr <MyMoneyDbColumn> > fields;
fields.append(new MyMoneyDbColumn("kvpType", "varchar(16)", false, NOTNULL));
fields.append(new MyMoneyDbColumn("kvpId", "varchar(32)"));
fields.append(new MyMoneyDbColumn("kvpKey", "varchar(255)", false, NOTNULL));
fields.append(new MyMoneyDbTextColumn("kvpData"));
MyMoneyDbTable t("kmmKeyValuePairs", fields);
- QStringList list;
+ TQStringList list;
list << "kvpType" << "kvpId";
t.addIndex("type_id", list, false);
t.buildSQLStrings();
@@ -3995,7 +3987,7 @@ void MyMoneyDbDef::KeyValuePairs(void){
}
void MyMoneyDbDef::Schedules(void){
- QValueList<KSharedPtr <MyMoneyDbColumn> > fields;
+ TQValueList<KSharedPtr <MyMoneyDbColumn> > fields;
fields.append(new MyMoneyDbColumn("id", "varchar(32)", PRIMARYKEY, NOTNULL));
fields.append(new MyMoneyDbTextColumn("name", MyMoneyDbTextColumn::NORMAL, false, NOTNULL));
fields.append(new MyMoneyDbIntColumn("type", MyMoneyDbIntColumn::TINY, UNSIGNED, false, NOTNULL));
@@ -4022,7 +4014,7 @@ void MyMoneyDbDef::Schedules(void){
}
void MyMoneyDbDef::SchedulePaymentHistory(void){
- QValueList<KSharedPtr <MyMoneyDbColumn> > fields;
+ TQValueList<KSharedPtr <MyMoneyDbColumn> > fields;
fields.append(new MyMoneyDbColumn("schedId", "varchar(32)", PRIMARYKEY, NOTNULL));
fields.append(new MyMoneyDbColumn("payDate", "date", PRIMARYKEY, NOTNULL));
MyMoneyDbTable t("kmmSchedulePaymentHistory", fields);
@@ -4031,7 +4023,7 @@ void MyMoneyDbDef::SchedulePaymentHistory(void){
}
void MyMoneyDbDef::Securities(void){
- QValueList<KSharedPtr <MyMoneyDbColumn> > fields;
+ TQValueList<KSharedPtr <MyMoneyDbColumn> > fields;
fields.append(new MyMoneyDbColumn("id", "varchar(32)", PRIMARYKEY, NOTNULL));
fields.append(new MyMoneyDbColumn("name", "text", false, NOTNULL));
fields.append(new MyMoneyDbTextColumn("symbol"));
@@ -4046,7 +4038,7 @@ void MyMoneyDbDef::Securities(void){
}
void MyMoneyDbDef::Prices(void){
- QValueList<KSharedPtr <MyMoneyDbColumn> > fields;
+ TQValueList<KSharedPtr <MyMoneyDbColumn> > fields;
fields.append(new MyMoneyDbColumn("fromId", "varchar(32)", PRIMARYKEY, NOTNULL));
fields.append(new MyMoneyDbColumn("toId", "varchar(32)", PRIMARYKEY, NOTNULL));
fields.append(new MyMoneyDbColumn("priceDate", "date", PRIMARYKEY, NOTNULL));
@@ -4059,7 +4051,7 @@ void MyMoneyDbDef::Prices(void){
}
void MyMoneyDbDef::Currencies(void){
- QValueList<KSharedPtr <MyMoneyDbColumn> > fields;
+ TQValueList<KSharedPtr <MyMoneyDbColumn> > fields;
fields.append(new MyMoneyDbColumn("ISOcode", "char(3)", PRIMARYKEY, NOTNULL));
fields.append(new MyMoneyDbTextColumn("name", MyMoneyDbTextColumn::NORMAL, false, NOTNULL));
fields.append(new MyMoneyDbIntColumn("type", MyMoneyDbIntColumn::SMALL, UNSIGNED));
@@ -4077,7 +4069,7 @@ void MyMoneyDbDef::Currencies(void){
}
void MyMoneyDbDef::Reports(void) {
- QValueList<KSharedPtr <MyMoneyDbColumn> > fields;
+ TQValueList<KSharedPtr <MyMoneyDbColumn> > fields;
fields.append(new MyMoneyDbColumn("name", "varchar(255)", false, NOTNULL));
fields.append(new MyMoneyDbTextColumn("XML", MyMoneyDbTextColumn::LONG));
fields.append(new MyMoneyDbColumn("id", "varchar(32)", PRIMARYKEY, NOTNULL));
@@ -4087,7 +4079,7 @@ void MyMoneyDbDef::Reports(void) {
}
void MyMoneyDbDef::Budgets(void){
- QValueList<KSharedPtr <MyMoneyDbColumn> > fields;
+ TQValueList<KSharedPtr <MyMoneyDbColumn> > fields;
fields.append(new MyMoneyDbColumn("id", "varchar(32)", PRIMARYKEY, NOTNULL));
fields.append(new MyMoneyDbColumn("name", "text", false, NOTNULL));
fields.append(new MyMoneyDbColumn("start", "date", false, NOTNULL));
@@ -4111,8 +4103,8 @@ void MyMoneyDbDef::Balances(void){
}
// function to write create SQL to a stream
-const QString MyMoneyDbDef::generateSQL (const QString& driver) const {
- QString retval;
+const TQString MyMoneyDbDef::generateSQL (const TQString& driver) const {
+ TQString retval;
databaseTypeE dbType = m_drivers.driverToType(driver);
table_iterator tt = tableBegin();
while (tt != tableEnd()) {
@@ -4127,31 +4119,31 @@ const QString MyMoneyDbDef::generateSQL (const QString& driver) const {
retval += '\n';
MyMoneyDbTable fi = m_tables["kmmFileInfo"];
- QString qs = fi.insertString();
+ TQString qs = fi.insertString();
MyMoneyDbTable::field_iterator fit;
for (fit = fi.begin(); fit != fi.end(); ++fit) {
- QString toReplace = (*fit)->name();
+ TQString toReplace = (*fit)->name();
toReplace.prepend(':');
- QString replace = "NULL";
+ TQString tqreplace = "NULL";
if ((*fit)->name() == "version")
- replace = QString::number(m_currentVersion);
+ tqreplace = TQString::number(m_currentVersion);
if ((*fit)->name() == "fixLevel")
- replace = QString::number
+ tqreplace = TQString::number
(MyMoneyFile::instance()->storage()->currentFixVersion());
if ((*fit)->name() == "created")
- replace = QDate::currentDate().toString(Qt::ISODate);
+ tqreplace = TQDate::tqcurrentDate().toString(Qt::ISODate);
if ((*fit)->name() == "lastModified")
- replace = QDate::currentDate().toString(Qt::ISODate);
+ tqreplace = TQDate::tqcurrentDate().toString(Qt::ISODate);
if ((*fit)->name() == "updateInProgress")
- replace = enclose("N");
- qs.replace(toReplace, replace);
+ tqreplace = enclose("N");
+ qs.tqreplace(toReplace, tqreplace);
}
qs += "\n\n";
retval += qs;
- qs = QString();
+ qs = TQString();
unsigned int i;
- QValueList<MyMoneyAccount> stdList;
+ TQValueList<MyMoneyAccount> stdList;
stdList.append (MyMoneyFile::instance()->asset());
stdList.append (MyMoneyFile::instance()->equity());
stdList.append (MyMoneyFile::instance()->expense());
@@ -4164,23 +4156,23 @@ const QString MyMoneyDbDef::generateSQL (const QString& driver) const {
MyMoneyDbTable::field_iterator act;
// do the following in reverse so the 'formatted' fields are
// correctly handled.
- // Hmm, how does one use a QValueListIterator in reverse
- // It'll be okay in Qt4 with QListIterator
+ // Hmm, how does one use a TQValueListIterator in reverse
+ // It'll be okay in TQt4 with TQListIterator
for (act = ac.end(), --act; act != ac.begin(); --act) {
- QString toReplace = (*act)->name();
+ TQString toReplace = (*act)->name();
toReplace.prepend(':');
- QString replace = "NULL";
+ TQString tqreplace = "NULL";
if ((*act)->name() == "accountType")
- replace = QString::number(pac->accountType());
+ tqreplace = TQString::number(pac->accountType());
if ((*act)->name() == "accountTypeString")
- replace = enclose(pac->name());
+ tqreplace = enclose(pac->name());
if ((*act)->name() == "isStockAccount")
- replace = enclose("N");
+ tqreplace = enclose("N");
if ((*act)->name() == "accountName")
- replace = enclose(pac->name());
- qs.replace(toReplace, replace);
+ tqreplace = enclose(pac->name());
+ qs.tqreplace(toReplace, tqreplace);
}
- qs.replace (":id", enclose(pac->id())); // a real kludge
+ qs.tqreplace (":id", enclose(pac->id())); // a real kludge
qs += "\n\n";
retval += qs;
}
@@ -4189,19 +4181,19 @@ const QString MyMoneyDbDef::generateSQL (const QString& driver) const {
//*****************************************************************************
-void MyMoneyDbTable::addIndex(const QString& name, const QStringList& columns, bool unique) {
+void MyMoneyDbTable::addIndex(const TQString& name, const TQStringList& columns, bool unique) {
m_indices.push_back (MyMoneyDbIndex (m_name, name, columns, unique));
}
void MyMoneyDbTable::buildSQLStrings (void) {
// build fixed SQL strings for this table
// build the insert string with placeholders for each field
- QString qs = QString("INSERT INTO %1 (").arg(name());
- QString ws = ") VALUES (";
+ TQString qs = TQString("INSERT INTO %1 (").tqarg(name());
+ TQString ws = ") VALUES (";
field_iterator ft = m_fields.begin();
while (ft != m_fields.end()) {
- qs += QString("%1, ").arg((*ft)->name());
- ws += QString(":%1, ").arg((*ft)->name());
+ qs += TQString("%1, ").tqarg((*ft)->name());
+ ws += TQString(":%1, ").tqarg((*ft)->name());
++ft;
}
qs = qs.left(qs.length() - 2);
@@ -4213,14 +4205,14 @@ void MyMoneyDbTable::buildSQLStrings (void) {
// build an update string; key fields go in the where clause
qs = "UPDATE " + name() + " SET ";
- ws = QString();
+ ws = TQString();
ft = m_fields.begin();
while (ft != m_fields.end()) {
if ((*ft)->isPrimaryKey()) {
if (!ws.isEmpty()) ws += " AND ";
- ws += QString("%1 = :%2").arg((*ft)->name()).arg((*ft)->name());
+ ws += TQString("%1 = :%2").tqarg((*ft)->name()).tqarg((*ft)->name());
} else {
- qs += QString("%1 = :%2, ").arg((*ft)->name()).arg((*ft)->name());
+ qs += TQString("%1 = :%2, ").tqarg((*ft)->name()).tqarg((*ft)->name());
}
++ft;
}
@@ -4233,20 +4225,20 @@ void MyMoneyDbTable::buildSQLStrings (void) {
m_deleteString = qs + ";";
}
-const QString MyMoneyDbTable::columnList() const {
+const TQString MyMoneyDbTable::columnList() const {
field_iterator ft = m_fields.begin();
- QString qs;
+ TQString qs;
ft = m_fields.begin();
while (ft != m_fields.end()) {
- qs += QString("%1, ").arg((*ft)->name());
+ qs += TQString("%1, ").tqarg((*ft)->name());
++ft;
}
return (qs.left(qs.length() - 2));
}
-const QString MyMoneyDbTable::generateCreateSQL (databaseTypeE dbType) const {
- QString qs = QString("CREATE TABLE %1 (").arg(name());
- QString pkey;
+const TQString MyMoneyDbTable::generateCreateSQL (databaseTypeE dbType) const {
+ TQString qs = TQString("CREATE TABLE %1 (").tqarg(name());
+ TQString pkey;
for (field_iterator it = m_fields.begin(); it != m_fields.end(); ++it) {
qs += (*it)->generateDDL (dbType) + ", ";
if ((*it)->isPrimaryKey ())
@@ -4271,7 +4263,7 @@ const QString MyMoneyDbTable::generateCreateSQL (databaseTypeE dbType) const {
return qs;
}
-const QString MyMoneyDbTable::dropPrimaryKeyString(databaseTypeE dbType) const
+const TQString MyMoneyDbTable::dropPrimaryKeyString(databaseTypeE dbType) const
{
if (dbType == Mysql || dbType == Oracle8)
return "ALTER TABLE " + m_name + " DROP PRIMARY KEY;";
@@ -4283,8 +4275,8 @@ const QString MyMoneyDbTable::dropPrimaryKeyString(databaseTypeE dbType) const
return "";
}
-const QString MyMoneyDbTable::modifyColumnString(databaseTypeE dbType, const QString& columnName, const MyMoneyDbColumn& newDef) const {
- QString qs = "ALTER TABLE " + m_name + " ";
+const TQString MyMoneyDbTable::modifyColumnString(databaseTypeE dbType, const TQString& columnName, const MyMoneyDbColumn& newDef) const {
+ TQString qs = "ALTER TABLE " + m_name + " ";
if (dbType == Mysql)
qs += "CHANGE " + columnName + " " + newDef.generateDDL(dbType);
else if (dbType == Postgresql)
@@ -4298,14 +4290,14 @@ const QString MyMoneyDbTable::modifyColumnString(databaseTypeE dbType, const QSt
}
//*****************************************************************************
-const QString MyMoneyDbIndex::generateDDL (databaseTypeE dbType) const
+const TQString MyMoneyDbIndex::generateDDL (databaseTypeE dbType) const
{
Q_UNUSED(dbType);
- QString qs = "CREATE ";
+ TQString qs = "CREATE ";
if (m_unique)
- qs += "UNIQUE ";
+ qs += "UNITQUE ";
qs += "INDEX " + m_table + "_" + m_name + "_idx ON "
+ m_table + " (";
@@ -4315,7 +4307,7 @@ const QString MyMoneyDbIndex::generateDDL (databaseTypeE dbType) const
// the result of an SQL function, but not a partial column. There should be
// a way to merge these, and support other DBMSs like SQLite at the same time.
// For now, if we just use plain columns, this will work fine.
- for (QStringList::const_iterator it = m_columns.begin(); it != m_columns.end(); ++it) {
+ for (TQStringList::const_iterator it = m_columns.begin(); it != m_columns.end(); ++it) {
qs += *it + ",";
}
@@ -4341,18 +4333,18 @@ MyMoneyDbDatetimeColumn* MyMoneyDbDatetimeColumn::clone () const
MyMoneyDbTextColumn* MyMoneyDbTextColumn::clone () const
{ return (new MyMoneyDbTextColumn (*this)); }
-const QString MyMoneyDbColumn::generateDDL (databaseTypeE dbType) const
+const TQString MyMoneyDbColumn::generateDDL (databaseTypeE dbType) const
{
Q_UNUSED(dbType);
- QString qs = name() + " " + type();
+ TQString qs = name() + " " + type();
if (isNotNull()) qs += " NOT NULL";
return qs;
}
-const QString MyMoneyDbIntColumn::generateDDL (databaseTypeE dbType) const
+const TQString MyMoneyDbIntColumn::generateDDL (databaseTypeE dbType) const
{
- QString qs = name() + " ";
+ TQString qs = name() + " ";
switch (m_type) {
case MyMoneyDbIntColumn::TINY:
@@ -4423,9 +4415,9 @@ const QString MyMoneyDbIntColumn::generateDDL (databaseTypeE dbType) const
return qs;
}
-const QString MyMoneyDbTextColumn::generateDDL (databaseTypeE dbType) const
+const TQString MyMoneyDbTextColumn::generateDDL (databaseTypeE dbType) const
{
- QString qs = name() + " ";
+ TQString qs = name() + " ";
switch (m_type) {
case MyMoneyDbTextColumn::TINY:
@@ -4496,9 +4488,9 @@ const QString MyMoneyDbTextColumn::generateDDL (databaseTypeE dbType) const
return qs;
}
-const QString MyMoneyDbDatetimeColumn::generateDDL (databaseTypeE dbType) const
+const TQString MyMoneyDbDatetimeColumn::generateDDL (databaseTypeE dbType) const
{
- QString qs = name() + " ";
+ TQString qs = name() + " ";
if (dbType == Mysql || dbType == ODBC3) {
qs += "datetime ";
} else if (dbType == Postgresql || dbType == Db2 || dbType == Oracle8 || dbType == Sqlite3 ) {