#pragma once #include "Sql.hpp" #include #include #include namespace odhtdb { class SqlExecException : public std::runtime_error { public: SqlExecException(const std::string &errMsg) : std::runtime_error(errMsg) {} }; class SqlExec { public: // Throws SqlExecException on failure SqlExec(sqlite3 *db, const char *sql); ~SqlExec(); // Throws SqlExecException on failure void execWithArgs(std::initializer_list args); // Throws SqlExecException on failure void exec(); private: sqlite3 *db; sqlite3_stmt *stmt; std::mutex mutex; }; }