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.cpp84
1 files changed, 42 insertions, 42 deletions
diff --git a/kmymoney2/mymoney/storage/mymoneystoragesql.cpp b/kmymoney2/mymoney/storage/mymoneystoragesql.cpp
index f479c5c..4995d02 100644
--- a/kmymoney2/mymoney/storage/mymoneystoragesql.cpp
+++ b/kmymoney2/mymoney/storage/mymoneystoragesql.cpp
@@ -71,7 +71,7 @@ bool MyMoneySqlQuery::exec () {
bool MyMoneySqlQuery::prepare ( const TQString & query ) {
if (m_db->isSqlite3()) {
TQString newQuery = query;
- return (TQSqlQuery::prepare (newQuery.tqreplace("FOR UPDATE", "")));
+ return (TQSqlQuery::prepare (newQuery.replace("FOR UPDATE", "")));
}
return (TQSqlQuery::prepare (query));
}
@@ -136,8 +136,8 @@ try {
m_dbType = m_drivers.driverToType(driverName);
//get the input options
TQStringList options = TQStringList::split(',', url.queryItem("options"));
- m_loadAll = options.tqcontains("loadAll")/*|| m_mode == 0*/;
- m_override = options.tqcontains("override");
+ m_loadAll = options.contains("loadAll")/*|| m_mode == 0*/;
+ m_override = options.contains("override");
// create the database connection
TQString dbName = url.path().right(url.path().length() - 1); // remove separator slash
@@ -279,7 +279,7 @@ int MyMoneyStorageSql::upgradeDb() {
// prior to dbv6, 'version' format was 'dbversion.fixLevel+1'
// as of dbv6, these are separate fields
TQString version = q.value(0).toString();
- if (version.tqcontains('.')) {
+ if (version.contains('.')) {
m_dbVersion = q.value(0).toString().section('.', 0, 0).toUInt();
m_storage->setFileFixVersion(q.value(0).toString().section('.', 1, 1).toUInt() - 1);
} else {
@@ -358,7 +358,7 @@ bool MyMoneyStorageSql::addColumn
const TQString& after){
if ((m_dbType == Sqlite3) && (!after.isEmpty()))
qFatal("sqlite doesn't support 'AFTER'; use sqliteAlterTable");
- if (record(t.name()).tqcontains(c.name()))
+ if (record(t.name()).contains(c.name()))
return (true);
TQSqlQuery q(this);
TQString afterString = ";";
@@ -385,7 +385,7 @@ bool MyMoneyStorageSql::dropColumn
(const MyMoneyDbTable& t, const TQString& col){
if (m_dbType == Sqlite3)
qFatal("sqlite doesn't support 'DROP COLUMN'; use sqliteAlterTable");
- if (!record(t.name()).tqcontains(col))
+ if (!record(t.name()).contains(col))
return (true);
TQSqlQuery q(this);
q.prepare("ALTER TABLE " + t.name() + " DROP COLUMN "
@@ -712,7 +712,7 @@ int MyMoneyStorageSql::upgradeToV6() {
bool MyMoneyStorageSql::sqliteAlterTable(const MyMoneyDbTable& t) {
DBG("*** Entering MyMoneyStorageSql::sqliteAlterTable");
TQString tempTableName = t.name();
- tempTableName.tqreplace("kmm", "tmp");
+ tempTableName.replace("kmm", "tmp");
TQSqlQuery q(this);
q.prepare (TQString("ALTER TABLE " + t.name() + " RENAME TO " + tempTableName + ";"));
if (!q.exec()) {
@@ -756,12 +756,12 @@ int MyMoneyStorageSql::createTables () {
}
for (TQMapConstIterator<TQString, MyMoneyDbTable> tt = m_db.tableBegin(); tt != m_db.tableEnd(); ++tt) {
- if (!lowerTables.tqcontains(tt.key().lower())) createTable (tt.data());
+ if (!lowerTables.contains(tt.key().lower())) createTable (tt.data());
}
MyMoneySqlQuery q(this);
for (TQMapConstIterator<TQString, MyMoneyDbView> tt = m_db.viewBegin(); tt != m_db.viewEnd(); ++tt) {
- if (!lowerTables.tqcontains(tt.key().lower())) {
+ 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())));
}
@@ -972,7 +972,7 @@ void MyMoneyStorageSql::writeInstitutions() {
q2.prepare (m_db.m_tables["kmmInstitutions"].insertString());
signalProgress(0, list.count(), "Writing Institutions...");
for(it = list.begin(); it != list.end(); ++it) {
- if (dbList.tqcontains((*it).id())) {
+ if (dbList.contains((*it).id())) {
dbList.remove ((*it).id());
writeInstitution(*it, q);
} else {
@@ -1062,7 +1062,7 @@ void MyMoneyStorageSql::writePayees() {
q2.prepare (m_db.m_tables["kmmPayees"].insertString());
TQValueList<MyMoneyPayee>::ConstIterator it;
for(it = list.begin(); it != list.end(); ++it) {
- if (dbList.tqcontains((*it).id())) {
+ if (dbList.contains((*it).id())) {
dbList.remove ((*it).id());
writePayee(*it, q);
} else {
@@ -1224,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.tqcontains((*it).id())) {
+ if (dbList.contains((*it).id())) {
dbList.remove ((*it).id());
writeAccount(*it, q);
} else {
@@ -1365,7 +1365,7 @@ void MyMoneyStorageSql::writeTransactions() {
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.tqcontains((*it).id())) {
+ if (dbList.contains((*it).id())) {
dbList.remove ((*it).id());
writeTransaction((*it).id(), *it, q, "N");
} else {
@@ -1506,7 +1506,7 @@ void MyMoneyStorageSql::writeSplits(const TQString& txId, const TQString& type,
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.tqcontains(i)) {
+ if (dbList.contains(i)) {
dbList.remove (i);
writeSplit(txId, (*it), type, i, q);
} else {
@@ -1543,20 +1543,20 @@ void MyMoneyStorageSql::writeSplit(const TQString& txId, const MyMoneySplit& spl
q.bindValue(":value", split.value().toString());
q.bindValue(":valueFormatted", split.value()
.formatMoney("", -1, false)
- .tqreplace(TQChar(','), TQChar('.')));
+ .replace(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).
- tqreplace(TQChar(','), TQChar('.')));
+ replace(TQChar(','), TQChar('.')));
MyMoneyMoney price = split.actualPrice();
if (!price.isZero()) {
q.bindValue(":price", price.toString());
q.bindValue(":priceFormatted", price.formatMoney
("", KMyMoneySettings::pricePrecision(), false)
- .tqreplace(TQChar(','), TQChar('.')));
+ .replace(TQChar(','), TQChar('.')));
} else {
q.bindValue(":price", TQString());
q.bindValue(":priceFormatted", TQString());
@@ -1591,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.tqcontains((*it).id())) {
+ if (dbList.contains((*it).id())) {
dbList.remove ((*it).id());
insert = false;
writeSchedule(*it, q, insert);
@@ -1730,7 +1730,7 @@ void MyMoneyStorageSql::writeSecurities() {
q.prepare (m_db.m_tables["kmmSecurities"].updateString());
q2.prepare (m_db.m_tables["kmmSecurities"].insertString());
for(TQValueList<MyMoneySecurity>::ConstIterator it = securityList.begin(); it != securityList.end(); ++it) {
- if (dbList.tqcontains((*it).id())) {
+ if (dbList.contains((*it).id())) {
dbList.remove ((*it).id());
writeSecurity((*it), q);
} else {
@@ -1911,7 +1911,7 @@ void MyMoneyStorageSql::writeCurrencies() {
q.prepare (m_db.m_tables["kmmCurrencies"].updateString());
q2.prepare (m_db.m_tables["kmmCurrencies"].insertString());
for(TQValueList<MyMoneySecurity>::ConstIterator it = currencyList.begin(); it != currencyList.end(); ++it) {
- if (dbList.tqcontains((*it).id())) {
+ if (dbList.contains((*it).id())) {
dbList.remove ((*it).id());
writeCurrency((*it), q);
} else {
@@ -2000,7 +2000,7 @@ void MyMoneyStorageSql::writeReports() {
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.tqcontains((*it).id())) {
+ if (dbList.contains((*it).id())) {
dbList.remove ((*it).id());
writeReport(*it, q);
} else {
@@ -2082,7 +2082,7 @@ void MyMoneyStorageSql::writeBudgets() {
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.tqcontains((*it).name())) {
+ if (dbList.contains((*it).name())) {
dbList.remove ((*it).name());
writeBudget(*it, q);
} else {
@@ -2570,7 +2570,7 @@ const TQMap<TQString, MyMoneyAccount> MyMoneyStorageSql::fetchAccounts (const TQ
TQMapIterator<TQString, MyMoneyAccount> it_acc;
TQMapIterator<TQString, MyMoneyAccount> accListEnd = accList.end();
while (sq.next()) {
- it_acc = accList.tqfind(sq.value(1).toString());
+ it_acc = accList.find(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()) {
@@ -2794,7 +2794,7 @@ const TQMap<TQString, MyMoneyTransaction> MyMoneyStorageSql::fetchTransactions (
// TQStringList::iterator it;
// bool allAccountsLoaded = true;
// for (it = accounts.begin(); it != accounts.end(); ++it) {
-// if (m_accountsLoaded.tqfind(*it) == m_accountsLoaded.end()) {
+// if (m_accountsLoaded.find(*it) == m_accountsLoaded.end()) {
// allAccountsLoaded = false;
// break;
// }
@@ -2883,7 +2883,7 @@ const TQMap<TQString, MyMoneyTransaction> MyMoneyStorageSql::fetchTransactions (
TQString accountsClause = "";
TQStringList::const_iterator it;
for (it = accounts.begin(); it != accounts.end(); ++it) {
-// if (m_accountsLoaded.tqfind(*it) == m_accountsLoaded.end()) {
+// if (m_accountsLoaded.find(*it) == m_accountsLoaded.end()) {
accountsClause.append(TQString("%1 '%2'")
.tqarg(itemConnector).tqarg(*it));
itemConnector = ", ";
@@ -2914,8 +2914,8 @@ const TQMap<TQString, MyMoneyTransaction> MyMoneyStorageSql::fetchTransactions (
}
}
// I've given up trying to work out the logic. we keep getting the wrong number of close brackets
- int obc = whereClause.tqcontains('(');
- int cbc = whereClause.tqcontains(')');
+ int obc = whereClause.contains('(');
+ int cbc = whereClause.contains(')');
if (cbc > obc) {
qFatal("invalid where clause - %s", whereClause.latin1());
}
@@ -3771,7 +3771,7 @@ long unsigned MyMoneyStorageSql::calcHighId
(const long unsigned& i, const TQString& id) {
DBG("*** Entering MyMoneyStorageSql::calcHighId");
TQString nid = id;
- long unsigned high = (unsigned long) nid.tqreplace(TQRegExp("[A-Z]*"), "").toULongLong();
+ long unsigned high = (unsigned long) nid.replace(TQRegExp("[A-Z]*"), "").toULongLong();
return std::max(high, i);
}
@@ -4124,19 +4124,19 @@ const TQString MyMoneyDbDef::generateSQL (const TQString& driver) const {
for (fit = fi.begin(); fit != fi.end(); ++fit) {
TQString toReplace = (*fit)->name();
toReplace.prepend(':');
- TQString tqreplace = "NULL";
+ TQString replace = "NULL";
if ((*fit)->name() == "version")
- tqreplace = TQString::number(m_currentVersion);
+ replace = TQString::number(m_currentVersion);
if ((*fit)->name() == "fixLevel")
- tqreplace = TQString::number
+ replace = TQString::number
(MyMoneyFile::instance()->storage()->currentFixVersion());
if ((*fit)->name() == "created")
- tqreplace = TQDate::tqcurrentDate().toString(Qt::ISODate);
+ replace = TQDate::tqcurrentDate().toString(Qt::ISODate);
if ((*fit)->name() == "lastModified")
- tqreplace = TQDate::tqcurrentDate().toString(Qt::ISODate);
+ replace = TQDate::tqcurrentDate().toString(Qt::ISODate);
if ((*fit)->name() == "updateInProgress")
- tqreplace = enclose("N");
- qs.tqreplace(toReplace, tqreplace);
+ replace = enclose("N");
+ qs.replace(toReplace, replace);
}
qs += "\n\n";
retval += qs;
@@ -4161,18 +4161,18 @@ const TQString MyMoneyDbDef::generateSQL (const TQString& driver) const {
for (act = ac.end(), --act; act != ac.begin(); --act) {
TQString toReplace = (*act)->name();
toReplace.prepend(':');
- TQString tqreplace = "NULL";
+ TQString replace = "NULL";
if ((*act)->name() == "accountType")
- tqreplace = TQString::number(pac->accountType());
+ replace = TQString::number(pac->accountType());
if ((*act)->name() == "accountTypeString")
- tqreplace = enclose(pac->name());
+ replace = enclose(pac->name());
if ((*act)->name() == "isStockAccount")
- tqreplace = enclose("N");
+ replace = enclose("N");
if ((*act)->name() == "accountName")
- tqreplace = enclose(pac->name());
- qs.tqreplace(toReplace, tqreplace);
+ replace = enclose(pac->name());
+ qs.replace(toReplace, replace);
}
- qs.tqreplace (":id", enclose(pac->id())); // a real kludge
+ qs.replace (":id", enclose(pac->id())); // a real kludge
qs += "\n\n";
retval += qs;
}