remove eventual existing row wit the key before inserting a new row

svn path=/trunk/KDE/kdelibs/; revision=1181670
This commit is contained in:
Marco Martin 2010-10-01 18:02:13 +00:00
parent b0472dc212
commit 876b399640

View File

@ -59,6 +59,10 @@ void StorageJob::start()
if (operationName() == "save") {
QSqlQuery query(m_db);
query.prepare("delete from data where key = :id");
query.bindValue(":id", params["key"].toString());
query.exec();
query.prepare("insert into data values(:id, :source, :datavalue, 'now')");
query.bindValue(":id", params["key"].toString());
query.bindValue(":source", params["source"].toString());