From 876b39964082ba3a2e1040a33a4d6c5cd5443758 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Fri, 1 Oct 2010 18:02:13 +0000 Subject: [PATCH] remove eventual existing row wit the key before inserting a new row svn path=/trunk/KDE/kdelibs/; revision=1181670 --- private/storage.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/private/storage.cpp b/private/storage.cpp index 4cb9548a1..654b94ca8 100644 --- a/private/storage.cpp +++ b/private/storage.cpp @@ -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());