updated build system
Some checks reported errors
BlockStorage/repertory/pipeline/head Something is wrong with the build of this commit

This commit is contained in:
2024-10-19 11:10:36 -05:00
parent c72dec6369
commit 2fb53e34af
24 changed files with 1330 additions and 831 deletions

View File

@ -25,6 +25,8 @@
#include "utils/config.hpp"
#include "utils/error.hpp"
namespace repertory::utils::db::sqlite {
using db_types_t = std::variant<std::int64_t, std::string>;
@ -44,6 +46,10 @@ struct sqlite3_statement_deleter final {
using db3_stmt_t = std::unique_ptr<sqlite3_stmt, sqlite3_statement_deleter>;
[[nodiscard]] auto
create_db(std::string db_path,
const std::map<std::string, std::string> &sql_create_tables) -> db3_t;
[[nodiscard]] auto execute_sql(sqlite3 &db3, const std::string &sql,
std::string &err) -> bool;
@ -89,11 +95,16 @@ public:
template <typename data_type>
[[nodiscard]] auto get_value() const -> data_type {
REPERTORY_USES_FUNCTION_NAME();
return std::visit(
overloaded{
[](const data_type &value) -> data_type { return value; },
[](auto &&) -> data_type {
throw std::runtime_error("data type not supported");
throw utils::error::create_exception({
function_name,
"data type not supported",
});
},
},
value_);
@ -107,6 +118,8 @@ public:
template <typename ctx_t> class db_row final {
public:
db_row(std::shared_ptr<ctx_t> ctx) {
REPERTORY_USES_FUNCTION_NAME();
auto column_count = sqlite3_column_count(ctx->stmt.get());
for (std::int32_t col = 0; col < column_count; col++) {
std::string name{sqlite3_column_name(ctx->stmt.get(), col)};
@ -125,8 +138,11 @@ public:
} break;
default:
throw std::runtime_error("column type not implemented|" + name + '|' +
std::to_string(column_type));
throw utils::error::create_exception({
function_name,
"column type not implemented",
std::to_string(column_type),
});
}
columns_[name] = db_column{col, name, value};

View File

@ -157,8 +157,8 @@ template <typename ctx_t, typename op_t> struct db_where_t final {
using action_t = std::variant<db_comp_data_t, n_t, db_where_t>;
[[nodiscard]] static auto dump(std::int32_t &idx, auto &&actions)
-> std::string {
[[nodiscard]] static auto dump(std::int32_t &idx,
auto &&actions) -> std::string {
std::stringstream stream;
for (auto &&action : actions) {