Allow adding sellers during sale phase
This commit is contained in:
parent
04de363af5
commit
43faf05006
2 changed files with 5 additions and 2 deletions
|
@ -212,6 +212,8 @@ void Database::beginTransaction() { exec("BEGIN TRANSACTION"); }
|
||||||
|
|
||||||
void Database::endTransaction() { exec("END TRANSACTION"); }
|
void Database::endTransaction() { exec("END TRANSACTION"); }
|
||||||
|
|
||||||
|
void Database::rollbackTransaction() { exec("ROLLBACK TRANSACTION"); }
|
||||||
|
|
||||||
unsigned int Database::storeSellers(std::vector<std::unique_ptr<Seller>>& sellers, bool onlyDelete)
|
unsigned int Database::storeSellers(std::vector<std::unique_ptr<Seller>>& sellers, bool onlyDelete)
|
||||||
{
|
{
|
||||||
int retCode{};
|
int retCode{};
|
||||||
|
@ -247,10 +249,10 @@ unsigned int Database::storeSellers(std::vector<std::unique_ptr<Seller>>& seller
|
||||||
retCode = sqlite3_step(stmt);
|
retCode = sqlite3_step(stmt);
|
||||||
|
|
||||||
if (retCode != SQLITE_DONE) {
|
if (retCode != SQLITE_DONE) {
|
||||||
|
rollbackTransaction();
|
||||||
std::string errMsg(sqlite3_errmsg(db_));
|
std::string errMsg(sqlite3_errmsg(db_));
|
||||||
sqlite3_finalize(stmt);
|
sqlite3_finalize(stmt);
|
||||||
throw std::runtime_error(errMsg);
|
sqlite3_ throw std::runtime_error(errMsg);
|
||||||
}
|
}
|
||||||
++count;
|
++count;
|
||||||
sqlite3_finalize(stmt);
|
sqlite3_finalize(stmt);
|
||||||
|
|
|
@ -32,6 +32,7 @@ class Database
|
||||||
void init();
|
void init();
|
||||||
void beginTransaction();
|
void beginTransaction();
|
||||||
void endTransaction();
|
void endTransaction();
|
||||||
|
void rollbackTransaction();
|
||||||
void createNew();
|
void createNew();
|
||||||
int getVersion();
|
int getVersion();
|
||||||
unsigned int storeArticles(std::vector<Article*> articles);
|
unsigned int storeArticles(std::vector<Article*> articles);
|
||||||
|
|
Loading…
Reference in a new issue