michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: * vim: sw=2 ts=2 et lcs=trail\:.,tab\:>~ : michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef mozStorageSQLFunctions_h michael@0: #define mozStorageSQLFunctions_h michael@0: michael@0: #include "sqlite3.h" michael@0: #include "nscore.h" michael@0: michael@0: namespace mozilla { michael@0: namespace storage { michael@0: michael@0: /** michael@0: * Registers the functions declared here with the specified database. michael@0: * michael@0: * @param aDB michael@0: * The database we'll be registering the functions with. michael@0: * @return the SQLite status code indicating success or failure. michael@0: */ michael@0: NS_HIDDEN_(int) registerFunctions(sqlite3 *aDB); michael@0: michael@0: //////////////////////////////////////////////////////////////////////////////// michael@0: //// Predefined Functions michael@0: michael@0: /** michael@0: * Overridden function to perform the SQL functions UPPER and LOWER. These michael@0: * support unicode, which the default implementations do not do. michael@0: * michael@0: * @param aCtx michael@0: * The sqlite_context that this function is being called on. michael@0: * @param aArgc michael@0: * The number of arguments the function is being called with. michael@0: * @param aArgv michael@0: * An array of the arguments the functions is being called with. michael@0: */ michael@0: NS_HIDDEN_(void) caseFunction(sqlite3_context *aCtx, michael@0: int aArgc, michael@0: sqlite3_value **aArgv); michael@0: michael@0: /** michael@0: * Overridden function to perform the SQL function LIKE. This supports unicode, michael@0: * which the default implementation does not do. michael@0: * michael@0: * @param aCtx michael@0: * The sqlite_context that this function is being called on. michael@0: * @param aArgc michael@0: * The number of arguments the function is being called with. michael@0: * @param aArgv michael@0: * An array of the arguments the functions is being called with. michael@0: */ michael@0: NS_HIDDEN_(void) likeFunction(sqlite3_context *aCtx, michael@0: int aArgc, michael@0: sqlite3_value **aArgv); michael@0: michael@0: /** michael@0: * An implementation of the Levenshtein Edit Distance algorithm for use in michael@0: * Sqlite queries. michael@0: * michael@0: * @param aCtx michael@0: * The sqlite_context that this function is being called on. michael@0: * @param aArgc michael@0: * The number of arguments the function is being called with. michael@0: * @param aArgv michael@0: * An array of the arguments the functions is being called with. michael@0: */ michael@0: NS_HIDDEN_(void) levenshteinDistanceFunction(sqlite3_context *aCtx, michael@0: int aArgc, michael@0: sqlite3_value **aArgv); michael@0: michael@0: } // namespace storage michael@0: } // namespace mozilla michael@0: michael@0: #endif // mozStorageSQLFunctions_h