diff --git a/CHANGELOG.txt b/CHANGELOG.txt index c11db12..d5e61a7 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -80,8 +80,11 @@ Version 1.3.1 - February 10 2016 Remove warnings Remove biicode support (defunct service, servers will shutdown the 16th of February 2016) -Version 1.4.0 - 2016 ? +Version 2.0.0 - July 25 2016 Update SQLite3 from 3.10.2 to latest 3.13 (2016-05-18) + Move #include from headers to .cpp files only using forward declarations + Add Database::VERSION to reach SQLITE_VERSION without including sqlite3.h in application code + Add getLibVersion() and getLibVersionNumber() to get runtime version of the library Better exception messages when Statements fail PR #84 Variadic templates for bind() (C++14) PR #85 Add Statement::bindNoCopy() methods for strings, using SQLITE_STATIC to avoid internal copy by SQLite3 PR #86 @@ -90,4 +93,4 @@ Version 1.4.0 - 2016 ? Rename Backup::remainingPageCount()/totalPageCount() to Backup::getRemainingPageCount()/getTotalPageCount() Remove Column::errmsg() method : use Database or Statement equivalents More unit tests, with code coverage status on the GitHub page - Move #include from headers to .cpp files only using forward declarations + Do not force MSVC to use static runtime if unit-tests are not build diff --git a/examples/example1/main.cpp b/examples/example1/main.cpp index 59a079d..3143623 100644 --- a/examples/example1/main.cpp +++ b/examples/example1/main.cpp @@ -85,8 +85,8 @@ private: int main () { // Using SQLITE_VERSION would require #include which we want to avoid - // TODO: replace by a SQLite::VERSION - // std::cout << "SQlite3 version " << SQLITE_VERSION << std::endl; +// std::cout << "SQlite3 version " << SQLITE_VERSION << std::endl; + std::cout << "SQlite3 version " << SQLite::VERSION << " (" << SQLite::getLibVersion() << ")" << std::endl; std::cout << "SQliteC++ version " << SQLITECPP_VERSION << std::endl; //////////////////////////////////////////////////////////////////////////// diff --git a/include/SQLiteCpp/Database.h b/include/SQLiteCpp/Database.h index 0cf793a..bff00c0 100644 --- a/include/SQLiteCpp/Database.h +++ b/include/SQLiteCpp/Database.h @@ -37,9 +37,16 @@ extern const int OPEN_CREATE; // SQLITE_OPEN_CREATE /// Enable URI filename interpretation, parsed according to RFC 3986 (ex. "file:data.db?mode=ro&cache=private") extern const int OPEN_URI; // SQLITE_OPEN_URI - extern const int OK; ///< SQLITE_OK (used by inline check() bellow) +extern const char* VERSION; ///< SQLITE_VERSION string from the sqlite3.h used at compile time +extern const int VERSION_NUMBER; ///< SQLITE_VERSION_NUMBER from the sqlite3.h used at compile time + +/// Return SQLite version string using runtime call to the compiled library +const char* getLibVersion() noexcept; // nothrow +/// Return SQLite version number using runtime call to the compiled library +const int getLibVersionNumber() noexcept; // nothrow + /** * @brief RAII management of a SQLite Database Connection. diff --git a/src/Database.cpp b/src/Database.cpp index 734545e..b570a5b 100644 --- a/src/Database.cpp +++ b/src/Database.cpp @@ -32,6 +32,21 @@ extern const int OPEN_MEMORY = SQLITE_OPEN_MEMORY; extern const int OK = SQLITE_OK; +extern const char* VERSION = SQLITE_VERSION; +extern const int VERSION_NUMBER = SQLITE_VERSION_NUMBER; + +// Return SQLite version string using runtime call to the compiled library +const char* getLibVersion() noexcept // nothrow +{ + return sqlite3_libversion(); +} + +// Return SQLite version number using runtime call to the compiled library +const int getLibVersionNumber() noexcept // nothrow +{ + return sqlite3_libversion_number(); +} + // Open the provided database UTF-8 filename with SQLite::OPEN_xxx provided flags. Database::Database(const char* apFilename,