[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdelibs/plasma/private
From: Marco Martin <notmart () gmail ! com>
Date: 2010-10-22 21:22:15
Message-ID: 20101022212216.049EDAC897 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1188661 by mart:
source or key parameters in retrieve
expire action
M +22 -0 storage.cpp
--- trunk/KDE/kdelibs/plasma/private/storage.cpp #1188660:1188661
@@ -80,8 +80,22 @@
query.bindValue(":date", time.toTime_t());
query.exec();
+ //a bit redundant but should be the faster way with less string concatenation as possible
+ if (params["source"].isNull() && params["key"].isNull()) {
+ setError(true);
+ return;
+ } else if (params["source"].isNull()) {
+ query.prepare("select * from data where key=:key");
+ query.bindValue(":source", params["source"].toString());
+ } else if (params["key"].isNull()) {
query.prepare("select * from data where source=:source");
query.bindValue(":source", params["source"].toString());
+ } else {
+ query.prepare("select * from data where source=:source and key=:key");
+ query.bindValue(":source", params["source"].toString());
+ query.bindValue(":key", params["key"].toString());
+ }
+
const bool success = query.exec();
QHash<QString, QVariant> h;
@@ -100,6 +114,14 @@
return;
}
+ } else if (operationName() == "expire") {
+ QSqlQuery query(m_db);
+ query.prepare("delete from data where date < :date");
+ QDateTime time(QDateTime::currentDateTime());
+ time.addDays(-2);
+ query.bindValue(":date", time.toTime_t());
+ query.exec();
+
} else {
setError(true);
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic