global transaction
This commit is contained in:
parent
9d337a0c01
commit
1d550b15ea
@ -136,14 +136,11 @@ void StorageJob::start()
|
|||||||
valueGroup = "default";
|
valueGroup = "default";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//kDebug() << operationName();
|
||||||
|
m_rdb->database()->transaction();
|
||||||
|
|
||||||
if (operationName() == "save") {
|
if (operationName() == "save") {
|
||||||
QSqlQuery query(*m_rdb->database());
|
QSqlQuery query(*m_rdb->database());
|
||||||
|
|
||||||
if (!query.exec("BEGIN;")) {
|
|
||||||
setResult(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (params.value("key").toString().isNull()) {
|
if (params.value("key").toString().isNull()) {
|
||||||
m_data.insert(params.value("key").toString(), params.value("data"));
|
m_data.insert(params.value("key").toString(), params.value("data"));
|
||||||
}
|
}
|
||||||
@ -210,7 +207,7 @@ void StorageJob::start()
|
|||||||
query.bindValue(field, it.value());
|
query.bindValue(field, it.value());
|
||||||
|
|
||||||
if (!query.exec()) {
|
if (!query.exec()) {
|
||||||
kDebug() << "query failed:" << query.lastQuery() << query.lastError().text();
|
//kDebug() << "query failed:" << query.lastQuery() << query.lastError().text();
|
||||||
setResult(false);
|
setResult(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -218,7 +215,7 @@ void StorageJob::start()
|
|||||||
query.bindValue(field, QVariant());
|
query.bindValue(field, QVariant());
|
||||||
}
|
}
|
||||||
|
|
||||||
setResult(query.exec("COMMIT;"));
|
setResult(true);
|
||||||
} else if (operationName() == "retrieve") {
|
} else if (operationName() == "retrieve") {
|
||||||
QSqlQuery query(*m_rdb->database());
|
QSqlQuery query(*m_rdb->database());
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user