Browse Source

pEpSQLite - Exception on execute() on closed db. (not segfault)

LIB-12
heck 4 years ago
parent
commit
3c3aaf5a48
  1. 8
      src/pEpSQLite.cc

8
src/pEpSQLite.cc

@ -20,7 +20,8 @@ namespace pEp {
int rc{::sqlite3_open(db_path.c_str(), &db)};
if (rc) {
runtime_error e{string("Can't open database (" + db_path + "):" + ::sqlite3_errmsg(db))};
::sqlite3_close(db);
runtime_error e{string("Can't open database (" + db_path + "): " + ::sqlite3_errmsg(db))};
throw (e);
}
}
@ -62,6 +63,10 @@ namespace pEp {
ResultSet pEpSQLite::execute(const string& stmt)
{
if(db == nullptr) {
runtime_error e{string("execute(): - Error: db is not open")};
throw (e);
} else {
pEpLogClass("called");
this->resultset.clear();
char *zErrMsg = nullptr;
@ -71,6 +76,7 @@ namespace pEp {
::sqlite3_free(zErrMsg);
throw (e);
}
}
return resultset;
}

Loading…
Cancel
Save