Available on crate feature
sqlite
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_
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_
patch - Applies an RFC 7396 MergePatch
patch
to the input JSONtarget
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. Thejson_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 are silently ignored. - 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. Thejson_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 are silently ignored. - 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. Thejson_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 are silently ignored. - 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 returnsfalse
if is not 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_
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_
patch - Applies an RFC 7396 MergePatch
patch
to the input JSONtarget
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. Thejsonb_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 are silently ignored. - 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. Thejsonb_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 are silently ignored. - 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. Thejsonb_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 are silently ignored.
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_
group_ array - The return type of
json_group_array()
- json_
group_ object - The return type of
json_group_object()
- 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_
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()
- 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_
group_ array - The return type of
jsonb_group_array()
- jsonb_
group_ object - The return type of
jsonb_group_object()
- 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()