X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2Fcommon%2Fcache.cpp;h=5f9a1651b1a3ba2d4262c0421182afa67d5b7ce2;hb=d97cbb873b74e7a9a9ecf3363a14d8a33a251cdc;hp=b339d4325e43933835c2d471621b78398adcc9c4;hpb=311f8d8c00ac52bcb59c1f3aa8523f905584f1bf;p=jenirok diff --git a/src/common/cache.cpp b/src/common/cache.cpp index b339d43..5f9a165 100644 --- a/src/common/cache.cpp +++ b/src/common/cache.cpp @@ -108,9 +108,12 @@ bool Cache::addItem(Source::Result const& result) query.bindValue(":street", result.street); query.bindValue(":city", result.city); + qDebug() << result.number << result.name << result.street << result.city; + if(!query.exec()) { + qDebug() << "Unable to add item to cache"; ret = false; } @@ -170,11 +173,12 @@ bool Cache::logItem(Source::Result const& result, bool missed, unsigned int time QSqlQuery query; - query.prepare("INSERT INTO log(number, name, street, city, time, missed) VALUES(:number, :name, :street, :city, :time, :missed)"); + query.prepare("INSERT INTO log(number, name, street, city, country, time, missed) VALUES(:number, :name, :street, :city, :country, :time, :missed)"); query.bindValue(":number", result.number); query.bindValue(":name", result.name); query.bindValue(":street", result.street); query.bindValue(":city", result.city); + query.bindValue(":country", result.country); query.bindValue(":time", time); int misVal = missed ? 1 : 0; @@ -233,7 +237,7 @@ void Cache::getLogItems(QList& items, int limit) DB::connect(); } - QSqlQuery query("SELECT number, name, street, city, time, missed FROM log ORDER BY time DESC LIMIT " + QString::number(limit)); + QSqlQuery query("SELECT number, name, street, city, country, time, missed FROM log ORDER BY time DESC LIMIT " + QString::number(limit)); while(query.next()) { @@ -242,9 +246,10 @@ void Cache::getLogItems(QList& items, int limit) details.result.name = query.value(1).toString(); details.result.street = query.value(2).toString(); details.result.city = query.value(3).toString(); - details.time = query.value(4).toInt(); + details.result.country = query.value(4).toString(); + details.time = query.value(5).toInt(); - int missed = query.value(5).toInt(); + int missed = query.value(6).toInt(); details.missed = missed ? true : false;