MCPcopy Create free account
hub / github.com/SOCI/soci / execute_hardcoded

Function execute_hardcoded

src/backends/sqlite3/session.cpp:30–43  ·  view source on GitHub ↗

helper function for hardcoded queries: this is a simple wrapper for sqlite3_exec() which throws an exception on error.

Source from the content-addressed store, hash-verified

28// helper function for hardcoded queries: this is a simple wrapper for
29// sqlite3_exec() which throws an exception on error.
30void execute_hardcoded(sqlite_api::sqlite3* conn, char const* const query,
31 char const* const errMsg,
32 int (*callback)(void*, int, char**, char**) = nullptr,
33 void* callback_arg = nullptr)
34{
35 char *zErrMsg = nullptr;
36 int const res = sqlite3_exec(conn, query, callback, callback_arg, &zErrMsg);
37
38 std::unique_ptr<char, void(*)(void*)> zErrMsgPtr(zErrMsg, sqlite3_free);
39 if (res != SQLITE_OK)
40 {
41 throw sqlite3_soci_error(conn, errMsg, zErrMsg);
42 }
43}
44
45// overload allowing to pass std::string instead of const char*
46void execute_hardcoded(sqlite_api::sqlite3* conn,

Callers 6

beginMethod · 0.85
commitMethod · 0.85
rollbackMethod · 0.85
get_last_insert_idMethod · 0.85

Calls 1

c_strMethod · 0.80

Tested by

no test coverage detected