diff --git a/include/SQLiteCpp/Database.h b/include/SQLiteCpp/Database.h index c849443..decd38c 100644 --- a/include/SQLiteCpp/Database.h +++ b/include/SQLiteCpp/Database.h @@ -368,38 +368,6 @@ public: void (*apFinal)(sqlite3_context *) = nullptr, // NOLINT(readability/casting) void (*apDestroy)(void *) = nullptr); - /** - * @brief Create or redefine a SQL function or aggregate in the sqlite database. - * - * This is the equivalent of the sqlite3_create_function_v2 command. - * @see http://www.sqlite.org/c3ref/create_function.html - * - * @note UTF-8 text encoding assumed. - * - * @param[in] aFuncName Name of the SQL function to be created or redefined - * @param[in] aNbArg Number of arguments in the function - * @param[in] abDeterministic Optimize for deterministic functions (most are). A random number generator is not. - * @param[in] apApp Arbitrary pointer of user data, accessible with sqlite3_user_data(). - * @param[in] apFunc Pointer to a C-function to implement a scalar SQL function (apStep & apFinal nullptr) - * @param[in] apStep Pointer to a C-function to implement an aggregate SQL function (apFunc nullptr) - * @param[in] apFinal Pointer to a C-function to implement an aggregate SQL function (apFunc nullptr) - * @param[in] apDestroy If not nullptr, then it is the destructor for the application data pointer. - * - * @throw SQLite::Exception in case of error - */ - void createFunction(const std::string& aFuncName, - int aNbArg, - bool abDeterministic, - void* apApp, - void (*apFunc)(sqlite3_context *, int, sqlite3_value **), - void (*apStep)(sqlite3_context *, int, sqlite3_value **) = nullptr, - void (*apFinal)(sqlite3_context *) = nullptr, - void (*apDestroy)(void *) = nullptr) - { - createFunction(aFuncName.c_str(), aNbArg, abDeterministic, - apApp, apFunc, apStep, apFinal, apDestroy); - } - /** * @brief Load a module into the current sqlite database instance. * diff --git a/tests/Database_test.cpp b/tests/Database_test.cpp index 93dc205..b9b1827 100644 --- a/tests/Database_test.cpp +++ b/tests/Database_test.cpp @@ -271,7 +271,8 @@ TEST(Database, execAndGet) // Get a single value result with an easy to use shortcut EXPECT_STREQ("second", db.execAndGet("SELECT value FROM test WHERE id=2")); EXPECT_STREQ("third", db.execAndGet("SELECT value FROM test WHERE weight=7")); - EXPECT_EQ(3, db.execAndGet("SELECT weight FROM test WHERE value=\"first\"").getInt()); + const std::string query("SELECT weight FROM test WHERE value=\"first\""); + EXPECT_EQ(3, db.execAndGet(query).getInt()); } TEST(Database, execException) @@ -405,7 +406,7 @@ TEST(Database, getHeaderInfo) db.exec("PRAGMA main.application_id = 2468"); // Parse header fields from test database - SQLite::Header h = SQLite::Database::getHeaderInfo("test.db3"); + const SQLite::Header h = db.getHeaderInfo(); //Test header values explicitly set via PRAGMA statements EXPECT_EQ(h.userVersion, 12345);