This commit is contained in:
2024-10-09 19:36:35 -05:00
parent 854caffea8
commit 67053645e1
13 changed files with 103 additions and 49 deletions

View File

@ -27,7 +27,7 @@ namespace repertory::utils::db::sqlite {
using db_types_t = std::variant<std::int64_t, std::string>;
struct sqlite3_deleter {
void operator()(sqlite3 *db3) {
void operator()(sqlite3 *db3) const {
if (db3 != nullptr) {
sqlite3_close_v2(db3);
}
@ -37,8 +37,9 @@ struct sqlite3_deleter {
using db3_t = std::unique_ptr<sqlite3, sqlite3_deleter>;
struct sqlite3_statement_deleter {
void operator()(sqlite3_stmt *stmt) {
void operator()(sqlite3_stmt *stmt) const {
if (stmt != nullptr) {
sqlite3_reset(stmt);
sqlite3_finalize(stmt);
}
}
@ -59,6 +60,9 @@ struct db_comp_data_t final {
struct db_context_t {
db_context_t(sqlite3 &db3_, std::string table_name_)
: db3(db3_), table_name(std::move(table_name_)) {}
virtual ~db_context_t() = default;
sqlite3 &db3;
std::string table_name;