summaryrefslogtreecommitdiffstats
path: root/kmymoney2/mymoney/storage/mymoneystoragesql.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-12-19 11:37:08 -0600
committerSlávek Banko <slavek.banko@axis.cz>2012-06-06 03:55:16 +0200
commit1de308fd3b1aacec7769d867a6eeaa98af69c61c (patch)
tree0a6433c4fe72a4e70d7686c84dcf9848ff8b7284 /kmymoney2/mymoney/storage/mymoneystoragesql.cpp
parente0d4ece30d7c0095bfdd9a81364b66fe18a0f2cb (diff)
downloadkmymoney-1de308fd3b1aacec7769d867a6eeaa98af69c61c.tar.gz
kmymoney-1de308fd3b1aacec7769d867a6eeaa98af69c61c.zip
Remove additional unneeded tq method conversions
(cherry picked from commit c70e40bd3f54a2c4d9ef57a36f19c996f4e00ed6)
Diffstat (limited to 'kmymoney2/mymoney/storage/mymoneystoragesql.cpp')
-rw-r--r--kmymoney2/mymoney/storage/mymoneystoragesql.cpp100
1 files changed, 50 insertions, 50 deletions
diff --git a/kmymoney2/mymoney/storage/mymoneystoragesql.cpp b/kmymoney2/mymoney/storage/mymoneystoragesql.cpp
index 7973519..b518585 100644
--- a/kmymoney2/mymoney/storage/mymoneystoragesql.cpp
+++ b/kmymoney2/mymoney/storage/mymoneystoragesql.cpp
@@ -60,11 +60,11 @@ MyMoneySqlQuery::MyMoneySqlQuery (MyMoneyStorageSql* db)
}
bool MyMoneySqlQuery::exec () {
- TRACE(TQString("start sql - %1").tqarg(lastQuery()));
+ TRACE(TQString("start sql - %1").arg(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()));
+ TRACE (msg.arg(TQSqlQuery::executedQuery()).arg(rc).arg(numRowsAffected()));
+ //DBG (TQString("%1\n***Query returned %2, row count %3").arg(TQSqlQuery::executedQuery()).arg(rc).arg(size()));
return (rc);
}
@@ -97,7 +97,7 @@ databaseTypeE MyMoneyDbDrivers::driverToType (const TQString& driver) const {
else if (driver == "QPSQL7") return(Postgresql);
else if (driver == "QTDS7") return(Sybase);
else if (driver == "QSQLITE3") return(Sqlite3);
- else throw new MYMONEYEXCEPTION (TQString("Unknown database driver type").tqarg(driver));
+ else throw new MYMONEYEXCEPTION (TQString("Unknown database driver type").arg(driver));
}
bool MyMoneyDbDrivers::isTested (databaseTypeE dbType) const {
@@ -182,7 +182,7 @@ try {
}
break;
default:
- qFatal("%s", TQString("%1 - unknown open mode %2").tqarg(__func__).tqarg(openMode).data());
+ qFatal("%s", TQString("%1 - unknown open mode %2").arg(__func__).arg(openMode).data());
}
if (rc != 0) return (rc);
// bypass logon check if we are creating a database
@@ -192,9 +192,9 @@ try {
if (!m_logonUser.isEmpty() && (!m_override)) {
m_error = TQString
(i18n("Database apparently 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"));
+ .arg(m_logonUser)
+ .arg(m_logonAt.date().toString(Qt::ISODate))
+ .arg(m_logonAt.time().toString("hh.mm.ss"));
qDebug("%s", m_error.data());
close(false);
rc = -1;
@@ -229,7 +229,7 @@ int MyMoneyStorageSql::createDatabase (const KURL& url) {
if (m_dbType == Sqlite3) return(0); // not needed for sqlite
if (!m_dbType == Mysql) {
m_error =
- TQString(i18n("Cannot currently create database for driver %1; please create manually")).tqarg(driverName());
+ TQString(i18n("Cannot currently create database for driver %1; please create manually")).arg(driverName());
return (1);
}
// create the database (only works for mysql at present)
@@ -241,10 +241,10 @@ int MyMoneyStorageSql::createDatabase (const KURL& url) {
maindb->setPassword (url.pass());
maindb->open();
TQSqlQuery qm(maindb);
- TQString qs = TQString("CREATE DATABASE %1;").tqarg(dbName);
+ TQString qs = TQString("CREATE DATABASE %1;").arg(dbName);
qm.prepare (qs);
if (!qm.exec()) {
- buildError (qm, __func__, TQString(i18n("Error in create database %1; do you have create permissions?")).tqarg(dbName));
+ buildError (qm, __func__, TQString(i18n("Error in create database %1; do you have create permissions?")).arg(dbName));
return (1);
}
TQSqlDatabase::removeDatabase (maindb);
@@ -325,7 +325,7 @@ int MyMoneyStorageSql::upgradeDb() {
}
}
// write updated version to DB
- //setVersion(TQString("%1.%2").tqarg(m_dbVersion).tqarg(m_minorVersion));
+ //setVersion(TQString("%1.%2").arg(m_dbVersion).arg(m_minorVersion));
q.prepare (TQString("UPDATE kmmFileInfo SET version = :version;"));
q.bindValue(":version", m_dbVersion);
if (!q.exec()) {
@@ -363,12 +363,12 @@ bool MyMoneyStorageSql::addColumn
TQSqlQuery q(this);
TQString afterString = ";";
if (!after.isEmpty())
- afterString = TQString("AFTER %1;").tqarg(after);
+ afterString = TQString("AFTER %1;").arg(after);
q.prepare("ALTER TABLE " + t.name() + " ADD COLUMN " +
c.generateDDL(m_dbType) + afterString);
if (!q.exec()) {
buildError (q, __func__,
- TQString("Error adding column %1 to table %2").tqarg(c.name()).tqarg(t.name()));
+ TQString("Error adding column %1 to table %2").arg(c.name()).arg(t.name()));
return (false);
}
return (true);
@@ -392,7 +392,7 @@ bool MyMoneyStorageSql::dropColumn
+ col + ";");
if (!q.exec()) {
buildError (q, __func__,
- TQString("Error dropping column %1 from table %2").tqarg(col).tqarg(t.name()));
+ TQString("Error dropping column %1 from table %2").arg(col).arg(t.name()));
return (false);
}
return (true);
@@ -657,7 +657,7 @@ int MyMoneyStorageSql::upgradeToV6() {
// upgrade Mysql to InnoDB transaction-safe engine
if (m_dbType == Mysql) {
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()));
+ q.prepare(TQString("ALTER TABLE %1 ENGINE = InnoDB;").arg(tt.data().name()));
if (!q.exec()) {
buildError (q, __func__, "Error updating to InnoDB");
return (1);
@@ -737,7 +737,7 @@ bool MyMoneyStorageSql::sqliteAlterTable(const MyMoneyDbTable& t) {
long unsigned MyMoneyStorageSql::getRecCount (const TQString& table) const {
DBG("*** Entering MyMoneyStorageSql::getRecCount");
MyMoneySqlQuery q(const_cast <MyMoneyStorageSql*> (this));
- q.prepare(TQString("SELECT COUNT(*) FROM %1;").tqarg(table));
+ q.prepare(TQString("SELECT COUNT(*) FROM %1;").arg(table));
if ((!q.exec()) || (!q.next())) {
buildError (q, __func__, "error retrieving record count");
qFatal("Error retrieving record count"); // definitely shouldn't happen
@@ -763,7 +763,7 @@ int MyMoneyStorageSql::createTables () {
for (TQMapConstIterator<TQString, MyMoneyDbView> tt = m_db.viewBegin(); tt != m_db.viewEnd(); ++tt) {
if (!lowerTables.contains(tt.key().lower())) {
q.prepare (tt.data().createString());
- if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString ("creating view %1").tqarg(tt.key())));
+ if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString ("creating view %1").arg(tt.key())));
}
}
@@ -780,7 +780,7 @@ void MyMoneyStorageSql::createTable (const MyMoneyDbTable& t) {
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__, TQString ("creating table/index %1").tqarg(t.name())));
+ if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString ("creating table/index %1").arg(t.name())));
}
}
@@ -791,7 +791,7 @@ int MyMoneyStorageSql::isEmpty () {
int recordCount = 0;
MyMoneySqlQuery q(this);
while ((tt != m_db.tableEnd()) && (recordCount == 0)) {
- q.prepare (TQString("select count(*) from %1;").tqarg((*tt).name()));
+ q.prepare (TQString("select count(*) from %1;").arg((*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();
@@ -811,7 +811,7 @@ void MyMoneyStorageSql::clean() {
TQMapConstIterator<TQString, MyMoneyDbTable> it = m_db.tableBegin();
MyMoneySqlQuery q(this);
while (it != m_db.tableEnd()) {
- q.prepare(TQString("DELETE from %1;").tqarg(it.key()));
+ q.prepare(TQString("DELETE from %1;").arg(it.key()));
if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString ("cleaning database")));
++it;
}
@@ -921,7 +921,7 @@ bool MyMoneyStorageSql::endCommitUnit (const TQString& callingFunction) {
// as value of this method.
bool rc = true;
if (callingFunction != m_commitUnitStack.top())
- qDebug("%s", TQString("%1 - %2 s/be %3").tqarg(__func__).tqarg(callingFunction).tqarg(m_commitUnitStack.top()).data());
+ qDebug("%s", TQString("%1 - %2 s/be %3").arg(__func__).arg(callingFunction).arg(m_commitUnitStack.top()).data());
m_commitUnitStack.pop();
if (m_commitUnitStack.isEmpty()) {
if (!commit()) throw new MYMONEYEXCEPTION(buildError (MyMoneySqlQuery(), __func__, "ending commit unit"));
@@ -932,7 +932,7 @@ bool MyMoneyStorageSql::endCommitUnit (const TQString& callingFunction) {
void MyMoneyStorageSql::cancelCommitUnit (const TQString& callingFunction) {
DBG("*** Entering MyMoneyStorageSql::cancelCommitUnit");
if (callingFunction != m_commitUnitStack.top())
- qDebug("%s", TQString("%1 - %2 s/be %3").tqarg(__func__).tqarg(callingFunction).tqarg(m_commitUnitStack.top()).data());
+ qDebug("%s", TQString("%1 - %2 s/be %3").arg(__func__).arg(callingFunction).arg(m_commitUnitStack.top()).data());
if (m_commitUnitStack.isEmpty()) return;
m_commitUnitStack.clear();
if (!rollback()) throw new MYMONEYEXCEPTION(buildError (MyMoneySqlQuery(), __func__, "cancelling commit unit"));
@@ -2239,7 +2239,7 @@ void MyMoneyStorageSql::deleteKeyValuePairs (const TQString& kvpType, const TQSt
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__, TQString("deleting kvp for %1 %2").tqarg(kvpType).tqarg(kvpId)));
+ if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString("deleting kvp for %1 %2").arg(kvpType).arg(kvpId)));
m_kvps -= q.numRowsAffected();
}
@@ -2428,7 +2428,7 @@ const TQMap<TQString, MyMoneyPayee> MyMoneyStorageSql::fetchPayees (const TQStri
TQString itemConnector = "";
TQStringList::ConstIterator it;
for (it = idList.begin(); it != idList.end(); ++it) {
- whereClause.append(TQString("%1id = '%2'").tqarg(itemConnector).tqarg(*it));
+ whereClause.append(TQString("%1id = '%2'").arg(itemConnector).arg(*it));
itemConnector = " or ";
}
whereClause += ")";
@@ -2623,7 +2623,7 @@ const TQMap<TQString, MyMoneyMoney> MyMoneyStorageSql::fetchBalance(const TQStri
// 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 += TQString(" AND postDate < '%1'").tqarg(date.addDays(1).toString(Qt::ISODate));
+ queryString += TQString(" AND postDate < '%1'").arg(date.addDays(1).toString(Qt::ISODate));
DBG (queryString);
q.prepare(queryString);
@@ -2866,7 +2866,7 @@ const TQMap<TQString, MyMoneyTransaction> MyMoneyStorageSql::fetchTransactions (
TQStringList::const_iterator it;
for (it = payees.begin(); it != payees.end(); ++it) {
payeesClause.append(TQString("%1'%2'")
- .tqarg(itemConnector).tqarg(*it));
+ .arg(itemConnector).arg(*it));
itemConnector = ", ";
}
if (!payeesClause.isEmpty()) {
@@ -2885,7 +2885,7 @@ const TQMap<TQString, MyMoneyTransaction> MyMoneyStorageSql::fetchTransactions (
for (it = accounts.begin(); it != accounts.end(); ++it) {
// if (m_accountsLoaded.find(*it) == m_accountsLoaded.end()) {
accountsClause.append(TQString("%1 '%2'")
- .tqarg(itemConnector).tqarg(*it));
+ .arg(itemConnector).arg(*it));
itemConnector = ", ";
//if (accountsOnlyFilter) m_accountsLoaded.append(*it); // a bit premature...
// }
@@ -2904,8 +2904,8 @@ const TQMap<TQString, MyMoneyTransaction> MyMoneyStorageSql::fetchTransactions (
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))));
+ .arg(itemConnector)
+ .arg(splitState(MyMoneyTransactionFilter::stateOptionE(*it))));
itemConnector = ",";
}
if (!statesClause.isEmpty()) {
@@ -2941,19 +2941,19 @@ const TQMap<TQString, MyMoneyTransaction> MyMoneyStorageSql::fetchTransactions (
TQString dateClause;
TQString connector = "";
if (end != TQDate()) {
- dateClause = TQString("(postDate < '%1')").tqarg(end.addDays(1).toString(Qt::ISODate));
+ dateClause = TQString("(postDate < '%1')").arg(end.addDays(1).toString(Qt::ISODate));
connector = " and ";
}
if (start != TQDate()) {
- dateClause += TQString("%1 (postDate >= '%2')").tqarg(connector).tqarg(start.toString(Qt::ISODate));
+ dateClause += TQString("%1 (postDate >= '%2')").arg(connector).arg(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 = TQString("(select distinct transactionId from kmmSplits %1)").tqarg(whereClause);
+ inQuery = TQString("(select distinct transactionId from kmmSplits %1)").arg(whereClause);
} else {
- inQuery = TQString("(select distinct id from kmmTransactions where %1)").tqarg(dateClause);
+ inQuery = TQString("(select distinct id from kmmTransactions where %1)").arg(dateClause);
txFilterActive = false; // kill off the date filter now
}
@@ -3522,8 +3522,8 @@ const MyMoneyKeyValueContainer MyMoneyStorageSql::readKeyValuePairs (const TQStr
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__, TQString("reading Kvp for %1 %2").tqarg(kvpType)
- .tqarg(kvpId)));
+ if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString("reading Kvp for %1 %2").arg(kvpType)
+ .arg(kvpId)));
while (q.next()) list.setValue(q.value(0).toString(), q.value(1).toString());
return (list);
}
@@ -3542,7 +3542,7 @@ const TQMap<TQString, MyMoneyKeyValueContainer> MyMoneyStorageSql::readKeyValueP
query += " order by kvpId;";
q.prepare (query);
q.bindValue(":type", kvpType);
- if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString("reading Kvp List for %1").tqarg(kvpType)));
+ if (!q.exec()) throw new MYMONEYEXCEPTION(buildError (q, __func__, TQString("reading Kvp List for %1").arg(kvpType)));
while (q.next()) {
retval [q.value(0).toString()].setValue(q.value(1).toString(), q.value(2).toString());
}
@@ -3786,15 +3786,15 @@ void MyMoneyStorageSql::signalProgress(int current, int total, const TQString& m
// **************************** Error display routine *******************************
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);
+ TQString s = TQString("Error in function %1 : %2").arg(function).arg(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());
+ .arg(driverName()).arg(hostName()).arg(userName()).arg(databaseName());
+ s += TQString ("\nDriver Error: %1").arg(e.driverText());
+ s += TQString ("\nDatabase Error No %1: %2").arg(e.number()).arg(e.databaseText());
e = q.lastError();
- s += TQString ("\nExecuted: %1").tqarg(q.executedQuery());
- s += TQString ("\nQuery error No %1: %2").tqarg(e.number()).tqarg(e.text());
+ s += TQString ("\nExecuted: %1").arg(q.executedQuery());
+ s += TQString ("\nQuery error No %1: %2").arg(e.number()).arg(e.text());
const_cast <MyMoneyStorageSql*> (this)->m_error = s;
qDebug("%s", s.ascii());
@@ -4188,12 +4188,12 @@ void MyMoneyDbTable::addIndex(const TQString& name, const TQStringList& columns,
void MyMoneyDbTable::buildSQLStrings (void) {
// build fixed SQL strings for this table
// build the insert string with placeholders for each field
- TQString qs = TQString("INSERT INTO %1 (").tqarg(name());
+ TQString qs = TQString("INSERT INTO %1 (").arg(name());
TQString ws = ") VALUES (";
field_iterator ft = m_fields.begin();
while (ft != m_fields.end()) {
- qs += TQString("%1, ").tqarg((*ft)->name());
- ws += TQString(":%1, ").tqarg((*ft)->name());
+ qs += TQString("%1, ").arg((*ft)->name());
+ ws += TQString(":%1, ").arg((*ft)->name());
++ft;
}
qs = qs.left(qs.length() - 2);
@@ -4210,9 +4210,9 @@ void MyMoneyDbTable::buildSQLStrings (void) {
while (ft != m_fields.end()) {
if ((*ft)->isPrimaryKey()) {
if (!ws.isEmpty()) ws += " AND ";
- ws += TQString("%1 = :%2").tqarg((*ft)->name()).tqarg((*ft)->name());
+ ws += TQString("%1 = :%2").arg((*ft)->name()).arg((*ft)->name());
} else {
- qs += TQString("%1 = :%2, ").tqarg((*ft)->name()).tqarg((*ft)->name());
+ qs += TQString("%1 = :%2, ").arg((*ft)->name()).arg((*ft)->name());
}
++ft;
}
@@ -4230,14 +4230,14 @@ const TQString MyMoneyDbTable::columnList() const {
TQString qs;
ft = m_fields.begin();
while (ft != m_fields.end()) {
- qs += TQString("%1, ").tqarg((*ft)->name());
+ qs += TQString("%1, ").arg((*ft)->name());
++ft;
}
return (qs.left(qs.length() - 2));
}
const TQString MyMoneyDbTable::generateCreateSQL (databaseTypeE dbType) const {
- TQString qs = TQString("CREATE TABLE %1 (").tqarg(name());
+ TQString qs = TQString("CREATE TABLE %1 (").arg(name());
TQString pkey;
for (field_iterator it = m_fields.begin(); it != m_fields.end(); ++it) {
qs += (*it)->generateDDL (dbType) + ", ";