diff --git a/.claude/skills/sqlitecpp-build-cmake/SKILL.md b/.claude/skills/sqlitecpp-build-cmake/SKILL.md index d89acd31..d89add91 100644 --- a/.claude/skills/sqlitecpp-build-cmake/SKILL.md +++ b/.claude/skills/sqlitecpp-build-cmake/SKILL.md @@ -43,7 +43,9 @@ description: Build SQLiteCpp with CMake. Use for CMake builds, tests, options, o ## Notes - Tests can use a system `GTest`; otherwise they fall back to the `googletest` submodule. - If the submodule is needed: `git submodule update --init --recursive`. -- SQLiteCpp requires CMake 3.16 or newer and C++17 or newer. +- SQLiteCpp requires CMake 3.16 or newer, C++17 or newer, and SQLite 3.38.0 or newer. +- `find_package(SQLite3 3.38.0 REQUIRED)` checks discovered system SQLite versions. + Custom SQLite targets are also covered by the source-level compile-time version check. - MSVC requires VS2017 15.9 / MSVC 19.16 or newer, enforced with a fatal configuration diagnostic. - `cxx_std_17` requests a standard mode; it does not prove complete C++17 feature support. Old MSVC toolsets are a special case: CMake can advertise standard meta-features even when the diff --git a/.claude/skills/sqlitecpp-build-meson/SKILL.md b/.claude/skills/sqlitecpp-build-meson/SKILL.md index e4a029b6..0a0df9ba 100644 --- a/.claude/skills/sqlitecpp-build-meson/SKILL.md +++ b/.claude/skills/sqlitecpp-build-meson/SKILL.md @@ -31,6 +31,8 @@ description: Builds SQLiteCpp with Meson. Use when configuring Meson builds, tes - `SQLITE_OMIT_LOAD_EXTENSION`: omit load extension. ## Notes +- SQLiteCpp requires SQLite 3.38.0 or newer. Meson checks the sqlite3 dependency version, + and the source-level compile-time check covers custom dependency configurations. - C++17 is the SQLiteCpp project minimum; Meson defaults to `cpp_std=c++17` and rejects older standards. - MSVC requires VS2017 15.9 / MSVC 19.16 or newer, matching the CMake minimum and its CI coverage. - C++20 can be selected explicitly for compatibility testing. diff --git a/AGENTS.md b/AGENTS.md index 9ae6eb8a..908967c6 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -65,6 +65,8 @@ tests, and CI changes, even when the same task prompts both kinds of work. - Max 120 characters per line ## Build System Compatibility +- SQLiteCpp 4.x requires SQLite 3.38.0 or newer, whether bundled or provided externally. + A compile-time check rejects older SQLite headers; CMake and Meson also check discovered dependency versions. - The MSVC minimum is Visual Studio 2017 15.9 (MSVC 19.16 / v141 toolset 14.16). Keep its explicit build-system diagnostics and dedicated CI coverage aligned. Assert the actual compiler version and exercise required library facilities so CI cannot silently use a newer toolset. diff --git a/CHANGELOG.md b/CHANGELOG.md index 3659acb4..7e5730fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,9 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Bump the shared-library ABI version from 0 to 1 for SQLiteCpp 4.0 +- Require SQLite 3.38.0 or newer (#596) - Require C++17 and CMake 3.16 or newer (#580) - Adopt CMake 4.4 policies and test them (#581) -- Bump the shared-library ABI version from 0 to 1 for SQLiteCpp 4.0 - Use fixed-width integer types in `SQLite::Header`, making field widths consistent across platforms (ABI change) (#582) - Update googletest to v1.18.0 (#583) - Improve tests for `Savepoint::rollbackTo()` and scope-exit rollback semantics (#584) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7847b15e..9bb2dcec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -345,7 +345,7 @@ elseif (SQLITECPP_FIND_SQLITE) target_link_libraries(SQLiteCpp PRIVATE ${sqlcipher_LIBRARY}) endif() else() - find_package (SQLite3 REQUIRED) + find_package (SQLite3 3.38.0 REQUIRED) message(STATUS "Link to sqlite3 system library ${SQLite3_VERSION}") target_link_libraries(SQLiteCpp PUBLIC SQLite::SQLite3) if(SQLite3_VERSION VERSION_LESS "3.19") @@ -450,6 +450,7 @@ if (SQLITECPP_RUN_CPPCHECK) find_program(CPPCHECK_EXECUTABLE NAMES cppcheck) if (CPPCHECK_EXECUTABLE) # Add an explicit cppcheck target for the quality workflow. + # Provide the bundled SQLite header so cppcheck can evaluate SQLITE_VERSION_NUMBER. add_custom_target(SQLiteCpp_cppcheck COMMAND ${CPPCHECK_EXECUTABLE} -j 8 @@ -457,6 +458,7 @@ if (SQLITECPP_RUN_CPPCHECK) --error-exitcode=1 --quiet --std=c++17 + -I${PROJECT_SOURCE_DIR}/sqlite3 ${CPPCHECK_ARG_TEMPLATE} ${PROJECT_SOURCE_DIR}/src ) diff --git a/README.md b/README.md index fd2b45ce..50a15d56 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,8 @@ All of the code and documentation in SQLite has been dedicated to the public dom - to be light and fast **C++17 baseline:** SQLiteCpp 4.x requires C++17. SQLiteCpp 3.4.x is the final release line supporting C++11; maintenance fixes for the 3.x series remain on the `sqlitecpp-3.4.x` branch. + +**SQLite baseline:** SQLiteCpp 4.x requires SQLite 3.38.0 or newer. - to be thread-safe only as much as SQLite "Multi-thread" mode (see below) - to have a good unit test coverage - to use API names sticking with those of the SQLite library @@ -87,7 +89,7 @@ and the CMake compatibility workflow also exercises C++20. - a C++17-capable compiler and standard library - Visual Studio 2017 15.9 (MSVC 19.16 / v141 toolset 14.16) or newer when using MSVC - exception support (the class Exception inherits from std::runtime_error) -- the SQLite library (3.8.7 minimum from 2014-10-17), either by linking to it dynamically or statically +- the SQLite library (3.38.0 minimum, released 2022-02-22), either by linking to it dynamically or statically (install the libsqlite3-dev package under Debian/Ubuntu/Mint Linux), or by adding its source file in your project code base (source code provided in src/sqlite3 for Windows), with the `SQLITE_ENABLE_COLUMN_METADATA` macro defined (see http://www.sqlite.org/compile.html#enable_column_metadata). diff --git a/meson.build b/meson.build index 3151d433..e525f861 100644 --- a/meson.build +++ b/meson.build @@ -34,6 +34,7 @@ thread_dep = dependency('threads') # sqlite3 support sqlite3_dep = dependency( 'sqlite3', + version: '>=3.38.0', fallback: ['sqlite3', 'sqlite3_dep'] ) diff --git a/src/Database.cpp b/src/Database.cpp index 7b723f59..e35fbf8c 100644 --- a/src/Database.cpp +++ b/src/Database.cpp @@ -16,6 +16,10 @@ #include #include + +#if SQLITE_VERSION_NUMBER < 3038000 + #error "SQLiteCpp 4.0 requires SQLite 3.38.0 or newer" +#endif #include #include #include @@ -212,8 +216,8 @@ void Database::loadExtension(const char* apExtensionName, const char *apEntryPoi // It is recommended that the SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION method be used to enable only this interface. // The use of the sqlite3_enable_load_extension() interface should be avoided to keep the SQL load_extension() // disabled and prevent SQL injections from giving attackers access to extension loading capabilities. - // (NOTE: not using nullptr: cannot pass object of non-POD type 'std::__1::nullptr_t' through variadic function) - int ret = sqlite3_db_config(getHandle(), SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION, 1, NULL); // NOTE: not using nullptr + // sqlite3_db_config is variadic; pass a typed null pointer for its optional int* output. + int ret = sqlite3_db_config(getHandle(), SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION, 1, static_cast(nullptr)); #else int ret = sqlite3_enable_load_extension(getHandle(), 1); #endif