Helper function to execute a SQL statement and check for errors
| 15 | { |
| 16 | // Helper function to execute a SQL statement and check for errors |
| 17 | void execSQL(sqlite3* db, const std::string& sql) |
| 18 | { |
| 19 | char* err_msg = nullptr; |
| 20 | const int rc = sqlite3_exec(db, sql.c_str(), nullptr, nullptr, &err_msg); |
| 21 | if(rc != SQLITE_OK) |
| 22 | { |
| 23 | std::string error = "SQL error: "; |
| 24 | if(err_msg != nullptr) |
| 25 | { |
| 26 | error += err_msg; |
| 27 | sqlite3_free(err_msg); |
| 28 | } |
| 29 | throw RuntimeError(error); |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | // Helper function to prepare a statement |
| 34 | sqlite3_stmt* prepareStatement(sqlite3* db, const std::string& sql) |
no test coverage detected