Skip to main content

Module functions

Module functions 

Source
Available on crate feature __sqlite-shared only.
Expand description

SQLite specific functions

Functions§

json
Verifies that its argument is a valid JSON string or JSONB blob and returns a minified version of that JSON string with all unnecessary whitespace removed.
json_array_0
The json_array() SQL function accepts zero or more arguments and returns a well-formed JSON array that is composed from those arguments. Note that arguments of type BLOB will not be accepted by this function.
json_array_1
The json_array() SQL function accepts zero or more arguments and returns a well-formed JSON array that is composed from those arguments. Note that arguments of type BLOB will not be accepted by this function.
json_array_2
The json_array() SQL function accepts zero or more arguments and returns a well-formed JSON array that is composed from those arguments. Note that arguments of type BLOB will not be accepted by this function.
json_array_length
The json_array_length(X) function returns the number of elements in the JSON array X, or 0 if X is some kind of JSON value other than an array. Errors are thrown if either X is not well-formed JSON or if P is not a well-formed path.
json_array_length_with_path
The json_array_length(X) function returns the number of elements in the JSON array X, or 0 if X is some kind of JSON value other than an array. The json_array_length(X,P) locates the array at path P within X and returns the length of that array, or 0 if path P locates an element in X that is not a JSON array, and NULL if path P does not locate any element of X. Errors are thrown if either X is not well-formed JSON or if P is not a well-formed path.
json_error_position
The json_error_position(X) function returns 0 if the input X is a well-formed JSON or JSON5 string. If the input X contains one or more syntax errors, then this function returns the character position of the first syntax error. The left-most character is position 1.
json_extract_double
Extracts a floating-point value from a well-formed JSON document at the given path.
json_extract_integer
Extracts an integer value from a well-formed JSON document at the given path.
json_extract_json_1
Extracts a JSON object or array from a well-formed JSON document at the given path.
json_extract_json_2
Extracts a JSON object or array from a well-formed JSON document at the given path.
json_extract_string
Extracts a text value from a well-formed JSON document at the given path.
json_group_array
The json_group_array(X) function is an aggregate SQL function that returns a JSON array comprised of all X values in the aggregation.
json_group_object
The json_group_object(NAME,VALUE) function returns a JSON object comprised of all NAME/VALUE pairs in the aggregation.
json_insert_0
The json_insert(X,P,V,...) SQL function takes a single JSON value as its first argument followed by zero or more pairs of path and value arguments. It returns a copy of the X argument with the values V inserted at the paths P, but only where nothing already exists at
json_insert_1
The json_insert(X,P,V,...) SQL function takes a single JSON value as its first argument followed by zero or more pairs of path and value arguments. It returns a copy of the X argument with the values V inserted at the paths P, but only where nothing already exists at
json_insert_2
The json_insert(X,P,V,...) SQL function takes a single JSON value as its first argument followed by zero or more pairs of path and value arguments. It returns a copy of the X argument with the values V inserted at the paths P, but only where nothing already exists at
json_object_0
The json_object() SQL function accepts zero or more pairs of arguments and returns a well-formed JSON object composed from those pairs. The first argument of each pair is the label (key) and the second argument is the value. If any argument to json_object() is a
json_object_1
The json_object() SQL function accepts zero or more pairs of arguments and returns a well-formed JSON object composed from those pairs. The first argument of each pair is the label (key) and the second argument is the value. If any argument to json_object() is a
json_object_2
The json_object() SQL function accepts zero or more pairs of arguments and returns a well-formed JSON object composed from those pairs. The first argument of each pair is the label (key) and the second argument is the value. If any argument to json_object() is a
json_patch
Applies an RFC 7396 MergePatch patch to the input JSON target and returns the patched JSON value.
json_pretty
Converts the given json value to pretty-printed, indented text
json_pretty_with_indentation
Converts the given json value to pretty-printed, indented text
json_quote
The json_quote(X) function converts the SQL value X (a number or a string) into its corresponding JSON representation. If X is a JSON value returned by another JSON function, then this function is a no-op.
json_remove_0
The json_remove(X,P,...) SQL function takes a single JSON value as its first argument followed by zero or more path arguments. The json_remove(X,P,...) function returns a copy of the X parameter with all the elements identified by path arguments removed. Paths that select elements not found in X
json_remove_1
The json_remove(X,P,...) SQL function takes a single JSON value as its first argument followed by zero or more path arguments. The json_remove(X,P,...) function returns a copy of the X parameter with all the elements identified by path arguments removed. Paths that select elements not found in X
json_remove_2
The json_remove(X,P,...) SQL function takes a single JSON value as its first argument followed by zero or more path arguments. The json_remove(X,P,...) function returns a copy of the X parameter with all the elements identified by path arguments removed. Paths that select elements not found in X
json_replace_0
The json_replace(X,P,V,...) SQL function takes a single JSON value as its first argument followed by zero or more pairs of path and value arguments. It returns a copy of the X argument with values V substituted at the paths P, but only where something already exists
json_replace_1
The json_replace(X,P,V,...) SQL function takes a single JSON value as its first argument followed by zero or more pairs of path and value arguments. It returns a copy of the X argument with values V substituted at the paths P, but only where something already exists
json_replace_2
The json_replace(X,P,V,...) SQL function takes a single JSON value as its first argument followed by zero or more pairs of path and value arguments. It returns a copy of the X argument with values V substituted at the paths P, but only where something already exists
json_set_0
The json_set(X,P,V,...) SQL function takes a single JSON value as its first argument followed by zero or more pairs of path and value arguments. It returns a copy of the X argument with values V inserted or replaced at the paths P. Unlike json_replace(),
json_set_1
The json_set(X,P,V,...) SQL function takes a single JSON value as its first argument followed by zero or more pairs of path and value arguments. It returns a copy of the X argument with values V inserted or replaced at the paths P. Unlike json_replace(),
json_set_2
The json_set(X,P,V,...) SQL function takes a single JSON value as its first argument followed by zero or more pairs of path and value arguments. It returns a copy of the X argument with values V inserted or replaced at the paths P. Unlike json_replace(),
json_type
The json_type(X) function returns the “type” of the outermost element of X. The “type” returned by json_type() is one of the following SQL text values: ‘null’, ‘true’, ‘false’, ‘integer’, ‘real’, ‘text’, ‘array’, or ‘object’.
json_type_with_path
The json_type(X,P) function returns the “type” of the element in X that is selected by path P. If the path P in json_type(X,P) selects an element that does not exist in X, then this function returns NULL.
json_valid
Returns true if the argument is well-formed JSON, or returns false if is not well-formed.
json_valid_with_flags
The json_valid(X,Y) function returns 1 if the argument X is well-formed JSON, or returns 0 if X is not well-formed. The Y parameter is an integer bitmask that defines what is meant by “well-formed”.
jsonb
The jsonb(X) function returns the binary JSONB representation of the JSON provided as argument X.
jsonb_array_0
The jsonb_array() SQL function accepts zero or more arguments and returns a well-formed JSON array that is composed from those arguments. Note that arguments of type BLOB will not be accepted by this function.
jsonb_array_1
The jsonb_array() SQL function accepts zero or more arguments and returns a well-formed JSON array that is composed from those arguments. Note that arguments of type BLOB will not be accepted by this function.
jsonb_array_2
The jsonb_array() SQL function accepts zero or more arguments and returns a well-formed JSON array that is composed from those arguments. Note that arguments of type BLOB will not be accepted by this function.
jsonb_extract_double
Extracts a floating-point value from a well-formed JSON or JSONB document at the given path.
jsonb_extract_integer
Extracts an integer value from a well-formed JSON or JSONB document at the given path.
jsonb_extract_jsonb_1
Extracts a JSON object or array from a well-formed JSON or JSONB document at the given path, returning it in JSONB format.
jsonb_extract_jsonb_2
Extracts a JSON object or array from a well-formed JSON or JSONB document at the given path, returning it in JSONB format.
jsonb_extract_string
Extracts a text value from a well-formed JSON or JSONB document at the given path.
jsonb_group_array
The jsonb_group_array(X) function is an aggregate SQL function that returns a JSONB array comprised of all X values in the aggregation.
jsonb_group_object
The jsonb_group_object(NAME,VALUE) function returns a JSONB object comprised of all NAME/VALUE pairs in the aggregation.
jsonb_insert_0
The jsonb_insert(X,P,V,...) SQL function works just like the json_insert() function except that the result is returned in SQLite’s private binary JSONB format rather than in the standard RFC 8259 text format.
jsonb_insert_1
The jsonb_insert(X,P,V,...) SQL function works just like the json_insert() function except that the result is returned in SQLite’s private binary JSONB format rather than in the standard RFC 8259 text format.
jsonb_insert_2
The jsonb_insert(X,P,V,...) SQL function works just like the json_insert() function except that the result is returned in SQLite’s private binary JSONB format rather than in the standard RFC 8259 text format.
jsonb_object_0
The jsonb_object() SQL function works just like the json_object() function except that the generated object is returned in SQLite’s private binary JSONB format rather than in the standard RFC 8259 text format.
jsonb_object_1
The jsonb_object() SQL function works just like the json_object() function except that the generated object is returned in SQLite’s private binary JSONB format rather than in the standard RFC 8259 text format.
jsonb_object_2
The jsonb_object() SQL function works just like the json_object() function except that the generated object is returned in SQLite’s private binary JSONB format rather than in the standard RFC 8259 text format.
jsonb_patch
Applies an RFC 7396 MergePatch patch to the input JSON target and returns the patched JSON value in SQLite’s binary JSONB format.
jsonb_remove_0
The jsonb_remove(X,P,...) SQL function takes a single JSON value as its first argument followed by zero or more path arguments. The jsonb_remove(X,P,...) function returns a copy of the X parameter with all the elements identified by path arguments removed. Paths that select elements not found in X
jsonb_remove_1
The jsonb_remove(X,P,...) SQL function takes a single JSON value as its first argument followed by zero or more path arguments. The jsonb_remove(X,P,...) function returns a copy of the X parameter with all the elements identified by path arguments removed. Paths that select elements not found in X
jsonb_remove_2
The jsonb_remove(X,P,...) SQL function takes a single JSON value as its first argument followed by zero or more path arguments. The jsonb_remove(X,P,...) function returns a copy of the X parameter with all the elements identified by path arguments removed. Paths that select elements not found in X
jsonb_replace_0
The jsonb_replace(X,P,V,...) SQL function works just like the json_replace() function except that the result is returned in SQLite’s private binary JSONB format rather than in the standard RFC 8259 text format.
jsonb_replace_1
The jsonb_replace(X,P,V,...) SQL function works just like the json_replace() function except that the result is returned in SQLite’s private binary JSONB format rather than in the standard RFC 8259 text format.
jsonb_replace_2
The jsonb_replace(X,P,V,...) SQL function works just like the json_replace() function except that the result is returned in SQLite’s private binary JSONB format rather than in the standard RFC 8259 text format.
jsonb_set_0
The jsonb_set(X,P,V,...) SQL function works just like the json_set() function except that the result is returned in SQLite’s private binary JSONB format rather than in the standard RFC 8259 text format.
jsonb_set_1
The jsonb_set(X,P,V,...) SQL function works just like the json_set() function except that the result is returned in SQLite’s private binary JSONB format rather than in the standard RFC 8259 text format.
jsonb_set_2
The jsonb_set(X,P,V,...) SQL function works just like the json_set() function except that the result is returned in SQLite’s private binary JSONB format rather than in the standard RFC 8259 text format.

Type Aliases§

json
The return type of json()
json_array_0
The return type of json_array_0()
json_array_1
The return type of json_array_1()
json_array_2
The return type of json_array_2()
json_array_length
The return type of json_array_length()
json_array_length_with_path
The return type of json_array_length_with_path()
json_error_position
The return type of json_error_position()
json_extract_double
The return type of json_extract_double()
json_extract_integer
The return type of json_extract_integer()
json_extract_json_1
The return type of json_extract_json_1()
json_extract_json_2
The return type of json_extract_json_2()
json_extract_string
The return type of json_extract_string()
json_group_array
The return type of json_group_array()
json_group_object
The return type of json_group_object()
json_insert_0
The return type of json_insert_0()
json_insert_1
The return type of json_insert_1()
json_insert_2
The return type of json_insert_2()
json_object_0
The return type of json_object_0()
json_object_1
The return type of json_object_1()
json_object_2
The return type of json_object_2()
json_patch
The return type of json_patch()
json_pretty
The return type of json_pretty()
json_pretty_with_indentation
The return type of json_pretty_with_indentation()
json_quote
The return type of json_quote()
json_remove_0
The return type of json_remove_0()
json_remove_1
The return type of json_remove_1()
json_remove_2
The return type of json_remove_2()
json_replace_0
The return type of json_replace_0()
json_replace_1
The return type of json_replace_1()
json_replace_2
The return type of json_replace_2()
json_set_0
The return type of json_set_0()
json_set_1
The return type of json_set_1()
json_set_2
The return type of json_set_2()
json_type
The return type of json_type()
json_type_with_path
The return type of json_type_with_path()
json_valid
The return type of json_valid()
json_valid_with_flags
The return type of json_valid_with_flags()
jsonb
The return type of jsonb()
jsonb_array_0
The return type of jsonb_array_0()
jsonb_array_1
The return type of jsonb_array_1()
jsonb_array_2
The return type of jsonb_array_2()
jsonb_extract_double
The return type of jsonb_extract_double()
jsonb_extract_integer
The return type of jsonb_extract_integer()
jsonb_extract_jsonb_1
The return type of jsonb_extract_jsonb_1()
jsonb_extract_jsonb_2
The return type of jsonb_extract_jsonb_2()
jsonb_extract_string
The return type of jsonb_extract_string()
jsonb_group_array
The return type of jsonb_group_array()
jsonb_group_object
The return type of jsonb_group_object()
jsonb_insert_0
The return type of jsonb_insert_0()
jsonb_insert_1
The return type of jsonb_insert_1()
jsonb_insert_2
The return type of jsonb_insert_2()
jsonb_object_0
The return type of jsonb_object_0()
jsonb_object_1
The return type of jsonb_object_1()
jsonb_object_2
The return type of jsonb_object_2()
jsonb_patch
The return type of jsonb_patch()
jsonb_remove_0
The return type of jsonb_remove_0()
jsonb_remove_1
The return type of jsonb_remove_1()
jsonb_remove_2
The return type of jsonb_remove_2()
jsonb_replace_0
The return type of jsonb_replace_0()
jsonb_replace_1
The return type of jsonb_replace_1()
jsonb_replace_2
The return type of jsonb_replace_2()
jsonb_set_0
The return type of jsonb_set_0()
jsonb_set_1
The return type of jsonb_set_1()
jsonb_set_2
The return type of jsonb_set_2()