Bug 1744266 [wpt PR 31876] - WebSockets is its own standard now, a=testonly
[gecko.git] / storage / mozStorageSQLFunctions.h
blob2a3f1f3d7e93e10fb600fb02233ed08b69980f42
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/. */
7 #ifndef mozStorageSQLFunctions_h
8 #define mozStorageSQLFunctions_h
10 #include "sqlite3.h"
11 #include "nscore.h"
13 namespace mozilla {
14 namespace storage {
16 /**
17 * Registers the functions declared here with the specified database.
19 * @param aDB
20 * The database we'll be registering the functions with.
21 * @return the SQLite status code indicating success or failure.
23 int registerFunctions(sqlite3* aDB);
25 ////////////////////////////////////////////////////////////////////////////////
26 //// Predefined Functions
28 /**
29 * Overridden function to perform the SQL functions UPPER and LOWER. These
30 * support unicode, which the default implementations do not do.
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.
39 void caseFunction(sqlite3_context* aCtx, int aArgc, sqlite3_value** aArgv);
41 /**
42 * Overridden function to perform the SQL function LIKE. This supports unicode,
43 * which the default implementation does not do.
45 * @param aCtx
46 * The sqlite_context that this function is being called on.
47 * @param aArgc
48 * The number of arguments the function is being called with.
49 * @param aArgv
50 * An array of the arguments the functions is being called with.
52 void likeFunction(sqlite3_context* aCtx, int aArgc, sqlite3_value** aArgv);
54 /**
55 * An implementation of the Levenshtein Edit Distance algorithm for use in
56 * Sqlite queries.
58 * @param aCtx
59 * The sqlite_context that this function is being called on.
60 * @param aArgc
61 * The number of arguments the function is being called with.
62 * @param aArgv
63 * An array of the arguments the functions is being called with.
65 void levenshteinDistanceFunction(sqlite3_context* aCtx, int aArgc,
66 sqlite3_value** aArgv);
68 /**
69 * An alternative string length function that uses XPCOM string classes for
70 * string length calculation.
72 * @param aCtx
73 * The sqlite_context that this function is being called on.
74 * @param aArgc
75 * The number of arguments the function is being called with.
76 * @param aArgv
77 * An array of the arguments the functions is being called with.
79 void utf16LengthFunction(sqlite3_context* aCtx, int aArgc,
80 sqlite3_value** aArgv);
82 } // namespace storage
83 } // namespace mozilla
85 #endif // mozStorageSQLFunctions_h