1
0
forked from cheng/wallet

now does correct error handling on insert name

But not very user friendly
This commit is contained in:
Cheng 2023-02-25 15:46:07 +08:00
parent 5b37e32a81
commit badd99b74b
No known key found for this signature in database
GPG Key ID: 571C3A9C3B9E6FCA

View File

@ -187,8 +187,8 @@ class sql_insert_name {
public:
sql_insert_name(ISqlite3* p) :
csql_begin(p, R"|(BEGIN;)|"),
csql_into_names(p, R"|(INSERT OR ROLLBACK INTO "Names" VALUES(?1);)|"),
csql_namekey_into_keys(p, R"|(INSERT OR ROLLBACK INTO "Keys" VALUES(?1, last_insert_rowid(), 1);)|"),
csql_into_names(p, R"|(INSERT OR FAIL INTO "Names" VALUES(?1);)|"),
csql_namekey_into_keys(p, R"|(INSERT OR FAIL INTO "Keys" VALUES(?1, last_insert_rowid(), 1);)|"),
csql_commit(p, R"|(COMMIT;)|"),
csql_rollback(p, R"|(ROLLBACK;)|")
{}
@ -199,9 +199,9 @@ public:
csql_into_names.do_one(psz);
csql_namekey_into_keys.do_one(pt);
}
catch (const std::exception & e) {
catch (const std::exception &) {
csql_rollback.do_one();
throw e;
throw;
}
csql_commit.do_one();
}