From 09db07ccc7450be0b525821f7525810c0505316d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Rombauts?= Date: Sun, 3 May 2015 22:56:21 +0200 Subject: [PATCH] Updated version to 1.0.0 changelog and copyright date --- CHANGELOG.txt | 15 ++++++++++++++- TODO.txt | 17 ++++++++--------- examples/example1/main.cpp | 2 +- include/SQLiteCpp/Column.h | 2 +- include/SQLiteCpp/Database.h | 32 ++++++++++++++++---------------- include/SQLiteCpp/SQLiteCpp.h | 6 +++--- sqlite3/CMakeLists.txt | 2 +- src/Column.cpp | 2 +- src/Database.cpp | 26 +++++++++++++------------- src/Transaction.cpp | 1 + tests/Database_test.cpp | 2 +- tests/Statement_test.cpp | 2 +- 12 files changed, 61 insertions(+), 48 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index fc69057..1f4ede4 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -41,6 +41,19 @@ Version 0.7.0 - January 9 2014 Added std::string version of existing APIs Improved CMake with more build options and Doxygen auto-detection -Version 0.8.0 - Februrary 26 2014 +Version 0.8.0 - February 26 2014 + Database constructor support opening a database with a custom VFS (default to NULL) Changed Column::getText() to return empty string "" by default instead of NULL pointer (to handle std::string conversion) +Version 1.0.0 - pending May 2015 + Public headers file moved to include/ dir + Added support to biicode in CMakeLists.txt + Added Unit Tests + Added a aBusyTimeoutMs parameter to Database() constructors + Added a Database::getTotalChanges() + Added a Database::getErrorCode() + Added a Statement::clearBindings() + Added a Statement::getColumn(aName) + Added a Statement::getErrorCode() + Added a Statement::getColumnName(aIndex) + Added a Statement::getColumnOriginName(aIndex) diff --git a/TODO.txt b/TODO.txt index 0bbd02a..a1de34d 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,24 +1,23 @@ -Add a full googletest suite - Add a Tutorial: for SQLite newbies -Create Github Wiki pages with the README.md and FAQ.txt: Installation, Examples, Tutorial, How to contribute - -Publish a versionned ZIP file in Google Project Mirror +Improve Github Wiki pages with the FAQ: Installation, Examples, Tutorial, How to contribute Publish the Doxygen Documentation in the Github Pages (gh-pages branch) -Missing features in v0.9.9: -- getColumnByName() (issue #23) ? std::map getRow() ? +Missing features in v1.0.0: - bind a SQLITE_STATIC value (string/blob) - bind a dynamic value with zerocopy (unlike SQLITE_TRANSIENT) with custom deleter -Missing documentation in v0.9.9: +Missing documentation in v1.0.0: - explain the noncopyable property for RAII design - comment on returning error code instead of exception that shall not be thrown when exepected (!?) +Missing unit tests in v1.0.0: +- Create Function +- Assert Handler +- Binding variants + Advanced missing features: - backup support to/from file/:memory: -- Function ? - Agregate ? - support for different transaction mode ? NO: too specific - operator<< binding ? NO: redundant with bind() diff --git a/examples/example1/main.cpp b/examples/example1/main.cpp index 494de42..9a37f89 100644 --- a/examples/example1/main.cpp +++ b/examples/example1/main.cpp @@ -4,7 +4,7 @@ * * Demonstrates how-to use the SQLite++ wrapper * - * Copyright (c) 2012-2014 Sebastien Rombauts (sebastien.rombauts@gmail.com) + * Copyright (c) 2012-2015 Sebastien Rombauts (sebastien.rombauts@gmail.com) * * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt * or copy at http://opensource.org/licenses/MIT) diff --git a/include/SQLiteCpp/Column.h b/include/SQLiteCpp/Column.h index 1679dbc..591419c 100644 --- a/include/SQLiteCpp/Column.h +++ b/include/SQLiteCpp/Column.h @@ -3,7 +3,7 @@ * @ingroup SQLiteCpp * @brief Encapsulation of a Column in a row of the result pointed by the prepared SQLite::Statement. * - * Copyright (c) 2012-2014 Sebastien Rombauts (sebastien.rombauts@gmail.com) + * Copyright (c) 2012-2015 Sebastien Rombauts (sebastien.rombauts@gmail.com) * * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt * or copy at http://opensource.org/licenses/MIT) diff --git a/include/SQLiteCpp/Database.h b/include/SQLiteCpp/Database.h index 190446b..8696577 100644 --- a/include/SQLiteCpp/Database.h +++ b/include/SQLiteCpp/Database.h @@ -53,17 +53,17 @@ public: * * Exception is thrown in case of error, then the Database object is NOT constructed. * - * @param[in] apFilename UTF-8 path/uri to the database file ("filename" sqlite3 parameter) - * @param[in] aFlags SQLITE_OPEN_READONLY/SQLITE_OPEN_READWRITE/SQLITE_OPEN_CREATE... - * @param[in] aTimeoutMs Amount of milliseconds to wait before returning SQLITE_BUSY (see setBusyTimeout()) - * @param[in] apVfs UTF-8 name of custom VFS to use, or nullptr for sqlite3 default + * @param[in] apFilename UTF-8 path/uri to the database file ("filename" sqlite3 parameter) + * @param[in] aFlags SQLITE_OPEN_READONLY/SQLITE_OPEN_READWRITE/SQLITE_OPEN_CREATE... + * @param[in] aBusyTimeoutMs Amount of milliseconds to wait before returning SQLITE_BUSY (see setBusyTimeout()) + * @param[in] apVfs UTF-8 name of custom VFS to use, or nullptr for sqlite3 default * * @throw SQLite::Exception in case of error */ Database(const char* apFilename, - const int aFlags = SQLITE_OPEN_READONLY, - const int aTimeoutMs = 0, - const char* apVfs = NULL); + const int aFlags = SQLITE_OPEN_READONLY, + const int aBusyTimeoutMs = 0, + const char* apVfs = NULL); /** * @brief Open the provided database UTF-8 filename. @@ -75,17 +75,17 @@ public: * * Exception is thrown in case of error, then the Database object is NOT constructed. * - * @param[in] aFilename UTF-8 path/uri to the database file ("filename" sqlite3 parameter) - * @param[in] aFlags SQLITE_OPEN_READONLY/SQLITE_OPEN_READWRITE/SQLITE_OPEN_CREATE... - * @param[in] aTimeoutMs Amount of milliseconds to wait before returning SQLITE_BUSY (see setBusyTimeout()) - * @param[in] aVfs UTF-8 name of custom VFS to use, or empty string for sqlite3 default + * @param[in] aFilename UTF-8 path/uri to the database file ("filename" sqlite3 parameter) + * @param[in] aFlags SQLITE_OPEN_READONLY/SQLITE_OPEN_READWRITE/SQLITE_OPEN_CREATE... + * @param[in] aBusyTimeoutMs Amount of milliseconds to wait before returning SQLITE_BUSY (see setBusyTimeout()) + * @param[in] aVfs UTF-8 name of custom VFS to use, or empty string for sqlite3 default * * @throw SQLite::Exception in case of error */ Database(const std::string& aFilename, - const int aFlags = SQLITE_OPEN_READONLY, - const int aTimeoutMs = 0, - const std::string& aVfs = ""); + const int aFlags = SQLITE_OPEN_READONLY, + const int aBusyTimeoutMs = 0, + const std::string& aVfs = ""); /** * @brief Close the SQLite database connection. @@ -106,11 +106,11 @@ public: * Reading the value of timeout for current connection can be done with SQL query "PRAGMA busy_timeout;". * Default busy timeout is 0ms. * - * @param[in] aTimeoutMs Amount of milliseconds to wait before returning SQLITE_BUSY + * @param[in] aBusyTimeoutMs Amount of milliseconds to wait before returning SQLITE_BUSY * * @throw SQLite::Exception in case of error */ - void setBusyTimeout(const int aTimeoutMs) noexcept; // nothrow + void setBusyTimeout(const int aBusyTimeoutMs) noexcept; // nothrow /** * @brief Shortcut to execute one or multiple statements without results. diff --git a/include/SQLiteCpp/SQLiteCpp.h b/include/SQLiteCpp/SQLiteCpp.h index 6228001..a42f20d 100644 --- a/include/SQLiteCpp/SQLiteCpp.h +++ b/include/SQLiteCpp/SQLiteCpp.h @@ -5,7 +5,7 @@ * * Include this main header file in your project to gain access to all functionality provided by the wrapper. * - * Copyright (c) 2012-2014 Sebastien Rombauts (sebastien.rombauts@gmail.com) + * Copyright (c) 2012-2015 Sebastien Rombauts (sebastien.rombauts@gmail.com) * * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt * or copy at http://opensource.org/licenses/MIT) @@ -38,5 +38,5 @@ * with the value (X*1000000 + Y*1000 + Z) where X, Y, and Z are the same * numbers used in [SQLITECPP_VERSION]. */ -#define SQLITECPP_VERSION "0.9.9" -#define SQLITECPP_VERSION_NUMBER 0009009 +#define SQLITECPP_VERSION "1.0.0" +#define SQLITECPP_VERSION_NUMBER 1000000 diff --git a/sqlite3/CMakeLists.txt b/sqlite3/CMakeLists.txt index d163f50..7d615be 100644 --- a/sqlite3/CMakeLists.txt +++ b/sqlite3/CMakeLists.txt @@ -1,6 +1,6 @@ # CMake file for compiling the sqlite3 static library under Windows (for ease of use) # -# Copyright (c) 2013-2014 Sebastien Rombauts (sebastien.rombauts@gmail.com) +# Copyright (c) 2013-2015 Sebastien Rombauts (sebastien.rombauts@gmail.com) # # Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt # or copy at http://opensource.org/licenses/MIT) diff --git a/src/Column.cpp b/src/Column.cpp index c0b7991..eb68e96 100644 --- a/src/Column.cpp +++ b/src/Column.cpp @@ -3,7 +3,7 @@ * @ingroup SQLiteCpp * @brief Encapsulation of a Column in a row of the result pointed by the prepared SQLite::Statement. * - * Copyright (c) 2012-2014 Sebastien Rombauts (sebastien.rombauts@gmail.com) + * Copyright (c) 2012-2015 Sebastien Rombauts (sebastien.rombauts@gmail.com) * * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt * or copy at http://opensource.org/licenses/MIT) diff --git a/src/Database.cpp b/src/Database.cpp index bf94675..178ecd7 100644 --- a/src/Database.cpp +++ b/src/Database.cpp @@ -27,9 +27,9 @@ namespace SQLite // Open the provided database UTF-8 filename with SQLITE_OPEN_xxx provided flags. Database::Database(const char* apFilename, - const int aFlags /* = SQLITE_OPEN_READONLY*/, - const int aTimeoutMs /* = 0 */, - const char* apVfs /* = NULL*/) : + const int aFlags /* = SQLITE_OPEN_READONLY*/, + const int aBusyTimeoutMs /* = 0 */, + const char* apVfs /* = NULL*/) : mpSQLite(NULL), mFilename(apFilename) { @@ -41,17 +41,17 @@ Database::Database(const char* apFilename, throw SQLite::Exception(strerr); } - if (aTimeoutMs > 0) + if (aBusyTimeoutMs > 0) { - setBusyTimeout(aTimeoutMs); + setBusyTimeout(aBusyTimeoutMs); } } // Open the provided database UTF-8 filename with SQLITE_OPEN_xxx provided flags. Database::Database(const std::string& aFilename, - const int aFlags /* = SQLITE_OPEN_READONLY*/, - const int aTimeoutMs /* = 0 */, - const std::string& aVfs /* = "" */) : + const int aFlags /* = SQLITE_OPEN_READONLY*/, + const int aBusyTimeoutMs /* = 0 */, + const std::string& aVfs /* = "" */) : mpSQLite(NULL), mFilename(aFilename) { @@ -63,9 +63,9 @@ Database::Database(const std::string& aFilename, throw SQLite::Exception(strerr); } - if (aTimeoutMs > 0) + if (aBusyTimeoutMs > 0) { - setBusyTimeout(aTimeoutMs); + setBusyTimeout(aBusyTimeoutMs); } } @@ -86,13 +86,13 @@ Database::~Database() noexcept // nothrow * Reading the value of timeout for current connection can be done with SQL query "PRAGMA busy_timeout;". * Default busy timeout is 0ms. * - * @param[in] aTimeoutMs Amount of milliseconds to wait before returning SQLITE_BUSY + * @param[in] aBusyTimeoutMs Amount of milliseconds to wait before returning SQLITE_BUSY * * @throw SQLite::Exception in case of error */ -void Database::setBusyTimeout(const int aTimeoutMs) noexcept // nothrow +void Database::setBusyTimeout(const int aBusyTimeoutMs) noexcept // nothrow { - const int ret = sqlite3_busy_timeout(mpSQLite, aTimeoutMs); + const int ret = sqlite3_busy_timeout(mpSQLite, aBusyTimeoutMs); check(ret); } diff --git a/src/Transaction.cpp b/src/Transaction.cpp index d486f3b..1b60aa5 100644 --- a/src/Transaction.cpp +++ b/src/Transaction.cpp @@ -38,6 +38,7 @@ Transaction::~Transaction() noexcept // nothrow catch (SQLite::Exception& e) { // Never throw an exception in a destructor + (void)e; // warning proof SQLITECPP_ASSERT(false, e.what()); // See SQLITECPP_ENABLE_ASSERT_HANDLER } } diff --git a/tests/Database_test.cpp b/tests/Database_test.cpp index 57a8cd2..7441fc9 100644 --- a/tests/Database_test.cpp +++ b/tests/Database_test.cpp @@ -21,7 +21,7 @@ namespace SQLite /// definition of the assertion handler enabled when SQLITECPP_ENABLE_ASSERT_HANDLER is defined in the project (CMakeList.txt) void assertion_failed(const char* apFile, const long apLine, const char* apFunc, const char* apExpr, const char* apMsg) { - // TODO: test that this assertion callback get called + // TODO: unit test that this assertion callback get called (already tested manually) std::cout << "assertion_failed(" << apFile << ", " << apLine << ", " << apFunc << ", " << apExpr << ", " << apMsg << ")\n"; } } diff --git a/tests/Statement_test.cpp b/tests/Statement_test.cpp index e725a8d..c76dcc5 100644 --- a/tests/Statement_test.cpp +++ b/tests/Statement_test.cpp @@ -84,7 +84,7 @@ TEST(Statement, invalid) { EXPECT_THROW(query.exec(), SQLite::Exception); // exec() shall throw as it does not expect a result } -// TODO: test every kind of binding +// TODO: test every kind of binding + clearBindings() TEST(Statement, getColumnByName) { // Create a new database