diff --git a/SQLiteCpp.Doxyfile b/Doxyfile similarity index 99% rename from SQLiteCpp.Doxyfile rename to Doxyfile index c1fd44a..801804d 100644 --- a/SQLiteCpp.Doxyfile +++ b/Doxyfile @@ -32,7 +32,7 @@ PROJECT_NAME = SQLiteC++ # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 0.5.0 +PROJECT_NUMBER = 0.7.0 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer diff --git a/src/Database.cpp b/src/Database.cpp index 9d1e6df..9a7a294 100644 --- a/src/Database.cpp +++ b/src/Database.cpp @@ -100,17 +100,24 @@ void Database::check(const int aRet) const // throw(SQLite::Exception) } } -// Attach a custom function to your sqlite database. -// assumes UTF8 text representation. +// Attach a custom function to your sqlite database. Assumes UTF8 text representation. // Parameter details can be found here: http://www.sqlite.org/c3ref/create_function.html -void Database::createFunction(const char *funcName, int nArg, bool deterministic, void *pApp, void (*xFunc)(sqlite3_context *, int, sqlite3_value **), void (*xStep)(sqlite3_context *, int, sqlite3_value **), void (*xFinal)(sqlite3_context *), void (*xDestroy)(void *)) +void Database::createFunction(const char* apFuncName, + int aNbArg, + bool abDeterministic, + void* apApp, + void (*apFunc)(sqlite3_context *, int, sqlite3_value **), + void (*apStep)(sqlite3_context *, int, sqlite3_value **), + void (*apFinal)(sqlite3_context *), + void (*apDestroy)(void *)) { - int eTextRep = SQLITE_UTF8; - // optimization if deterministic function... e.g. of non deterministic function (random()) - if (deterministic) { - eTextRep = eTextRep|SQLITE_DETERMINISTIC; + int TextRep = SQLITE_UTF8; + // optimization if deterministic function (e.g. of nondeterministic function random()) + if (abDeterministic) { + TextRep = TextRep|SQLITE_DETERMINISTIC; } - int ret = sqlite3_create_function_v2(mpSQLite, funcName, nArg, eTextRep, pApp, xFunc, xStep, xFinal, xDestroy); + int ret = sqlite3_create_function_v2(mpSQLite, apFuncName, aNbArg, TextRep, + apApp, apFunc, apStep, apFinal, apDestroy); check(ret); } diff --git a/src/Database.h b/src/Database.h index 22aed69..22ae7e2 100644 --- a/src/Database.h +++ b/src/Database.h @@ -231,47 +231,63 @@ public: } /** - * @brief Create a function in the sqlite database. + * @brief Create or redefine a SQL function or aggregate in the sqlite database. * - * This is the equivalent of the sqlite3_create_function_v2 command. - * NOTE: UTF-8 text encoding assumed. + * 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] funcName Name of the SQL function to be created or redefined - * @param[in] nArg Number of arguments in the function - * @param[in] determininistic optimize for deterministic functions. Most sqlite functions are deterministic. - * a random number generator is an example of an indeterministic function. - * @param[in] pApp See: http://www.sqlite.org/c3ref/create_function.html - * @param[in] xFunc See: http://www.sqlite.org/c3ref/create_function.html - * @param[in] xStep See: http://www.sqlite.org/c3ref/create_function.html - * @param[in] xFinal See: http://www.sqlite.org/c3ref/create_function.html - * @param[in] xDestroy See: http://www.sqlite.org/c3ref/create_function.html + * @param[in] apFuncName 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 ot user data, accessible with sqlite3_user_data(). + * @param[in] apFunc Pointer to a C-function to implement a scalar SQL function (apStep & apFinal NULL) + * @param[in] apStep Pointer to a C-function to implement an aggregate SQL function (apFunc NULL) + * @param[in] apFinal Pointer to a C-function to implement an aggregate SQL function (apFunc NULL) + * @param[in] apDestroy If not NULL, then it is the destructor for the application data pointer. * * @throw SQLite::Exception in case of error */ - void createFunction(const char *funcName, int nArg, bool deterministic, void *pApp, void (*xFunc)(sqlite3_context *, int, sqlite3_value **), void (*xStep)(sqlite3_context *, int, sqlite3_value **), void (*xFinal)(sqlite3_context *), void (*xDestroy)(void *)); + void createFunction(const char* apFuncName, + int aNbArg, + bool abDeterministic, + void* apApp, + void (*apFunc)(sqlite3_context *, int, sqlite3_value **), + void (*apStep)(sqlite3_context *, int, sqlite3_value **), + void (*apFinal)(sqlite3_context *), + void (*axDestroy)(void *)); + /** - * @brief Create a function in the sqlite database. + * @brief Create or redefine a SQL function or aggregate in the sqlite database. * - * This is the equivalent of the sqlite3_create_function_v2 command. - * NOTE: UTF-8 text encoding assumed. + * 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] funcName Name of the SQL function to be created or redefined - * @param[in] nArg Number of arguments in the function - * @param[in] determininistic optimize for deterministic functions. Most sqlite functions are deterministic. - * a random number generator is an example of an indeterministic function. - * @param[in] pApp See: http://www.sqlite.org/c3ref/create_function.html - * @param[in] xFunc See: http://www.sqlite.org/c3ref/create_function.html - * @param[in] xStep See: http://www.sqlite.org/c3ref/create_function.html - * @param[in] xFinal See: http://www.sqlite.org/c3ref/create_function.html - * @param[in] xDestroy See: http://www.sqlite.org/c3ref/create_function.html + * @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 ot user data, accessible with sqlite3_user_data(). + * @param[in] apFunc Pointer to a C-function to implement a scalar SQL function (apStep & apFinal NULL) + * @param[in] apStep Pointer to a C-function to implement an aggregate SQL function (apFunc NULL) + * @param[in] apFinal Pointer to a C-function to implement an aggregate SQL function (apFunc NULL) + * @param[in] apDestroy If not NULL, then it is the destructor for the application data pointer. * * @throw SQLite::Exception in case of error */ - inline void createFunction(const std::string &funcName, int nArg, bool deterministic, void *pApp, void (*xFunc)(sqlite3_context *, int, sqlite3_value **), void (*xStep)(sqlite3_context *, int, sqlite3_value **), void (*xFinal)(sqlite3_context *), void (*xDestroy)(void *)) + inline 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 **), + void (*apFinal)(sqlite3_context *), + void (*apDestroy)(void *)) { - return createFunction(funcName.c_str(), nArg, deterministic, pApp, xFunc, xStep, xFinal, xDestroy); + return createFunction(aFuncName.c_str(), aNbArg, abDeterministic, + apApp, apFunc, apStep, apFinal, apDestroy); } private: diff --git a/src/SQLiteC++.h b/src/SQLiteC++.h index df2d8c0..4a10d7f 100644 --- a/src/SQLiteC++.h +++ b/src/SQLiteC++.h @@ -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.6.0" +#define SQLITECPP_VERSION "0.7.0" #define SQLITECPP_VERSION_NUMBER 0006000