From f97493803057c7451aa17ca3ad6384b8cf2e7120 Mon Sep 17 00:00:00 2001 From: Gaspard Kirira Date: Thu, 22 Jan 2026 15:34:41 +0300 Subject: [PATCH 01/12] modules: add db submodule (core DB layer) --- .gitmodules | 4 ++++ modules/db | 1 + 2 files changed, 5 insertions(+) create mode 160000 modules/db diff --git a/.gitmodules b/.gitmodules index afd88d2..76375dc 100644 --- a/.gitmodules +++ b/.gitmodules @@ -47,3 +47,7 @@ path = modules/cache url = https://github.com/vixcpp/cache.git branch = dev +[submodule "modules/db"] + path = modules/db + url = git@github.com:vixcpp/db.git + branch = dev diff --git a/modules/db b/modules/db new file mode 160000 index 0000000..97855da --- /dev/null +++ b/modules/db @@ -0,0 +1 @@ +Subproject commit 97855da39e52e37c2ab3349cf291d1a2c215c8b4 From 3d91b91b5e4e3baa482243488b1a83f9c490fc81 Mon Sep 17 00:00:00 2001 From: Gaspard Kirira Date: Thu, 22 Jan 2026 15:43:36 +0300 Subject: [PATCH 02/12] modules: split db core from orm (db is new core layer) --- modules/db | 2 +- modules/orm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/db b/modules/db index 97855da..1b539b3 160000 --- a/modules/db +++ b/modules/db @@ -1 +1 @@ -Subproject commit 97855da39e52e37c2ab3349cf291d1a2c215c8b4 +Subproject commit 1b539b3beb83ffc8d80756063589a097c4002e77 diff --git a/modules/orm b/modules/orm index e63da9b..f94d4d7 160000 --- a/modules/orm +++ b/modules/orm @@ -1 +1 @@ -Subproject commit e63da9b21138a87620dd80c0074b066717083c4b +Subproject commit f94d4d7fd502597fe617f02574d43b7833709272 From 334e2af0a357127dbe8fb0207c7bc9f05d019400 Mon Sep 17 00:00:00 2001 From: Gaspard Kirira Date: Thu, 22 Jan 2026 17:05:14 +0300 Subject: [PATCH 03/12] umbrella: introduce vix::db core module and decouple ORM drivers/tools - Add vix::db as first-class core module (anti-ORM layer) - Update umbrella CMake to build and export vix::db - Make vix::orm a pure sugar layer on top of vix::db - Move migrator tool ownership from ORM to DB - Update CLI to target DB-level migrator - Sync submodules (cli, db, orm) with new architecture --- CMakeLists.txt | 60 +++++++++++++++++++++++++++++++++++++++++--------- modules/cli | 2 +- modules/db | 2 +- modules/orm | 2 +- 4 files changed, 53 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4a4a03d..1acfa1a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,6 +72,15 @@ option(VIX_BENCH_MODE "Disable heavy security/logging checks for benchmarks" OFF option(VIX_ENABLE_MIDDLEWARE "Build Vix middleware module" ON) option(VIX_ENABLE_HTTP_COMPRESSION "Enable HTTP compression middleware deps (zlib/brotli)" ON) +option(VIX_ENABLE_DB "Build Vix DB module (core anti-ORM)" ON) + +# DB backends (forwarded to modules/db) +option(VIX_DB_USE_MYSQL "Enable MySQL backend in vix_db" ON) +option(VIX_DB_USE_SQLITE "Enable SQLite backend in vix_db" OFF) +option(VIX_DB_USE_POSTGRES "Enable PostgreSQL backend in vix_db" OFF) +option(VIX_DB_USE_REDIS "Enable Redis backend in vix_db" OFF) + + # ---------------------------------------------------- # Tooling / Static analysis # ---------------------------------------------------- @@ -341,6 +350,23 @@ if (VIX_BENCH_MODE) endif() endif() +# --- DB (optional, required by ORM) --- +set(VIX_HAS_DB OFF) +if (VIX_ENABLE_DB AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/modules/db/CMakeLists.txt") + message(STATUS "Adding 'modules/db'...") + add_subdirectory(modules/db db_build) + + if (TARGET vix::db OR TARGET vix_db) + if (TARGET vix_db AND NOT TARGET vix::db) + add_library(vix::db ALIAS vix_db) + endif() + set(VIX_HAS_DB ON) + else() + message(WARNING "DB module added but no vix::db target was exported.") + endif() +else() + message(STATUS "DB: disabled or not present.") +endif() # --- WebSocket (optional) --- set(VIX_HAS_WEBSOCKET OFF) @@ -364,15 +390,19 @@ else() endif() # --- ORM (optional) --- -# Forwarded to modules/orm (users can override via -D flags) -option(VIX_ORM_USE_MYSQL "Enable MySQL backend in vix_orm" ON) -set(VIX_ORM_BUILD_EXAMPLES OFF CACHE BOOL "Build vix_orm examples") -set(VIX_ORM_BUILD_TESTS OFF CACHE BOOL "Build vix_orm tests") - set(VIX_UMBRELLA_BUILD ON CACHE BOOL "Building Vix from umbrella" FORCE) + set(VIX_HAS_ORM OFF) if (VIX_ENABLE_ORM AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/modules/orm/CMakeLists.txt") + + if (NOT VIX_HAS_DB) + message(FATAL_ERROR "ORM requires DB module. Enable it with -DVIX_ENABLE_DB=ON and ensure modules/db exists.") + endif() + message(STATUS "Adding 'modules/orm'...") + set(VIX_ORM_BUILD_EXAMPLES OFF CACHE BOOL "Build vix_orm examples") + set(VIX_ORM_BUILD_TESTS OFF CACHE BOOL "Build vix_orm tests") + add_subdirectory(modules/orm orm_build) if (TARGET vix::orm OR TARGET vix_orm) @@ -396,6 +426,10 @@ target_link_libraries(vix INTERFACE ${JSON_TARGET} ) +if (TARGET vix::db) + target_link_libraries(vix INTERFACE vix::db) +endif() + # Link websocket only if it exists if (TARGET vix::websocket) target_link_libraries(vix INTERFACE vix::websocket) @@ -463,7 +497,7 @@ if (VIX_BUILD_EXAMPLES) endif() # 2) If ORM is ON but MySQL backend is OFF → remove MySQL-based ORM examples - if (VIX_HAS_ORM AND NOT VIX_ORM_USE_MYSQL) + if (VIX_HAS_ORM AND NOT VIX_DB_USE_MYSQL) foreach(_ex IN LISTS _ORM_MYSQL_EXAMPLES) list(FILTER VIX_UMBRELLA_EXAMPLES EXCLUDE REGEX ".*/${_ex}\\.cpp$") list(FILTER VIX_UMBRELLA_EXAMPLES EXCLUDE REGEX ".*\\\\${_ex}\\.cpp$") @@ -629,6 +663,11 @@ if (VIX_ENABLE_INSTALL) FILES_MATCHING PATTERN "*.hpp" PATTERN "*.h") endif() + if (VIX_HAS_DB AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/modules/db/include") + install(DIRECTORY modules/db/include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + FILES_MATCHING PATTERN "*.hpp" PATTERN "*.h") + endif() + if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/modules/middleware/include") install(DIRECTORY modules/middleware/include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} FILES_MATCHING PATTERN "*.hpp" PATTERN "*.h") @@ -654,10 +693,10 @@ if (VIX_ENABLE_INSTALL) COMPATIBILITY SameMajorVersion ) - set(VIX_HAS_ORM ${VIX_HAS_ORM}) - set(VIX_ORM_WITH_MYSQL OFF) - if (VIX_HAS_ORM AND VIX_ORM_USE_MYSQL) - set(VIX_ORM_WITH_MYSQL ON) + set(VIX_HAS_ORM ${VIX_HAS_ORM}) + set(VIX_DB_WITH_MYSQL OFF) + if (VIX_HAS_DB AND VIX_DB_USE_MYSQL) + set(VIX_DB_WITH_MYSQL ON) endif() configure_package_config_file( @@ -696,6 +735,7 @@ message(STATUS "Project version : ${PROJECT_VERSION}") message(STATUS "JSON backend : ${_VIX_JSON_BACKEND}") message(STATUS "WebSocket built : ${VIX_HAS_WEBSOCKET}") message(STATUS "ORM packaged : ${VIX_HAS_ORM}") +message(STATUS "DB built : ${VIX_HAS_DB}") message(STATUS "Middleware built : ${VIX_HAS_MIDDLEWARE}") message(STATUS "Examples : ${VIX_BUILD_EXAMPLES}") message(STATUS "Tests : ${VIX_BUILD_TESTS}") diff --git a/modules/cli b/modules/cli index 88b72fe..5d38130 160000 --- a/modules/cli +++ b/modules/cli @@ -1 +1 @@ -Subproject commit 88b72fe6d1c50ea9e6ab36856c8d02c8b403cc88 +Subproject commit 5d38130a911b90d721d7096cd627cdc1c4973891 diff --git a/modules/db b/modules/db index 1b539b3..ebd31a6 160000 --- a/modules/db +++ b/modules/db @@ -1 +1 @@ -Subproject commit 1b539b3beb83ffc8d80756063589a097c4002e77 +Subproject commit ebd31a6ef7d9211439a8dfbd0321378c2ff5a81b diff --git a/modules/orm b/modules/orm index f94d4d7..8452ff1 160000 --- a/modules/orm +++ b/modules/orm @@ -1 +1 @@ -Subproject commit f94d4d7fd502597fe617f02574d43b7833709272 +Subproject commit 8452ff1b9452284b58b081aa471da79d3059dacd From c974780ee8c3564f71b2597ca297bf7fce14f30d Mon Sep 17 00:00:00 2001 From: Gaspard Kirira Date: Thu, 22 Jan 2026 20:51:43 +0300 Subject: [PATCH 04/12] modules(db,orm): sync submodules after DB/ORM compatibility fixes - Update db submodule to latest main (Transaction header-only + ConnectionPool stabilization) - Update orm submodule to latest dev (any->DbValue binding + examples/build fixes) --- modules/db | 2 +- modules/orm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/db b/modules/db index ebd31a6..c0564bd 160000 --- a/modules/db +++ b/modules/db @@ -1 +1 @@ -Subproject commit ebd31a6ef7d9211439a8dfbd0321378c2ff5a81b +Subproject commit c0564bd1012609b56696b036e7bba4e8777e5630 diff --git a/modules/orm b/modules/orm index 8452ff1..dbe16fb 160000 --- a/modules/orm +++ b/modules/orm @@ -1 +1 @@ -Subproject commit 8452ff1b9452284b58b081aa471da79d3059dacd +Subproject commit dbe16fb22cb6fcb2a5485bc3a56966e7cf4aa49c From bee5ad73d71eb2e312c48eceb35ce4e5d1318697 Mon Sep 17 00:00:00 2001 From: Gaspard Kirira Date: Fri, 23 Jan 2026 12:59:50 +0300 Subject: [PATCH 05/12] db/orm/cli: fix missing sources, drivers, and linkage across modules - DB: - properly register MakeMigrations sources and headers - ensure MySQL driver symbols are built and linked when enabled - ORM: - guard MySQL-specific APIs behind VIX_DB_HAS_MYSQL - prevent exposing unavailable driver symbols - CLI: - fix generated CMake for vix run to avoid link-time undefined references - Examples: - update HTTP CRUD samples to match current DB/ORM APIs - Build: - align umbrella CMakeLists with updated module structure This commit fixes real-world link errors and restores explicit, reliable module boundaries. --- CMakeLists.txt | 39 ++++++++++++++-- examples/http_crud/batch_insert_tx.cpp | 26 ++++++----- examples/http_crud/error_handling.cpp | 37 ++++++++++++--- examples/http_crud/querybuilder_update.cpp | 23 +++++---- examples/http_crud/repository_crud_full.cpp | 52 ++++++++++++++------- examples/http_crud/tx_unit_of_work.cpp | 22 ++++----- examples/http_crud/users_crud.cpp | 21 +++++---- modules/cli | 2 +- modules/db | 2 +- modules/orm | 2 +- 10 files changed, 155 insertions(+), 71 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1acfa1a..e4180e8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,41 @@ cmake_minimum_required(VERSION 3.20) # cmake --build build -j # ==================================================================== -project(vix VERSION 1.17.1 LANGUAGES CXX) +cmake_minimum_required(VERSION 3.20) + +# Resolve umbrella version from git (preferred) +set(_VIX_VERSION_FALLBACK "0.0.0") + +find_package(Git QUIET) +set(_VIX_GIT_DESCRIBE "") +if(Git_FOUND) + execute_process( + COMMAND "${GIT_EXECUTABLE}" describe --tags --always --dirty + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" + OUTPUT_VARIABLE _VIX_GIT_DESCRIBE + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET + ) +endif() + +# Compute PROJECT_VERSION (must be numeric for CMake packaging) +# If describe returns: v1.20.1-4-gXXXX -> numeric is 1.20.1 +set(_VIX_PROJECT_VERSION "${_VIX_VERSION_FALLBACK}") +if(_VIX_GIT_DESCRIBE MATCHES "^v([0-9]+\\.[0-9]+\\.[0-9]+)") + set(_VIX_PROJECT_VERSION "${CMAKE_MATCH_1}") +endif() + +project(vix VERSION ${_VIX_PROJECT_VERSION} LANGUAGES CXX) + +# Human-friendly version string (can include -N-gHASH[-dirty]) +if(_VIX_GIT_DESCRIBE STREQUAL "") + set(VIX_UMBRELLA_VERSION "v${PROJECT_VERSION}") +else() + set(VIX_UMBRELLA_VERSION "${_VIX_GIT_DESCRIBE}") +endif() +set(VIX_UMBRELLA_VERSION "${VIX_UMBRELLA_VERSION}" CACHE STRING "Umbrella version" FORCE) + +set(VIX_UMBRELLA_BUILD ON CACHE BOOL "Building Vix from umbrella" FORCE) # Make find_package honor *_ROOT hints (e.g. MYSQLCPPCONN_ROOT) if (POLICY CMP0144) @@ -384,14 +418,13 @@ endif() # --- CLI (optional) --- if (VIX_ENABLE_CLI AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/modules/cli/CMakeLists.txt") message(STATUS "Adding 'modules/cli'...") + set(VIX_UMBRELLA_VERSION "${PROJECT_VERSION}" CACHE STRING "Umbrella version" FORCE) add_subdirectory(modules/cli cli_build) else() message(STATUS "CLI: disabled or not present.") endif() # --- ORM (optional) --- -set(VIX_UMBRELLA_BUILD ON CACHE BOOL "Building Vix from umbrella" FORCE) - set(VIX_HAS_ORM OFF) if (VIX_ENABLE_ORM AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/modules/orm/CMakeLists.txt") diff --git a/examples/http_crud/batch_insert_tx.cpp b/examples/http_crud/batch_insert_tx.cpp index 7cdaeae..23044c3 100644 --- a/examples/http_crud/batch_insert_tx.cpp +++ b/examples/http_crud/batch_insert_tx.cpp @@ -1,6 +1,6 @@ /** * - * @file examples/http_crud/batch_insert_tx.cpp + * @file batch_insert_tx.hpp * @author Gaspard Kirira * * Copyright 2025, Gaspard Kirira. All rights reserved. @@ -9,28 +9,26 @@ * that can be found in the License file. * * Vix.cpp - * */ - #include -#include -#include +#include #include -#include #include +#include using namespace vix::orm; int main(int argc, char **argv) { - std::string host = (argc > 1 ? argv[1] : "tcp://127.0.0.1:3306"); - std::string user = (argc > 2 ? argv[2] : "root"); - std::string pass = (argc > 3 ? argv[3] : ""); - std::string db = (argc > 4 ? argv[4] : "vixdb"); + const std::string host = (argc > 1 ? argv[1] : "tcp://127.0.0.1:3306"); + const std::string user = (argc > 2 ? argv[2] : "root"); + const std::string pass = (argc > 3 ? argv[3] : ""); + const std::string db = (argc > 4 ? argv[4] : "vixdb"); try { + // DB factory (MySQL driver) auto factory = make_mysql_factory(host, user, pass, db); PoolConfig cfg; @@ -40,6 +38,7 @@ int main(int argc, char **argv) ConnectionPool pool{factory, cfg}; pool.warmup(); + // Transaction (RAII rollback if not committed) Transaction tx(pool); auto &c = tx.conn(); @@ -52,7 +51,7 @@ int main(int argc, char **argv) int age; }; - std::vector rows = { + const std::vector rows = { {"Zoe", "zoe@example.com", 23}, {"Mina", "mina@example.com", 31}, {"Omar", "omar@example.com", 35}, @@ -71,6 +70,11 @@ int main(int argc, char **argv) std::cout << "[OK] inserted rows = " << total << "\n"; return 0; } + catch (const DBError &e) + { + std::cerr << "[DBError] " << e.what() << "\n"; + return 1; + } catch (const std::exception &e) { std::cerr << "[ERR] " << e.what() << "\n"; diff --git a/examples/http_crud/error_handling.cpp b/examples/http_crud/error_handling.cpp index 0b320d1..5155f87 100644 --- a/examples/http_crud/error_handling.cpp +++ b/examples/http_crud/error_handling.cpp @@ -1,6 +1,6 @@ /** * - * @file examples/http_crud/error_handling.cpp + * @file error_handling.hpp * @author Gaspard Kirira * * Copyright 2025, Gaspard Kirira. All rights reserved. @@ -9,10 +9,11 @@ * that can be found in the License file. * * Vix.cpp - * */ #include + #include +#include using namespace vix::orm; @@ -20,20 +21,44 @@ int main(int argc, char **argv) { (void)argc; (void)argv; + try { - // Intentionally wrong DB name to show error - auto raw = make_mysql_factory("tcp://127.0.0.1:3306", "root", "", "db_does_not_exist"); - //..... + // Intentionally wrong DB name to show error handling + const std::string host = "tcp://127.0.0.1:3306"; + const std::string user = "root"; + const std::string pass = ""; + const std::string db = "db_does_not_exist"; + + auto factory = make_mysql_factory(host, user, pass, db); + + PoolConfig cfg; + cfg.min = 1; + cfg.max = 8; + + ConnectionPool pool{factory, cfg}; + + // will throw if factory returns invalid connection (recommended after our warmup fix), + // or later when first query fails. + pool.warmup(); + + UnitOfWork uow{pool}; + auto &con = uow.conn(); + + auto st = con.prepare("SELECT 1"); + (void)st->exec(); + std::cout << "[INFO] This message may not be reached if connection fails.\n"; + return 0; } catch (const DBError &e) { std::cerr << "[DBError] " << e.what() << "\n"; + return 1; } catch (const std::exception &e) { std::cerr << "[std::exception] " << e.what() << "\n"; + return 1; } - return 0; } diff --git a/examples/http_crud/querybuilder_update.cpp b/examples/http_crud/querybuilder_update.cpp index 604ee61..e942105 100644 --- a/examples/http_crud/querybuilder_update.cpp +++ b/examples/http_crud/querybuilder_update.cpp @@ -1,6 +1,6 @@ /** * - * @file examples/http_crud/querybuilder_update.cpp + * @file querybuilder_update.hpp * @author Gaspard Kirira * * Copyright 2025, Gaspard Kirira. All rights reserved. @@ -9,12 +9,10 @@ * that can be found in the License file. * * Vix.cpp - * */ #include -#include -#include +#include #include #include @@ -22,10 +20,10 @@ using namespace vix::orm; int main(int argc, char **argv) { - std::string host = (argc > 1 ? argv[1] : "tcp://127.0.0.1:3306"); - std::string user = (argc > 2 ? argv[2] : "root"); - std::string pass = (argc > 3 ? argv[3] : ""); - std::string db = (argc > 4 ? argv[4] : "vixdb"); + const std::string host = (argc > 1 ? argv[1] : "tcp://127.0.0.1:3306"); + const std::string user = (argc > 2 ? argv[2] : "root"); + const std::string pass = (argc > 3 ? argv[3] : ""); + const std::string db = (argc > 4 ? argv[4] : "vixdb"); try { @@ -48,12 +46,17 @@ int main(int argc, char **argv) const auto &ps = qb.params(); for (std::size_t i = 0; i < ps.size(); ++i) - st->bind(i + 1, ps[i]); + st->bind(i + 1, any_to_dbvalue_or_throw(ps[i])); - auto affected = st->exec(); + const auto affected = st->exec(); std::cout << "[OK] affected rows = " << affected << "\n"; return 0; } + catch (const DBError &e) + { + std::cerr << "[DBError] " << e.what() << "\n"; + return 1; + } catch (const std::exception &e) { std::cerr << "[ERR] " << e.what() << "\n"; diff --git a/examples/http_crud/repository_crud_full.cpp b/examples/http_crud/repository_crud_full.cpp index 8db701c..3072700 100644 --- a/examples/http_crud/repository_crud_full.cpp +++ b/examples/http_crud/repository_crud_full.cpp @@ -1,6 +1,6 @@ /** * - * @file examples/http_crud/repository_crud_full.cpp + * @file repository_crud_full.hpp * @author Gaspard Kirira * * Copyright 2025, Gaspard Kirira. All rights reserved. @@ -9,15 +9,16 @@ * that can be found in the License file. * * Vix.cpp - * */ + #include -#include -#include -#include +#include #include +#include #include +#include +#include struct User { @@ -32,7 +33,15 @@ namespace vix::orm template <> struct Mapper { - static User fromRow(const ResultRow &) { return {}; } // pending + static User fromRow(const ResultRow &row) + { + User u{}; + u.id = row.getInt64Or(0, 0); + u.name = row.getStringOr(1, ""); + u.email = row.getStringOr(2, ""); + u.age = static_cast(row.getInt64Or(3, 0)); + return u; + } static std::vector> toInsertParams(const User &u) @@ -60,10 +69,10 @@ int main(int argc, char **argv) { using namespace vix::orm; - std::string host = (argc > 1 ? argv[1] : "tcp://127.0.0.1:3306"); - std::string user = (argc > 2 ? argv[2] : "root"); - std::string pass = (argc > 3 ? argv[3] : ""); - std::string db = (argc > 4 ? argv[4] : "vixdb"); + const std::string host = (argc > 1 ? argv[1] : "tcp://127.0.0.1:3306"); + const std::string user = (argc > 2 ? argv[2] : "root"); + const std::string pass = (argc > 3 ? argv[3] : ""); + const std::string db = (argc > 4 ? argv[4] : "vixdb"); try { @@ -79,20 +88,31 @@ int main(int argc, char **argv) BaseRepository repo{pool, "users"}; // Create - std::int64_t id = static_cast( + const std::int64_t id = static_cast( repo.create(User{0, "Bob", "gaspardkirira@example.com", 30})); - std::cout << "[OK] create → id=" << id << "\n"; + std::cout << "[OK] create -> id=" << id << "\n"; // Update - repo.updateById(id, User{id, "Adastra", "adastra@example.com", 31}); - std::cout << "[OK] update → id=" << id << "\n"; + (void)repo.updateById(id, User{id, "Adastra", "adastra@example.com", 31}); + std::cout << "[OK] update -> id=" << id << "\n"; + + // (Optional) Read back + if (auto u = repo.findById(id)) + { + std::cout << "[OK] findById -> name=" << u->name << " email=" << u->email << " age=" << u->age << "\n"; + } // Delete - repo.removeById(id); - std::cout << "[OK] delete → id=" << id << "\n"; + (void)repo.removeById(id); + std::cout << "[OK] delete -> id=" << id << "\n"; return 0; } + catch (const DBError &e) + { + std::cerr << "[DBError] " << e.what() << "\n"; + return 1; + } catch (const std::exception &e) { std::cerr << "[ERR] " << e.what() << "\n"; diff --git a/examples/http_crud/tx_unit_of_work.cpp b/examples/http_crud/tx_unit_of_work.cpp index 9196bcb..b413873 100644 --- a/examples/http_crud/tx_unit_of_work.cpp +++ b/examples/http_crud/tx_unit_of_work.cpp @@ -1,6 +1,6 @@ /** * - * @file examples/http_crud/tx_unit_of_work.cpp + * @file tx_unit_of_work.hpp * @author Gaspard Kirira * * Copyright 2025, Gaspard Kirira. All rights reserved. @@ -9,13 +9,11 @@ * that can be found in the License file. * * Vix.cpp - * */ #include -#include -#include +#include #include #include @@ -23,10 +21,10 @@ using namespace vix::orm; int main(int argc, char **argv) { - std::string host = (argc > 1 ? argv[1] : "tcp://127.0.0.1:3306"); - std::string user = (argc > 2 ? argv[2] : "root"); - std::string pass = (argc > 3 ? argv[3] : ""); - std::string db = (argc > 4 ? argv[4] : "vixdb"); + const std::string host = (argc > 1 ? argv[1] : "tcp://127.0.0.1:3306"); + const std::string user = (argc > 2 ? argv[2] : "root"); + const std::string pass = (argc > 3 ? argv[3] : ""); + const std::string db = (argc > 4 ? argv[4] : "vixdb"); try { @@ -44,17 +42,17 @@ int main(int argc, char **argv) { auto st = c.prepare("INSERT INTO users(name,email,age) VALUES(?,?,?)"); - st->bind(1, std::string("Alice")); - st->bind(2, std::string("alice@example.com")); + st->bind(1, "Alice"); + st->bind(2, "alice@example.com"); st->bind(3, 27); st->exec(); } - const auto userId = c.lastInsertId(); + const std::uint64_t userId = c.lastInsertId(); { auto st = c.prepare("INSERT INTO orders(user_id,total) VALUES(?,?)"); - st->bind(1, static_cast(userId)); + st->bind(1, userId); st->bind(2, 199.99); st->exec(); } diff --git a/examples/http_crud/users_crud.cpp b/examples/http_crud/users_crud.cpp index 964b560..09f33ca 100644 --- a/examples/http_crud/users_crud.cpp +++ b/examples/http_crud/users_crud.cpp @@ -1,6 +1,6 @@ /** * - * @file examples/http_crud/users_crud.cpp + * @file users_crud.hpp * @author Gaspard Kirira * * Copyright 2025, Gaspard Kirira. All rights reserved. @@ -9,22 +9,22 @@ * that can be found in the License file. * * Vix.cpp - * */ + #include -#include -#include + #include +#include #include using namespace vix::orm; int main(int argc, char **argv) { - std::string host = (argc > 1 ? argv[1] : "tcp://127.0.0.1:3306"); - std::string user = (argc > 2 ? argv[2] : "root"); - std::string pass = (argc > 3 ? argv[3] : ""); - std::string db = (argc > 4 ? argv[4] : "vixdb"); + const std::string host = (argc > 1 ? argv[1] : "tcp://127.0.0.1:3306"); + const std::string user = (argc > 2 ? argv[2] : "root"); + const std::string pass = (argc > 3 ? argv[3] : ""); + const std::string db = (argc > 4 ? argv[4] : "vixdb"); try { @@ -48,8 +48,9 @@ int main(int argc, char **argv) const char *email; int age; }; - std::vector rows = { - {"Zoe", "zoe@example.com", 23}, + + const std::vector rows = { + {"Gaspard", "gaspardkirira@outlook.com", 23}, {"Mina", "mina@example.com", 31}, {"Omar", "omar@example.com", 35}, }; diff --git a/modules/cli b/modules/cli index 5d38130..583b248 160000 --- a/modules/cli +++ b/modules/cli @@ -1 +1 @@ -Subproject commit 5d38130a911b90d721d7096cd627cdc1c4973891 +Subproject commit 583b24805c92456c9bc56b7e7a3097012ac8b2b3 diff --git a/modules/db b/modules/db index c0564bd..9285821 160000 --- a/modules/db +++ b/modules/db @@ -1 +1 @@ -Subproject commit c0564bd1012609b56696b036e7bba4e8777e5630 +Subproject commit 92858219b522e530ebea378c40bb44e87bb77bdb diff --git a/modules/orm b/modules/orm index dbe16fb..cc90727 160000 --- a/modules/orm +++ b/modules/orm @@ -1 +1 @@ -Subproject commit dbe16fb22cb6fcb2a5485bc3a56966e7cf4aa49c +Subproject commit cc90727785840e2d03378bcca923a439fe812612 From 784bbbaf21436b897d5cc3126eabf0411bc6822e Mon Sep 17 00:00:00 2001 From: Gaspard Kirira Date: Fri, 23 Jan 2026 15:54:39 +0300 Subject: [PATCH 06/12] umbrella: update cli module (runtime errors, rules, UX cleanup) --- modules/cli | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/cli b/modules/cli index 583b248..1be34a6 160000 --- a/modules/cli +++ b/modules/cli @@ -1 +1 @@ -Subproject commit 583b24805c92456c9bc56b7e7a3097012ac8b2b3 +Subproject commit 1be34a6fdb9f98efdb4bd18255a6c0239f8eb45b From 4151c094a1d6dd2cdf6db9b458fad308860f10a2 Mon Sep 17 00:00:00 2001 From: Gaspard Kirira Date: Fri, 23 Jan 2026 17:08:15 +0300 Subject: [PATCH 07/12] modules(cli): sync runtime error UX improvements - Update cli submodule - Align runtime error rendering with Vix styled output - Remove duplicate runtime messages and trailing blank line --- modules/cli | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/cli b/modules/cli index 1be34a6..254140b 160000 --- a/modules/cli +++ b/modules/cli @@ -1 +1 @@ -Subproject commit 1be34a6fdb9f98efdb4bd18255a6c0239f8eb45b +Subproject commit 254140b827e60fc28ec2dff030b4b2aeff68012c From 28c1510c4e0261980003eb1380a342897eff6e8d Mon Sep 17 00:00:00 2001 From: Gaspard Kirira Date: Fri, 23 Jan 2026 18:21:19 +0300 Subject: [PATCH 08/12] modules(cli): update error diagnostics and runtime detectors - Pull latest CLI changes - Improved compiler error rules (lifetime, ownership, misuse) - Cleaner runtime error summaries and sanitizer handling - More focused, actionable diagnostics No API changes. --- modules/cli | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/cli b/modules/cli index 254140b..607570a 160000 --- a/modules/cli +++ b/modules/cli @@ -1 +1 @@ -Subproject commit 254140b827e60fc28ec2dff030b4b2aeff68012c +Subproject commit 607570a6983be90c927d7059eaacfa960a3e0275 From 60d9e37bdb99b2c345d75a6b11ce181c8779bd59 Mon Sep 17 00:00:00 2001 From: Gaspard Kirira Date: Sat, 24 Jan 2026 17:50:53 +0300 Subject: [PATCH 09/12] umbrella(cli): update cli module to v1.19.8 --- modules/cli | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/cli b/modules/cli index 607570a..c805103 160000 --- a/modules/cli +++ b/modules/cli @@ -1 +1 @@ -Subproject commit 607570a6983be90c927d7059eaacfa960a3e0275 +Subproject commit c805103d242b2d64aec961f78d05774545eabadb From c90469e5df637552eae8df6d0497f72303b0a7bc Mon Sep 17 00:00:00 2001 From: Gaspard Kirira Date: Sat, 24 Jan 2026 18:14:57 +0300 Subject: [PATCH 10/12] chore: update cli module (fix duplicate runtime logs) --- modules/cli | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/cli b/modules/cli index c805103..660ed9c 160000 --- a/modules/cli +++ b/modules/cli @@ -1 +1 @@ -Subproject commit c805103d242b2d64aec961f78d05774545eabadb +Subproject commit 660ed9ce29939c72ef12bab9da33eafdc513b551 From 0cb0a6fc99d3a611aefe8452a6b25abfe7ac6c70 Mon Sep 17 00:00:00 2001 From: Gaspard Kirira Date: Sat, 24 Jan 2026 18:38:24 +0300 Subject: [PATCH 11/12] umbrella: bump cli + db (run UX + mysql cmake fixes) --- modules/cli | 2 +- modules/db | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/cli b/modules/cli index 660ed9c..d655ebf 160000 --- a/modules/cli +++ b/modules/cli @@ -1 +1 @@ -Subproject commit 660ed9ce29939c72ef12bab9da33eafdc513b551 +Subproject commit d655ebf3f56eb206c2460b77d2e4b0268466fa67 diff --git a/modules/db b/modules/db index 9285821..1962378 160000 --- a/modules/db +++ b/modules/db @@ -1 +1 @@ -Subproject commit 92858219b522e530ebea378c40bb44e87bb77bdb +Subproject commit 1962378ffb62deaadaf8b3e4d42b4f544772a80d From 3fe08a7942ca749c4d720b7d812c707ac9e893f7 Mon Sep 17 00:00:00 2001 From: Gaspard Kirira Date: Sat, 24 Jan 2026 18:38:59 +0300 Subject: [PATCH 12/12] update CHANGELOG --- CHANGELOG.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5708868..9222517 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,33 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 --- ## [Unreleased] +# Vix.cpp v1.21.0 + +This release stabilizes the new DB core module, improves CLI runtime output, and fixes several build/link issues across modules. + +## Highlights +- DB/ORM separation is now fully aligned: `vix::db` is the low-level core layer, `vix::orm` remains optional sugar on top. +- CLI runtime output and error UX were refined to be clearer and less noisy. +- Improved reliability for MySQL detection/linking in diverse environments. + +## CLI (modules/cli) +- Fix: prevent duplicate runtime logs in some failure paths. +- Improve: runtime error detectors and diagnostics formatting. +- Improve: UX cleanup for run/dev flows (clearer output, less noise). + +## DB Core (modules/db) +- Fix: CMake/source/linkage issues across DB drivers. +- Fix: MySQL Connector/C++ discovery via fallback alias target (more robust CI/local setups). +- Improve: driver linkage consistency and feature flag reporting. + +## Umbrella / Modules +- Introduced `vix::db` as a core module and decoupled ORM tooling/drivers accordingly. +- Synced submodules after DB/ORM compatibility fixes. + +## Upgrade notes +- If you enable `ORM`, it automatically implies `DB`. +- If MySQL is enabled, ensure Connector/C++ is available (the fallback alias helps when CMake configs are missing). + ## v1.20.1 — Improved CLI Error UX & Build Feedback ### ✨ CLI — Error reporting & diagnostics