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 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); }