From 1d550b15ea4de6e84d2e84c76a59848eb49ae6dd Mon Sep 17 00:00:00 2001 From: Aaron Seigo Date: Thu, 28 Apr 2011 18:01:34 +0200 Subject: [PATCH] global transaction --- private/storage.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/private/storage.cpp b/private/storage.cpp index bbd109115..c5433834c 100644 --- a/private/storage.cpp +++ b/private/storage.cpp @@ -136,14 +136,11 @@ void StorageJob::start() valueGroup = "default"; } + //kDebug() << operationName(); + m_rdb->database()->transaction(); + if (operationName() == "save") { QSqlQuery query(*m_rdb->database()); - - if (!query.exec("BEGIN;")) { - setResult(false); - return; - } - if (params.value("key").toString().isNull()) { m_data.insert(params.value("key").toString(), params.value("data")); } @@ -210,7 +207,7 @@ void StorageJob::start() query.bindValue(field, it.value()); if (!query.exec()) { - kDebug() << "query failed:" << query.lastQuery() << query.lastError().text(); + //kDebug() << "query failed:" << query.lastQuery() << query.lastError().text(); setResult(false); return; } @@ -218,7 +215,7 @@ void StorageJob::start() query.bindValue(field, QVariant()); } - setResult(query.exec("COMMIT;")); + setResult(true); } else if (operationName() == "retrieve") { QSqlQuery query(*m_rdb->database());