MCPcopy Create free account
hub / github.com/BehaviorTree/BehaviorTree.CPP / execSQL

Function execSQL

src/loggers/bt_sqlite_logger.cpp:17–31  ·  view source on GitHub ↗

Helper function to execute a SQL statement and check for errors

Source from the content-addressed store, hash-verified

15{
16// Helper function to execute a SQL statement and check for errors
17void 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
34sqlite3_stmt* prepareStatement(sqlite3* db, const std::string& sql)

Callers 3

SqliteLoggerMethod · 0.85
~SqliteLoggerMethod · 0.85
execSqlStatementMethod · 0.85

Calls 1

RuntimeErrorClass · 0.85

Tested by

no test coverage detected