storage/src/mozStorageSQLFunctions.h

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

mercurial