Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
michael@0 | 2 | * vim: sw=2 ts=2 et lcs=trail\:.,tab\:>~ : |
michael@0 | 3 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | #ifndef mozStorageSQLFunctions_h |
michael@0 | 8 | #define mozStorageSQLFunctions_h |
michael@0 | 9 | |
michael@0 | 10 | #include "sqlite3.h" |
michael@0 | 11 | #include "nscore.h" |
michael@0 | 12 | |
michael@0 | 13 | namespace mozilla { |
michael@0 | 14 | namespace storage { |
michael@0 | 15 | |
michael@0 | 16 | /** |
michael@0 | 17 | * Registers the functions declared here with the specified database. |
michael@0 | 18 | * |
michael@0 | 19 | * @param aDB |
michael@0 | 20 | * The database we'll be registering the functions with. |
michael@0 | 21 | * @return the SQLite status code indicating success or failure. |
michael@0 | 22 | */ |
michael@0 | 23 | NS_HIDDEN_(int) registerFunctions(sqlite3 *aDB); |
michael@0 | 24 | |
michael@0 | 25 | //////////////////////////////////////////////////////////////////////////////// |
michael@0 | 26 | //// Predefined Functions |
michael@0 | 27 | |
michael@0 | 28 | /** |
michael@0 | 29 | * Overridden function to perform the SQL functions UPPER and LOWER. These |
michael@0 | 30 | * support unicode, which the default implementations do not do. |
michael@0 | 31 | * |
michael@0 | 32 | * @param aCtx |
michael@0 | 33 | * The sqlite_context that this function is being called on. |
michael@0 | 34 | * @param aArgc |
michael@0 | 35 | * The number of arguments the function is being called with. |
michael@0 | 36 | * @param aArgv |
michael@0 | 37 | * An array of the arguments the functions is being called with. |
michael@0 | 38 | */ |
michael@0 | 39 | NS_HIDDEN_(void) caseFunction(sqlite3_context *aCtx, |
michael@0 | 40 | int aArgc, |
michael@0 | 41 | sqlite3_value **aArgv); |
michael@0 | 42 | |
michael@0 | 43 | /** |
michael@0 | 44 | * Overridden function to perform the SQL function LIKE. This supports unicode, |
michael@0 | 45 | * which the default implementation does not do. |
michael@0 | 46 | * |
michael@0 | 47 | * @param aCtx |
michael@0 | 48 | * The sqlite_context that this function is being called on. |
michael@0 | 49 | * @param aArgc |
michael@0 | 50 | * The number of arguments the function is being called with. |
michael@0 | 51 | * @param aArgv |
michael@0 | 52 | * An array of the arguments the functions is being called with. |
michael@0 | 53 | */ |
michael@0 | 54 | NS_HIDDEN_(void) likeFunction(sqlite3_context *aCtx, |
michael@0 | 55 | int aArgc, |
michael@0 | 56 | sqlite3_value **aArgv); |
michael@0 | 57 | |
michael@0 | 58 | /** |
michael@0 | 59 | * An implementation of the Levenshtein Edit Distance algorithm for use in |
michael@0 | 60 | * Sqlite queries. |
michael@0 | 61 | * |
michael@0 | 62 | * @param aCtx |
michael@0 | 63 | * The sqlite_context that this function is being called on. |
michael@0 | 64 | * @param aArgc |
michael@0 | 65 | * The number of arguments the function is being called with. |
michael@0 | 66 | * @param aArgv |
michael@0 | 67 | * An array of the arguments the functions is being called with. |
michael@0 | 68 | */ |
michael@0 | 69 | NS_HIDDEN_(void) levenshteinDistanceFunction(sqlite3_context *aCtx, |
michael@0 | 70 | int aArgc, |
michael@0 | 71 | sqlite3_value **aArgv); |
michael@0 | 72 | |
michael@0 | 73 | } // namespace storage |
michael@0 | 74 | } // namespace mozilla |
michael@0 | 75 | |
michael@0 | 76 | #endif // mozStorageSQLFunctions_h |