Add Database::VERSION, getLibVersion() and getLibVersionNumber()

Usefull to get SQLite3 version without including sqlite3.h in application code
This commit is contained in:
Sébastien Rombauts 2016-07-25 21:53:06 +02:00
parent f77b707206
commit 648ffe01e8
4 changed files with 30 additions and 5 deletions

View File

@ -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 <sqlite3.h> 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 <sqlite3.h> from headers to .cpp files only using forward declarations
Do not force MSVC to use static runtime if unit-tests are not build

View File

@ -85,8 +85,8 @@ private:
int main ()
{
// Using SQLITE_VERSION would require #include <sqlite3.h> 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;
////////////////////////////////////////////////////////////////////////////

View File

@ -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.

View File

@ -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,