Allow adding sellers during sale phase
This commit is contained in:
parent
a10ba7d7f6
commit
964c926fb0
2 changed files with 5 additions and 2 deletions
|
@ -186,6 +186,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{};
|
||||||
|
@ -221,10 +223,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);
|
||||||
|
|
|
@ -31,6 +31,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