kopia lustrzana https://gitlab.com/tomaszg/geostat
Add SQLite transactions
rodzic
d2682e5860
commit
f7e02612d8
7
ocdb.cpp
7
ocdb.cpp
|
@ -56,7 +56,7 @@ bool OCdb::init(std::string dump_path) {
|
|||
json j;
|
||||
file >> j;
|
||||
revision = j["revision"];
|
||||
|
||||
request("BEGIN TRANSACTION;");
|
||||
request("INSERT INTO revision VALUES (" + std::to_string(revision) + ");");
|
||||
|
||||
for (auto& el : j["data_files"].items()) {
|
||||
|
@ -85,14 +85,15 @@ bool OCdb::update(Okapi& oc) {
|
|||
std::string output = oc.get_changelog_json(revision);
|
||||
json j = json::parse(output);
|
||||
|
||||
request("BEGIN TRANSACTION;");
|
||||
for (auto& el : j["changelog"].items()) {
|
||||
parse_item(el.value());
|
||||
}
|
||||
revision = j["revision"];
|
||||
request("UPDATE revision SET revision = " + std::to_string(revision) + ';');
|
||||
request("COMMIT");
|
||||
if (j["more"])
|
||||
update(oc);
|
||||
else
|
||||
request("UPDATE revision SET revision = " + std::to_string(revision) + ';');
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue