Add missing keepOpen in run

dev_old
marcelb 2 years ago
parent 4c171a5c99
commit b132aa9fff
  1. 15
      src/sql3.cpp
  2. 2
      test/test.cpp
  3. BIN
      test/test.o

@ -7,6 +7,7 @@ sql3::sql3(const string _path, bool _keepOpen) {
if (keepOpen) {
if (open()) {
printf("[ERROR] Ne mogu otvoriti bazu podataka!");
exit(1);
}
}
@ -24,6 +25,14 @@ bool sql3::close() {
}
bool sql3::run(const string sql_command) {
if (!keepOpen) {
if (open()) {
printf("[ERROR] Ne mogu otvoriti bazu podataka!");
exit(1);
}
}
bool r = true;
char *messaggeError;
uint exec_stuts;
@ -38,6 +47,12 @@ bool sql3::run(const string sql_command) {
Answer = responseDatabase;
}
if (!keepOpen) {
if(close()) {
printf ("ERROR Zatvaranja baze podataka!");
}
}
return r;
}

@ -6,7 +6,7 @@ using namespace std;
int main() {
sql3 mydb("../example/example.db", true);
sql3 mydb("../example/example.db", false);
//cout << mydb.ask("Select * from Tab1");
// cout << mydb.ask("INSERT INTO Tab1 VALUES(3,'Pakora', 'marijanab@bitelex.ml');");

Binary file not shown.
Loading…
Cancel
Save