diff --git a/CHANGELOG.md b/CHANGELOG.md index d826feb..d26a2c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -133,4 +133,6 @@ Version ? - Update SQLite3 from 3.27.2 to 3.28.0 (2019-04-16) - #191 CMake Warning line 299 - #190 Implement move constructors -- #192 Add wrapper for bind parameter count \ No newline at end of file +- #192 Add wrapper for bind parameter count +- #197 Add tuple_bind and execute_many +- #199 Fix #156 misleading error message in exception from Statement::exec diff --git a/README.md b/README.md index 558b5be..1c2f7c2 100644 --- a/README.md +++ b/README.md @@ -301,7 +301,8 @@ The source code use the CamelCase naming style variant where: - files (.cpp/.h) are named like the class they contain - function and variable names begin with a lower case letter - member variables begin with a 'm', function arguments begin with a 'a', booleans with a 'b', pointers with a 'p' -- each file, class, method and member variable is documented using Doxygen tags +- each file, class, method and member variable is documented using Doxygen tags +- braces on their own line See also http://www.appinf.com/download/CppCodingStyleGuide.pdf for good guidelines ## See also - Some other simple C++ SQLite wrappers: diff --git a/include/SQLiteCpp/ExecuteMany.h b/include/SQLiteCpp/ExecuteMany.h index a6b90ad..4013144 100644 --- a/include/SQLiteCpp/ExecuteMany.h +++ b/include/SQLiteCpp/ExecuteMany.h @@ -3,7 +3,8 @@ * @ingroup SQLiteCpp * @brief Convenience function to execute a Statement with multiple Parameter sets * - * Copyright (c) 2019 Maximilian Bachmann (github@maxbachmann) + * Copyright (c) 2019 Maximilian Bachmann (github maxbachmann) + * Copyright (c) 2019 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) @@ -39,15 +40,17 @@ namespace SQLite * \endcode * @param aDatabase Database to use * @param apQuery Query to use with all parameter sets - * @param Arg first tuple with parameters - * @param Types the following tuples with parameters + * @param aArg first tuple with parameters + * @param aParams the following tuples with parameters */ template -void execute_many(Database& aDatabase, const char* apQuery, Arg&& arg, Types&&... params) { +void execute_many(Database& aDatabase, const char* apQuery, Arg&& aArg, Types&&... aParams) +{ SQLite::Statement query(aDatabase, apQuery); - bind_exec(query, std::forward(arg)); - (void)std::initializer_list{ - ((void)reset_bind_exec(query, std::forward(params)), 0)... + bind_exec(query, std::forward(aArg)); + (void)std::initializer_list + { + ((void)reset_bind_exec(query, std::forward(aParams)), 0)... }; } @@ -58,13 +61,13 @@ void execute_many(Database& aDatabase, const char* apQuery, Arg&& arg, Types&&.. * This feature requires a c++14 capable compiler. * * @param apQuery Query to use - * @param tuple tuple to bind + * @param aTuple Tuple to bind */ template -void reset_bind_exec(SQLite::Statement& query, std::tuple&& tuple) +void reset_bind_exec(SQLite::Statement& apQuery, std::tuple&& aTuple) { - query.reset(); - bind_exec(query, std::forward(tuple)); + apQuery.reset(); + bind_exec(apQuery, std::forward(aTuple)); } /** @@ -73,13 +76,13 @@ void reset_bind_exec(SQLite::Statement& query, std::tuple&& tuple) * This feature requires a c++14 capable compiler. * * @param apQuery Query to use - * @param tuple tuple to bind + * @param aTuple Tuple to bind */ template -void bind_exec(SQLite::Statement& query, std::tuple&& tuple) +void bind_exec(SQLite::Statement& apQuery, std::tuple&& aTuple) { - bind(query, std::forward(tuple)); - while (query.executeStep()) {} + bind(apQuery, std::forward(aTuple)); + while (apQuery.executeStep()) {} } } // namespace SQLite diff --git a/include/SQLiteCpp/VariadicBind.h b/include/SQLiteCpp/VariadicBind.h index f2a2aa5..8e5a31c 100644 --- a/include/SQLiteCpp/VariadicBind.h +++ b/include/SQLiteCpp/VariadicBind.h @@ -5,7 +5,7 @@ * * Copyright (c) 2016 Paul Dreik (github@pauldreik.se) * Copyright (c) 2016-2019 Sebastien Rombauts (sebastien.rombauts@gmail.com) - * Copyright (c) 2019 Maximilian Bachmann (github@maxbachmann) + * Copyright (c) 2019 Maximilian Bachmann (github maxbachmann) * * 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 3b74169..a97459f 100644 --- a/src/Database.cpp +++ b/src/Database.cpp @@ -198,7 +198,8 @@ void Database::createFunction(const char* apFuncName, { int TextRep = SQLITE_UTF8; // optimization if deterministic function (e.g. of nondeterministic function random()) - if (abDeterministic) { + if (abDeterministic) + { TextRep = TextRep|SQLITE_DETERMINISTIC; } const int ret = sqlite3_create_function_v2(mpSQLite, apFuncName, aNbArg, TextRep, @@ -237,14 +238,16 @@ void Database::loadExtension(const char* apExtensionName, const char *apEntryPoi // Set the key for the current sqlite database instance. void Database::key(const std::string& aKey) const { - int pass_len = static_cast(aKey.length()); + int passLen = static_cast(aKey.length()); #ifdef SQLITE_HAS_CODEC - if (pass_len > 0) { - const int ret = sqlite3_key(mpSQLite, aKey.c_str(), pass_len); + if (passLen > 0) + { + const int ret = sqlite3_key(mpSQLite, aKey.c_str(), passLen); check(ret); } #else // SQLITE_HAS_CODEC - if (pass_len > 0) { + if (passLen > 0) + { const SQLite::Exception exception("No encryption support, recompile with SQLITE_HAS_CODEC to enable."); throw exception; } @@ -255,11 +258,14 @@ void Database::key(const std::string& aKey) const void Database::rekey(const std::string& aNewKey) const { #ifdef SQLITE_HAS_CODEC - int pass_len = aNewKey.length(); - if (pass_len > 0) { - const int ret = sqlite3_rekey(mpSQLite, aNewKey.c_str(), pass_len); + int passLen = aNewKey.length(); + if (passLen > 0) + { + const int ret = sqlite3_rekey(mpSQLite, aNewKey.c_str(), passLen); check(ret); - } else { + } + else + { const int ret = sqlite3_rekey(mpSQLite, nullptr, 0); check(ret); } @@ -273,14 +279,18 @@ void Database::rekey(const std::string& aNewKey) const // Test if a file contains an unencrypted database. bool Database::isUnencrypted(const std::string& aFilename) { - if (aFilename.length() > 0) { + if (aFilename.length() > 0) + { std::ifstream fileBuffer(aFilename.c_str(), std::ios::in | std::ios::binary); char header[16]; - if (fileBuffer.is_open()) { + if (fileBuffer.is_open()) + { fileBuffer.seekg(0, std::ios::beg); fileBuffer.getline(header, 16); fileBuffer.close(); - } else { + } + else + { const SQLite::Exception exception("Error opening file: " + aFilename); throw exception; } diff --git a/tests/Backup_test.cpp b/tests/Backup_test.cpp index 344c497..4ea9e84 100644 --- a/tests/Backup_test.cpp +++ b/tests/Backup_test.cpp @@ -21,7 +21,8 @@ #include -TEST(Backup, initException) { +TEST(Backup, initException) +{ remove("backup_test.db3"); SQLite::Database srcDB("backup_test.db3", SQLite::OPEN_READWRITE|SQLite::OPEN_CREATE); srcDB.exec("CREATE TABLE backup_test (id INTEGER PRIMARY KEY, value TEXT)"); @@ -34,7 +35,8 @@ TEST(Backup, initException) { remove("backup_test.db3"); } -TEST(Backup, executeStepOne) { +TEST(Backup, executeStepOne) +{ remove("backup_test.db3"); remove("backup_test.db3.backup"); SQLite::Database srcDB("backup_test.db3", SQLite::OPEN_READWRITE|SQLite::OPEN_CREATE); @@ -66,7 +68,8 @@ TEST(Backup, executeStepOne) { remove("backup_test.db3.backup"); } -TEST(Backup, executeStepAll) { +TEST(Backup, executeStepAll) +{ remove("backup_test.db3"); remove("backup_test.db3.backup"); SQLite::Database srcDB("backup_test.db3", SQLite::OPEN_READWRITE|SQLite::OPEN_CREATE); @@ -94,7 +97,8 @@ TEST(Backup, executeStepAll) { remove("backup_test.db3.backup"); } -TEST(Backup, executeStepException) { +TEST(Backup, executeStepException) +{ remove("backup_test.db3"); remove("backup_test.db3.backup"); SQLite::Database srcDB("backup_test.db3", SQLite::OPEN_READWRITE|SQLite::OPEN_CREATE); diff --git a/tests/Column_test.cpp b/tests/Column_test.cpp index 82c1907..5503cb7 100644 --- a/tests/Column_test.cpp +++ b/tests/Column_test.cpp @@ -21,7 +21,8 @@ #include -TEST(Column, basis) { +TEST(Column, basis) +{ // Create a new database SQLite::Database db(":memory:", SQLite::OPEN_READWRITE|SQLite::OPEN_CREATE); EXPECT_EQ(SQLite::OK, db.getErrorCode()); @@ -187,7 +188,8 @@ TEST(Column, basis) { } } -TEST(Column, getName) { +TEST(Column, getName) +{ // Create a new database SQLite::Database db(":memory:", SQLite::OPEN_READWRITE|SQLite::OPEN_CREATE); EXPECT_EQ(0, db.exec("CREATE TABLE test (id INTEGER PRIMARY KEY, msg TEXT)")); @@ -214,7 +216,8 @@ TEST(Column, getName) { #endif } -TEST(Column, stream) { +TEST(Column, stream) +{ // Create a new database SQLite::Database db(":memory:", SQLite::OPEN_READWRITE|SQLite::OPEN_CREATE); EXPECT_EQ(0, db.exec("CREATE TABLE test (msg TEXT)")); diff --git a/tests/Database_test.cpp b/tests/Database_test.cpp index a4dfe8a..447f15e 100644 --- a/tests/Database_test.cpp +++ b/tests/Database_test.cpp @@ -29,14 +29,16 @@ void assertion_failed(const char* apFile, const long apLine, const char* apFunc, } #endif -TEST(SQLiteCpp, version) { +TEST(SQLiteCpp, version) +{ EXPECT_STREQ(SQLITE_VERSION, SQLite::VERSION); EXPECT_EQ (SQLITE_VERSION_NUMBER, SQLite::VERSION_NUMBER); EXPECT_STREQ(SQLITE_VERSION, SQLite::getLibVersion()); EXPECT_EQ (SQLITE_VERSION_NUMBER, SQLite::getLibVersionNumber()); } -TEST(Database, ctorExecCreateDropExist) { +TEST(Database, ctorExecCreateDropExist) +{ remove("test.db3"); { // Try to open a non-existing database @@ -70,7 +72,8 @@ SQLite::Database DatabaseBuilder(const char* apName) return SQLite::Database(apName, SQLite::OPEN_READWRITE | SQLite::OPEN_CREATE); } -TEST(Database, moveConstructor) { +TEST(Database, moveConstructor) +{ remove("test.db3"); { // Create a new database, using the move constructor @@ -87,7 +90,8 @@ TEST(Database, moveConstructor) { #endif -TEST(Database, createCloseReopen) { +TEST(Database, createCloseReopen) +{ remove("test.db3"); { // Try to open the non-existing database @@ -107,7 +111,8 @@ TEST(Database, createCloseReopen) { remove("test.db3"); } -TEST(Database, inMemory) { +TEST(Database, inMemory) +{ { // Create a new database SQLite::Database db(":memory:", SQLite::OPEN_READWRITE); @@ -126,7 +131,8 @@ TEST(Database, inMemory) { } #if SQLITE_VERSION_NUMBER >= 3007015 // SQLite v3.7.15 is first version with PRAGMA busy_timeout -TEST(Database, busyTimeout) { +TEST(Database, busyTimeout) +{ { // Create a new database with default timeout of 0ms SQLite::Database db(":memory:"); @@ -163,7 +169,8 @@ TEST(Database, busyTimeout) { } #endif // SQLITE_VERSION_NUMBER >= 3007015 -TEST(Database, exec) { +TEST(Database, exec) +{ // Create a new database SQLite::Database db(":memory:", SQLite::OPEN_READWRITE); @@ -224,7 +231,8 @@ TEST(Database, exec) { #endif } -TEST(Database, execAndGet) { +TEST(Database, execAndGet) +{ // Create a new database SQLite::Database db(":memory:", SQLite::OPEN_READWRITE); @@ -242,7 +250,8 @@ TEST(Database, execAndGet) { EXPECT_EQ(3, db.execAndGet("SELECT weight FROM test WHERE value=\"first\"").getInt()); } -TEST(Database, execException) { +TEST(Database, execException) +{ // Create a new database SQLite::Database db(":memory:", SQLite::OPEN_READWRITE); EXPECT_EQ(SQLite::OK, db.getErrorCode()); @@ -284,7 +293,8 @@ TEST(Database, execException) { // TODO: test Database::loadExtension() #ifdef SQLITE_HAS_CODEC -TEST(Database, encryptAndDecrypt) { +TEST(Database, encryptAndDecrypt) +{ remove("test.db3"); { // Try to open the non-existing database @@ -328,7 +338,8 @@ TEST(Database, encryptAndDecrypt) { remove("test.db3"); } #else // SQLITE_HAS_CODEC -TEST(Database, encryptAndDecrypt) { +TEST(Database, encryptAndDecrypt) +{ remove("test.db3"); { // Try to open the non-existing database @@ -350,4 +361,4 @@ TEST(Database, encryptAndDecrypt) { } // Close DB test.db3 remove("test.db3"); } -#endif // SQLITE_HAS_CODEC \ No newline at end of file +#endif // SQLITE_HAS_CODEC diff --git a/tests/Exception_test.cpp b/tests/Exception_test.cpp index b367c8b..e1a6df5 100644 --- a/tests/Exception_test.cpp +++ b/tests/Exception_test.cpp @@ -15,7 +15,8 @@ #include -TEST(Exception, copy) { +TEST(Exception, copy) +{ const SQLite::Exception ex1("some error", 2); const SQLite::Exception ex2 = ex1; EXPECT_STREQ(ex1.what(), ex2.what()); @@ -25,7 +26,8 @@ TEST(Exception, copy) { // see http://eel.is/c++draft/exception#2 or http://www.cplusplus.com/reference/exception/exception/operator=/ // an assignment operator is expected to be avaiable -TEST(Exception, assignment) { +TEST(Exception, assignment) +{ const SQLite::Exception ex1("some error", 2); SQLite::Exception ex2("some error2", 3); @@ -36,17 +38,22 @@ TEST(Exception, assignment) { EXPECT_EQ(ex1.getExtendedErrorCode(), ex2.getExtendedErrorCode()); } -TEST(Exception, throw_catch) { +TEST(Exception, throw_catch) +{ const char message[] = "some error"; - try { + try + { throw SQLite::Exception(message); - } catch (const std::runtime_error& ex) { + } + catch (const std::runtime_error& ex) + { EXPECT_STREQ(ex.what(), message); } } -TEST(Exception, constructor) { +TEST(Exception, constructor) +{ const char msg1[] = "error msg"; std::string msg2 = msg1; { diff --git a/tests/ExecuteMany_test.cpp b/tests/ExecuteMany_test.cpp index 8a4319f..03eb3b7 100644 --- a/tests/ExecuteMany_test.cpp +++ b/tests/ExecuteMany_test.cpp @@ -3,9 +3,8 @@ * @ingroup tests * @brief Test of variadic bind * - * Copyright (c) 2016 Paul Dreik (github@pauldreik.se) - * Copyright (c) 2016-2019 Sebastien Rombauts (sebastien.rombauts@gmail.com) * Copyright (c) 2019 Maximilian Bachmann (github@maxbachmann) + * Copyright (c) 2019 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) @@ -20,14 +19,13 @@ #include #if (__cplusplus >= 201402L) || ( defined(_MSC_VER) && (_MSC_VER >= 1900) ) // c++14: Visual Studio 2015 -TEST(ExecuteMany, invalid) { +TEST(ExecuteMany, invalid) +{ // Create a new database SQLite::Database db(":memory:", SQLite::OPEN_READWRITE|SQLite::OPEN_CREATE); EXPECT_EQ(0, db.exec("DROP TABLE IF EXISTS test")); - EXPECT_EQ(0, - db.exec( - "CREATE TABLE test (id INTEGER PRIMARY KEY, value TEXT DEFAULT 'default') ")); + EXPECT_EQ(0, db.exec("CREATE TABLE test (id INTEGER PRIMARY KEY, value TEXT DEFAULT 'default')")); EXPECT_TRUE(db.tableExists("test")); { execute_many(db, "INSERT INTO test VALUES (?, ?)", @@ -40,7 +38,8 @@ TEST(ExecuteMany, invalid) { { SQLite::Statement query(db, std::string{"SELECT id, value FROM test ORDER BY id"}); std::vector > results; - while (query.executeStep()) { + while (query.executeStep()) + { const int id = query.getColumn(0); std::string value = query.getColumn(1); results.emplace_back( id, std::move(value) ); diff --git a/tests/Statement_test.cpp b/tests/Statement_test.cpp index 4d31e5d..be80723 100644 --- a/tests/Statement_test.cpp +++ b/tests/Statement_test.cpp @@ -21,7 +21,8 @@ #include // For INT_MAX -TEST(Statement, invalid) { +TEST(Statement, invalid) +{ // Create a new database SQLite::Database db(":memory:", SQLite::OPEN_READWRITE|SQLite::OPEN_CREATE); EXPECT_EQ(SQLite::OK, db.getErrorCode()); @@ -103,7 +104,8 @@ SQLite::Statement StatementBuilder(SQLite::Database& aDb, const char* apQuery) return SQLite::Statement(aDb, apQuery); } -TEST(Statement, moveConstructor) { +TEST(Statement, moveConstructor) +{ // Create a new database SQLite::Database db(":memory:", SQLite::OPEN_READWRITE | SQLite::OPEN_CREATE); EXPECT_EQ(0, db.exec("CREATE TABLE test (id INTEGER PRIMARY KEY, value TEXT)")); @@ -130,7 +132,8 @@ TEST(Statement, moveConstructor) { #endif -TEST(Statement, executeStep) { +TEST(Statement, executeStep) +{ // Create a new database SQLite::Database db(":memory:", SQLite::OPEN_READWRITE|SQLite::OPEN_CREATE); EXPECT_EQ(SQLite::OK, db.getErrorCode()); @@ -182,7 +185,8 @@ TEST(Statement, executeStep) { EXPECT_THROW(insert2.exec(), SQLite::Exception); } -TEST(Statement, tryExecuteStep) { +TEST(Statement, tryExecuteStep) +{ // Create a new database SQLite::Database db(":memory:", SQLite::OPEN_READWRITE|SQLite::OPEN_CREATE); EXPECT_EQ(SQLite::OK, db.getErrorCode()); @@ -227,7 +231,8 @@ TEST(Statement, tryExecuteStep) { EXPECT_EQ(insert.tryReset(), SQLITE_CONSTRAINT); } -TEST(Statement, bindings) { +TEST(Statement, bindings) +{ // Create a new database SQLite::Database db(":memory:", SQLite::OPEN_READWRITE|SQLite::OPEN_CREATE); EXPECT_EQ(SQLite::OK, db.getErrorCode()); @@ -393,7 +398,8 @@ TEST(Statement, bindings) { } } -TEST(Statement, bindNoCopy) { +TEST(Statement, bindNoCopy) +{ // Create a new database SQLite::Database db(":memory:", SQLite::OPEN_READWRITE|SQLite::OPEN_CREATE); EXPECT_EQ(SQLite::OK, db.getErrorCode()); @@ -432,7 +438,8 @@ TEST(Statement, bindNoCopy) { } } -TEST(Statement, bindByName) { +TEST(Statement, bindByName) +{ // Create a new database SQLite::Database db(":memory:", SQLite::OPEN_READWRITE|SQLite::OPEN_CREATE); EXPECT_EQ(SQLite::OK, db.getErrorCode()); @@ -538,7 +545,8 @@ TEST(Statement, bindByName) { } } -TEST(Statement, bindNoCopyByName) { +TEST(Statement, bindNoCopyByName) +{ // Create a new database SQLite::Database db(":memory:", SQLite::OPEN_READWRITE|SQLite::OPEN_CREATE); EXPECT_EQ(SQLite::OK, db.getErrorCode()); @@ -577,7 +585,8 @@ TEST(Statement, bindNoCopyByName) { } } -TEST(Statement, isColumnNull) { +TEST(Statement, isColumnNull) +{ // Create a new database SQLite::Database db(":memory:", SQLite::OPEN_READWRITE|SQLite::OPEN_CREATE); ASSERT_EQ(SQLite::OK, db.getErrorCode()); @@ -639,7 +648,8 @@ TEST(Statement, isColumnNull) { EXPECT_THROW(query.isColumnNull(3), SQLite::Exception); } -TEST(Statement, isColumnNullByName) { +TEST(Statement, isColumnNullByName) +{ // Create a new database SQLite::Database db(":memory:", SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE); ASSERT_EQ(SQLITE_OK, db.getErrorCode()); @@ -701,7 +711,8 @@ TEST(Statement, isColumnNullByName) { EXPECT_THROW(query.isColumnNull(3), SQLite::Exception); } -TEST(Statement, getColumnByName) { +TEST(Statement, getColumnByName) +{ // Create a new database SQLite::Database db(":memory:", SQLite::OPEN_READWRITE|SQLite::OPEN_CREATE); EXPECT_EQ(SQLite::OK, db.getErrorCode()); @@ -737,7 +748,8 @@ TEST(Statement, getColumnByName) { EXPECT_EQ(0.123, real); } -TEST(Statement, getName) { +TEST(Statement, getName) +{ // Create a new database SQLite::Database db(":memory:", SQLite::OPEN_READWRITE|SQLite::OPEN_CREATE); EXPECT_EQ(0, db.exec("CREATE TABLE test (id INTEGER PRIMARY KEY, msg TEXT)")); @@ -763,7 +775,8 @@ TEST(Statement, getName) { } #if __cplusplus >= 201402L || (defined(_MSC_VER) && _MSC_VER >= 1900) -TEST(Statement, getColumns) { +TEST(Statement, getColumns) +{ struct GetRowTestStruct { int id; @@ -819,7 +832,8 @@ TEST(Statement, getColumns) { #endif #if (LONG_MAX > INT_MAX) // sizeof(long)==8 means the data model of the system is LP64 (64bits Linux) -TEST(Statement, bind64bitsLong) { +TEST(Statement, bind64bitsLong) +{ // Create a new database SQLite::Database db(":memory:", SQLite::OPEN_READWRITE|SQLite::OPEN_CREATE); EXPECT_EQ(SQLite::OK, db.getErrorCode()); @@ -832,7 +846,8 @@ TEST(Statement, bind64bitsLong) { } #endif -TEST(Statement, getBindParameterCount) { +TEST(Statement, getBindParameterCount) +{ // Create a new database SQLite::Database db(":memory:", SQLite::OPEN_READWRITE | SQLite::OPEN_CREATE); EXPECT_EQ(0, db.exec("CREATE TABLE test (id INTEGER PRIMARY KEY, msg TEXT)")); diff --git a/tests/Transaction_test.cpp b/tests/Transaction_test.cpp index d037021..b3fde2b 100644 --- a/tests/Transaction_test.cpp +++ b/tests/Transaction_test.cpp @@ -18,7 +18,8 @@ #include -TEST(Transaction, commitRollback) { +TEST(Transaction, commitRollback) +{ // Create a new database SQLite::Database db(":memory:", SQLite::OPEN_READWRITE|SQLite::OPEN_CREATE); EXPECT_EQ(SQLite::OK, db.getErrorCode()); diff --git a/tests/VariadicBind_test.cpp b/tests/VariadicBind_test.cpp index 20b0337..4ef02f0 100644 --- a/tests/VariadicBind_test.cpp +++ b/tests/VariadicBind_test.cpp @@ -20,7 +20,8 @@ #include #if (__cplusplus >= 201103L) || ( defined(_MSC_VER) && (_MSC_VER >= 1800) ) // c++11: Visual Studio 2013 -TEST(VariadicBind, invalid) { +TEST(VariadicBind, invalid) +{ // Create a new database SQLite::Database db(":memory:", SQLite::OPEN_READWRITE|SQLite::OPEN_CREATE); @@ -56,7 +57,8 @@ TEST(VariadicBind, invalid) { { SQLite::Statement query(db, std::string{"SELECT id, value FROM test ORDER BY id"}); std::vector > results; - while (query.executeStep()) { + while (query.executeStep()) + { const int id = query.getColumn(0); std::string value = query.getColumn(1); results.emplace_back( id, std::move(value) ); @@ -90,7 +92,8 @@ TEST(VariadicBind, invalid) { { SQLite::Statement query(db, std::string{"SELECT id, value FROM test2 ORDER BY id"}); std::vector > results; - while (query.executeStep()) { + while (query.executeStep()) + { const int id = query.getColumn(0); std::string value = query.getColumn(1); results.emplace_back( id, std::move(value) );