Strings: Difference between revisions
(Created page with "= Strings = The '''Strings''' module provides comprehensive string manipulation and processing functions for the SCM programming language. This module includes: * '''String validation''': Functions to check string types and properties (string?, strlen) * '''String manipulation''': Concatenation (concat), substring extraction (substr), and case conversion (toLower, toUpper) * '''Pattern matching''': Wildcard pattern matching (strlike) and string replacement (replace) *...") |
Wikiservice (talk | contribs) (Refresh MemCP documentation: accuracy, operational guidance, performance profile and maintained API reference) |
||
| (One intermediate revision by one other user not shown) | |||
| Line 1: | Line 1: | ||
<!-- Copyright (C) 2026 Carl-Philip Haensch --> | |||
<!-- SPDX-License-Identifier: GPL-3.0-or-later --> | |||
<span id="strings"></span> | |||
= Strings = | = Strings = | ||
<!-- Generated from MemCP c42e19eba on 2026-08-27; do not edit manually. --> | |||
<div class="mw-message-box mw-message-box-notice">Generated from MemCP commit <code>c42e19eba</code> on 27 August 2026. See [[Full SCM API documentation]].</div> | |||
The '''Strings''' module provides text and binary-string processing for Scheme and SQL compatibility. It includes: | |||
* validation, length, concatenation, slicing, padding, trimming, and case conversion; | |||
* splitting, searching, replacement, wildcard/regular-expression matching, and simplification; | |||
* locale-aware collation and natural ordering; | |||
* URL, HTML, Base64, hexadecimal, JSON, BSON, and SQL-string conversion; | |||
* hashes, checksums, random data, and SQL-dialect compatibility functions. | |||
Indexing and length semantics can differ between bytes and Unicode characters; consult each function's parameter description rather than assuming one unit for every operation. | |||
<span id="string"></span> | |||
== string? == | == string? == | ||
| Line 20: | Line 25: | ||
'''Allowed number of parameters:''' 1–1 | '''Allowed number of parameters:''' 1–1 | ||
<span id="parameters"></span> | |||
=== Parameters === | |||
* '''value''' (<code>any</code>): value | * '''value''' (<code>any</code>): value | ||
''' | <span id="returns"></span> | ||
=== Returns === | |||
* '''value''' (<code>bool</code>) | |||
== concat == | == concat == | ||
| Line 29: | Line 39: | ||
concatenates stringable values and returns a string | concatenates stringable values and returns a string | ||
'''Allowed number of parameters:''' | '''Allowed number of parameters:''' 1–10000 | ||
<span id="parameters-1"></span> | |||
=== Parameters === | |||
* '''value''' (<code>any</code>): first value to concat | |||
* '''more...''' (<code>any</code>): additional values to concat ''(variadic)'' | |||
<span id="returns-1"></span> | |||
=== Returns === | |||
* '''value''' (<code>string</code>) | |||
== sql_concat == | |||
SQL CONCAT semantics: returns NULL if any argument is NULL | |||
'''Allowed number of parameters:''' 1–10000 | |||
<span id="parameters-2"></span> | |||
=== Parameters === | |||
* '''value''' (<code>any</code>): first value to concat | |||
* '''more...''' (<code>any</code>): additional values to concat ''(variadic)'' | |||
<span id="returns-2"></span> | |||
=== Returns === | |||
''' | * '''value''' (<code>any</code>) | ||
== substr == | == substr == | ||
returns a substring | returns a substring (0-based index) | ||
'''Allowed number of parameters:''' 2–3 | '''Allowed number of parameters:''' 2–3 | ||
<span id="parameters-3"></span> | |||
=== Parameters === | |||
* '''value''' (<code>string</code>): string to cut | * '''value''' (<code>string</code>): string to cut | ||
* '''start''' (<code>number</code>): first character index | * '''start''' (<code>number</code>): first character index (0-based) | ||
* '''len''' (<code>number</code>): optional length | * '''len''' (<code>number</code>): optional length ''(optional)'' | ||
<span id="returns-3"></span> | |||
=== Returns === | |||
* '''value''' (<code>string</code>) | |||
'''Returns | == sql_substr == | ||
SQL SUBSTR/SUBSTRING with 1-based index and bounds checking | |||
'''Allowed number of parameters:''' 2–3 | |||
<span id="parameters-4"></span> | |||
=== Parameters === | |||
* '''value''' (<code>string</code>): string to cut | |||
* '''start''' (<code>number</code>): first character position (1-based) | |||
* '''len''' (<code>number</code>): optional length ''(optional)'' | |||
<span id="returns-4"></span> | |||
=== Returns === | |||
* '''value''' (<code>string</code>) | |||
== simplify == | == simplify == | ||
Converts numeric text to a number. Text beginning with { or [ becomes a native JSON value when it is valid JSON; other input remains a string. | |||
'''Allowed number of parameters:''' 1–1 | '''Allowed number of parameters:''' 1–1 | ||
<span id="parameters-5"></span> | |||
* '''value''' (<code>any</code>): value to | === Parameters === | ||
* '''value''' (<code>any</code>): value to interpret as a number or JSON value | |||
<span id="returns-5"></span> | |||
=== Returns === | |||
''' | * '''value''' (<code>any</code>) | ||
== strlen == | == strlen == | ||
| Line 66: | Line 127: | ||
'''Allowed number of parameters:''' 1–1 | '''Allowed number of parameters:''' 1–1 | ||
<span id="parameters-6"></span> | |||
=== Parameters === | |||
* '''value''' (<code>string</code>): input string | * '''value''' (<code>string</code>): input string | ||
''' | <span id="returns-6"></span> | ||
=== Returns === | |||
* '''value''' (<code>int</code>) | |||
== strlike == | == strlike == | ||
matches the string against a wildcard pattern | matches the string against a wildcard pattern using SQL NULL semantics | ||
'''Allowed number of parameters:''' 2–3 | '''Allowed number of parameters:''' 2–3 | ||
<span id="parameters-7"></span> | |||
=== Parameters === | |||
* '''value''' (<code>string</code>): input string | * '''value''' (<code>string</code>): input string | ||
* '''pattern''' (<code>string</code>): pattern with % and _ in them | * '''pattern''' (<code>string</code>): pattern with % and _ in them | ||
* '''collation''' (<code>string</code>): collation in which to compare them | * '''collation''' (<code>string</code>): collation in which to compare them ''(optional)'' | ||
<span id="returns-7"></span> | |||
=== Returns === | |||
* '''value''' (<code>bool</code>) | |||
== strlike_cs == | |||
matches the string against a wildcard pattern case-sensitively using SQL NULL semantics | |||
'''Allowed number of parameters:''' 2–3 | |||
<span id="parameters-8"></span> | |||
=== Parameters === | |||
* '''value''' (<code>string</code>): input string | |||
* '''pattern''' (<code>string</code>): pattern with % and _ in them | |||
* '''collation''' (<code>string</code>): ignored (present for parser compatibility) ''(optional)'' | |||
<span id="returns-8"></span> | |||
=== Returns === | |||
* '''value''' (<code>bool</code>) | |||
<span id="tolower"></span> | |||
== toLower == | == toLower == | ||
| Line 90: | Line 180: | ||
'''Allowed number of parameters:''' 1–1 | '''Allowed number of parameters:''' 1–1 | ||
<span id="parameters-9"></span> | |||
=== Parameters === | |||
* '''value''' (<code>string</code>): input string | * '''value''' (<code>string</code>): input string | ||
<span id="returns-9"></span> | |||
=== Returns === | |||
* '''value''' (<code>string</code>) | |||
<span id="toupper"></span> | |||
== toUpper == | == toUpper == | ||
| Line 101: | Line 197: | ||
'''Allowed number of parameters:''' 1–1 | '''Allowed number of parameters:''' 1–1 | ||
<span id="parameters-10"></span> | |||
=== Parameters === | |||
* '''value''' (<code>string</code>): input string | * '''value''' (<code>string</code>): input string | ||
''' | <span id="returns-10"></span> | ||
=== Returns === | |||
* '''value''' (<code>string</code>) | |||
== replace == | == replace == | ||
| Line 112: | Line 213: | ||
'''Allowed number of parameters:''' 3–3 | '''Allowed number of parameters:''' 3–3 | ||
<span id="parameters-11"></span> | |||
=== Parameters === | |||
* '''s''' (<code>string</code>): input string | * '''s''' (<code>string</code>): input string | ||
* '''find''' (<code>string</code>): search string | * '''find''' (<code>string</code>): search string | ||
* '''replace''' (<code>string</code>): replace string | * '''replace''' (<code>string</code>): replace string | ||
'''Returns:''' <code>string</code> | <span id="returns-11"></span> | ||
=== Returns === | |||
* '''value''' (<code>string</code>) | |||
== strtrim == | |||
trims whitespace from both ends of a string | |||
'''Allowed number of parameters:''' 1–1 | |||
<span id="parameters-12"></span> | |||
=== Parameters === | |||
* '''value''' (<code>string</code>): input string | |||
<span id="returns-12"></span> | |||
=== Returns === | |||
* '''value''' (<code>string</code>) | |||
== strltrim == | |||
trims whitespace from the left of a string | |||
'''Allowed number of parameters:''' 1–1 | |||
<span id="parameters-13"></span> | |||
=== Parameters === | |||
* '''value''' (<code>string</code>): input string | |||
<span id="returns-13"></span> | |||
=== Returns === | |||
* '''value''' (<code>string</code>) | |||
== strrtrim == | |||
trims whitespace from the right of a string | |||
'''Allowed number of parameters:''' 1–1 | |||
<span id="parameters-14"></span> | |||
=== Parameters === | |||
* '''value''' (<code>string</code>): input string | |||
<span id="returns-14"></span> | |||
=== Returns === | |||
* '''value''' (<code>string</code>) | |||
== sql_trim == | |||
SQL TRIM(): NULL-safe trim of whitespace from both ends | |||
'''Allowed number of parameters:''' 1–1 | |||
<span id="parameters-15"></span> | |||
=== Parameters === | |||
* '''value''' (<code>string</code>): input string | |||
<span id="returns-15"></span> | |||
=== Returns === | |||
* '''value''' (<code>string</code>) | |||
== sql_ltrim == | |||
SQL LTRIM(): NULL-safe trim of whitespace from left | |||
'''Allowed number of parameters:''' 1–1 | |||
<span id="parameters-16"></span> | |||
=== Parameters === | |||
* '''value''' (<code>string</code>): input string | |||
<span id="returns-16"></span> | |||
=== Returns === | |||
* '''value''' (<code>string</code>) | |||
== sql_rtrim == | |||
SQL RTRIM(): NULL-safe trim of whitespace from right | |||
'''Allowed number of parameters:''' 1–1 | |||
<span id="parameters-17"></span> | |||
=== Parameters === | |||
* '''value''' (<code>string</code>): input string | |||
<span id="returns-17"></span> | |||
=== Returns === | |||
* '''value''' (<code>string</code>) | |||
== split == | == split == | ||
| Line 125: | Line 327: | ||
'''Allowed number of parameters:''' 1–2 | '''Allowed number of parameters:''' 1–2 | ||
<span id="parameters-18"></span> | |||
=== Parameters === | |||
* '''value''' (<code>string</code>): input string | * '''value''' (<code>string</code>): input string | ||
* '''separator''' (<code>string</code>): (optional) parameter, defaults to " " | * '''separator''' (<code>string</code>): (optional) parameter, defaults to " " ''(optional)'' | ||
<span id="returns-18"></span> | |||
=== Returns === | |||
'''Returns | * '''value''' (<code>list</code>) | ||
== string_repeat == | |||
repeats a string n times | |||
'''Allowed number of parameters:''' 2–2 | |||
<span id="parameters-19"></span> | |||
=== Parameters === | |||
* '''value''' (<code>string</code>): string to repeat | |||
* '''count''' (<code>number</code>): number of repetitions | |||
<span id="returns-19"></span> | |||
=== Returns === | |||
* '''value''' (<code>string</code>) | |||
== collate == | == collate == | ||
returns | returns a canonical order relation for a collation and direction. MemCP allows natural sorting of numeric literals. | ||
'''Allowed number of parameters:''' | '''Allowed number of parameters:''' 1–2 | ||
<span id="parameters-20"></span> | |||
=== Parameters === | |||
* '''collation''' (<code>string</code>): collation string of the form LANG or LANG_cs or LANG_ci where LANG is a BCP 47 code, for compatibility to MySQL, a CHARSET_ prefix is allowed and ignored as well as the aliases bin, danish, general, german1, german2, spanish and swedish are allowed for language codes | * '''collation''' (<code>string</code>): collation string of the form LANG or LANG_cs or LANG_ci where LANG is a BCP 47 code, for compatibility to MySQL, a CHARSET_ prefix is allowed and ignored as well as the aliases bin, danish, general, german1, german2, spanish and swedish are allowed for language codes | ||
* '''reverse''' (<code>bool</code>): whether to reverse the order like in ORDER BY DESC | * '''reverse''' (<code>bool</code>): whether to reverse the order like in ORDER BY DESC ''(optional)'' | ||
<span id="returns-20"></span> | |||
=== Returns === | |||
'''Returns | * '''relation''' (<code>func</code>): compares two values using the selected collation and direction | ||
** '''Parameters''' | |||
*** '''a''' (<code>any</code>): left operand | |||
*** '''b''' (<code>any</code>): right operand | |||
** '''Returns''' | |||
*** '''ordered''' (<code>bool</code>): whether a sorts before b | |||
== htmlentities == | == htmlentities == | ||
| Line 149: | Line 383: | ||
'''Allowed number of parameters:''' 1–1 | '''Allowed number of parameters:''' 1–1 | ||
<span id="parameters-21"></span> | |||
=== Parameters === | |||
* '''value''' (<code>string</code>): input string | * '''value''' (<code>string</code>): input string | ||
''' | <span id="returns-21"></span> | ||
=== Returns === | |||
* '''value''' (<code>string</code>) | |||
== urlencode == | == urlencode == | ||
| Line 160: | Line 399: | ||
'''Allowed number of parameters:''' 1–1 | '''Allowed number of parameters:''' 1–1 | ||
<span id="parameters-22"></span> | |||
=== Parameters === | |||
* '''value''' (<code>string</code>): string to encode | * '''value''' (<code>string</code>): string to encode | ||
''' | <span id="returns-22"></span> | ||
=== Returns === | |||
* '''value''' (<code>string</code>) | |||
== urldecode == | == urldecode == | ||
| Line 171: | Line 415: | ||
'''Allowed number of parameters:''' 1–1 | '''Allowed number of parameters:''' 1–1 | ||
<span id="parameters-23"></span> | |||
=== Parameters === | |||
* '''value''' (<code>string</code>): string to decode | * '''value''' (<code>string</code>): string to decode | ||
''' | <span id="returns-23"></span> | ||
=== Returns === | |||
* '''value''' (<code>string</code>) | |||
== json_encode == | == json_encode == | ||
| Line 182: | Line 431: | ||
'''Allowed number of parameters:''' 1–1 | '''Allowed number of parameters:''' 1–1 | ||
<span id="parameters-24"></span> | |||
=== Parameters === | |||
* '''value''' (<code>any</code>): value to encode | * '''value''' (<code>any</code>): value to encode | ||
'''Returns | <span id="returns-24"></span> | ||
=== Returns === | |||
* '''value''' (<code>string</code>) | |||
== json_quote == | |||
quotes a string as JSON | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-25"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-25"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== json_encode_assoc == | == json_encode_assoc == | ||
| Line 193: | Line 463: | ||
'''Allowed number of parameters:''' 1–1 | '''Allowed number of parameters:''' 1–1 | ||
<span id="parameters-26"></span> | |||
=== Parameters === | |||
* '''value''' (<code>any</code>): value to encode | * '''value''' (<code>any</code>): value to encode | ||
''' | <span id="returns-26"></span> | ||
=== Returns === | |||
* '''value''' (<code>string</code>) | |||
== json_decode == | == json_decode == | ||
| Line 204: | Line 479: | ||
'''Allowed number of parameters:''' 1–1 | '''Allowed number of parameters:''' 1–1 | ||
<span id="parameters-27"></span> | |||
=== Parameters === | |||
* '''value''' (<code>string</code>): string to decode | * '''value''' (<code>string</code>): string to decode | ||
'''Returns:''' <code> | <span id="returns-27"></span> | ||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== json_decode_scmer == | |||
parses JSON produced by json_encode and preserves Scheme symbols and lists | |||
'''Allowed number of parameters:''' 1–1 | |||
<span id="parameters-28"></span> | |||
=== Parameters === | |||
* '''value''' (<code>string</code>): Scmer JSON to decode | |||
<span id="returns-28"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== base64_encode == | |||
encodes a string as Base64 (standard encoding) | |||
'''Allowed number of parameters:''' 1–1 | |||
<span id="parameters-29"></span> | |||
=== Parameters === | |||
* '''value''' (<code>string</code>): binary string to encode | |||
<span id="returns-29"></span> | |||
=== Returns === | |||
* '''value''' (<code>string</code>) | |||
== base64_decode == | |||
decodes a Base64 string (standard encoding) | |||
'''Allowed number of parameters:''' 1–1 | |||
<span id="parameters-30"></span> | |||
=== Parameters === | |||
* '''value''' (<code>string</code>): base64-encoded string | |||
<span id="returns-30"></span> | |||
=== Returns === | |||
* '''value''' (<code>string</code>) | |||
== sql_unescape == | == sql_unescape == | ||
| Line 215: | Line 543: | ||
'''Allowed number of parameters:''' 1–1 | '''Allowed number of parameters:''' 1–1 | ||
<span id="parameters-31"></span> | |||
=== Parameters === | |||
* '''value''' (<code>string</code>): string to decode | * '''value''' (<code>string</code>): string to decode | ||
''' | <span id="returns-31"></span> | ||
=== Returns === | |||
* '''value''' (<code>string</code>) | |||
== bin2hex == | == bin2hex == | ||
| Line 226: | Line 559: | ||
'''Allowed number of parameters:''' 1–1 | '''Allowed number of parameters:''' 1–1 | ||
'''Parameters:''' | <span id="parameters-32"></span> | ||
* '''value''' (<code>string</code>): string to | === Parameters === | ||
* '''value''' (<code>string</code>): string to encode | |||
<span id="returns-32"></span> | |||
=== Returns === | |||
* '''value''' (<code>string</code>) | |||
<span id="bin2hex-1"></span> | |||
== bin2hex == | |||
turns binary data into hex with lowercase letters | |||
'''Allowed number of parameters:''' 1–1 | |||
<span id="parameters-33"></span> | |||
=== Parameters === | |||
* '''value''' (<code>string</code>): string to encode | |||
<span id="returns-33"></span> | |||
=== Returns === | |||
* '''value''' (<code>string</code>) | |||
== hex2bin == | |||
decodes a hex string into binary data | |||
'''Allowed number of parameters:''' 1–1 | |||
<span id="parameters-34"></span> | |||
=== Parameters === | |||
* '''value''' (<code>string</code>): hex string (even length) | |||
<span id="returns-34"></span> | |||
=== Returns === | |||
* '''value''' (<code>string</code>) | |||
== uuid == | |||
generates a new random UUID v4 string | |||
'''Allowed number of parameters:''' 0–0 | |||
<span id="parameters-35"></span> | |||
=== Parameters === | |||
''This function has no parameters.'' | |||
<span id="returns-35"></span> | |||
=== Returns === | |||
* '''value''' (<code>string</code>) | |||
<span id="randombytes"></span> | |||
== randomBytes == | |||
returns a string with numBytes cryptographically secure random bytes | |||
'''Allowed number of parameters:''' 1–1 | |||
<span id="parameters-36"></span> | |||
=== Parameters === | |||
* '''numBytes''' (<code>number</code>): number of random bytes | |||
<span id="returns-36"></span> | |||
=== Returns === | |||
* '''value''' (<code>string</code>) | |||
== regexp_replace == | |||
replaces matches of a regex pattern in a string | |||
'''Allowed number of parameters:''' 3–3 | |||
<span id="parameters-37"></span> | |||
=== Parameters === | |||
* '''str''' (<code>string</code>): input string | |||
* '''pattern''' (<code>string</code>): regex pattern | |||
* '''replacement''' (<code>string</code>): replacement string | |||
<span id="returns-37"></span> | |||
=== Returns === | |||
* '''value''' (<code>string</code>) | |||
== fnv_hash == | |||
computes a fast non-cryptographic 64-bit FNV-1a hash of a string, returns a 16-character hex string | |||
'''Allowed number of parameters:''' 1–1 | |||
<span id="parameters-38"></span> | |||
=== Parameters === | |||
* '''str''' (<code>string</code>): input string to hash | |||
<span id="returns-38"></span> | |||
=== Returns === | |||
* '''value''' (<code>string</code>) | |||
== stable_structural_hash == | |||
streams the string or serialized representation of a Scheme value into stable FNV-1a without constructing the complete representation | |||
'''Allowed number of parameters:''' 1–2 | |||
<span id="parameters-39"></span> | |||
=== Parameters === | |||
* '''value''' (<code>any</code>): value to hash | |||
* '''serialize''' (<code>bool</code>): use the Scheme serializer instead of string rendering ''(optional)'' | |||
<span id="returns-39"></span> | |||
=== Returns === | |||
* '''value''' (<code>string</code>) | |||
== sha1 == | |||
computes the SHA-1 digest of a string, returns a 40-character lowercase hex string | |||
'''Allowed number of parameters:''' 1–1 | |||
<span id="parameters-40"></span> | |||
=== Parameters === | |||
* '''str''' (<code>string</code>): input string to hash | |||
<span id="returns-40"></span> | |||
=== Returns === | |||
* '''value''' (<code>string</code>) | |||
== sha256 == | |||
computes the SHA-256 digest of a string, returns a 64-character lowercase hex string | |||
'''Allowed number of parameters:''' 1–1 | |||
<span id="parameters-41"></span> | |||
=== Parameters === | |||
* '''str''' (<code>string</code>): input string to hash | |||
<span id="returns-41"></span> | |||
=== Returns === | |||
* '''value''' (<code>string</code>) | |||
== regexp_test == | |||
tests if a string matches a regex pattern, returns true/false | |||
'''Allowed number of parameters:''' 2–2 | |||
<span id="parameters-42"></span> | |||
=== Parameters === | |||
* '''str''' (<code>string</code>): input string | |||
* '''pattern''' (<code>string</code>): regex pattern | |||
<span id="returns-42"></span> | |||
=== Returns === | |||
* '''value''' (<code>bool</code>) | |||
== json_parse_bson == | |||
validates JSON and returns a BSON-backed value | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-43"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-43"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== json_array == | |||
creates a MySQL-compatible JSON array | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-44"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-44"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== json_object == | |||
creates a MySQL-compatible JSON object | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-45"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-45"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
<span id="json_quote-1"></span> | |||
== json_quote == | |||
quotes a string as JSON | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-46"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-46"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== json_unquote == | |||
unquotes a JSON string | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-47"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-47"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== json_valid == | |||
tests whether a value contains valid JSON | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-48"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-48"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== json_type == | |||
returns the MySQL JSON type name | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-49"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-49"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== json_depth == | |||
returns maximum JSON document depth | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-50"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-50"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== json_length == | |||
returns JSON object or array length | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-51"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-51"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== json_extract == | |||
extracts one or more JSON paths | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-52"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-52"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== json_keys == | |||
returns object member names | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-53"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-53"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== json_contains_path == | |||
tests whether one or all JSON paths exist | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-54"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-54"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== json_contains == | |||
tests JSON containment | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-55"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-55"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== json_overlaps == | |||
tests whether JSON values overlap | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-56"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-56"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== json_member_of == | |||
tests whether a JSON scalar is a member of an array | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-57"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-57"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== json_pretty == | |||
pretty-prints JSON | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-58"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-58"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== json_storage_size == | |||
returns BSON payload size | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-59"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-59"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== json_storage_free == | |||
returns unused BSON storage space | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-60"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-60"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== json_schema_valid == | |||
validates a document against a MySQL Draft 4 JSON schema | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-61"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-61"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== json_schema_validation_report == | |||
reports MySQL Draft 4 JSON schema validation | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-62"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-62"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== json_set == | |||
sets or inserts JSON path values | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-63"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-63"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== json_insert == | |||
inserts missing JSON path values | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-64"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-64"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== json_replace == | |||
replaces existing JSON path values | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-65"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-65"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== json_remove == | |||
removes JSON path values | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-66"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-66"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== json_array_append == | |||
appends values to JSON arrays | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-67"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-67"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== json_array_insert == | |||
inserts values into JSON arrays | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-68"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-68"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== json_merge_patch == | |||
merges documents using RFC 7396 semantics | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-69"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-69"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== json_merge_preserve == | |||
merges documents while preserving values | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-70"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-70"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== json_search == | |||
searches JSON string values | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-71"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-71"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== json_value == | |||
extracts a scalar JSON value | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-72"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-72"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== pg_to_json == | |||
implements PostgreSQL to_json and to_jsonb | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-73"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-73"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== pg_row_to_json == | |||
implements PostgreSQL row_to_json | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-74"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-74"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== pg_json_build_array == | |||
implements PostgreSQL JSON array builders | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-75"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-75"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== pg_json_array_absent == | |||
implements SQL/JSON ARRAY ABSENT ON NULL | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-76"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-76"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== pg_json_build_object == | |||
implements PostgreSQL JSON object builders | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-77"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-77"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== pg_json_object == | |||
implements PostgreSQL json_object and jsonb_object array forms | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-78"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-78"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== pg_json_serialize == | |||
implements PostgreSQL json_serialize | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-79"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-79"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== pg_json_array_length == | |||
implements PostgreSQL json_array_length | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-80"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-80"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== pg_json_extract_path == | |||
implements PostgreSQL json_extract_path | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-81"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-81"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== pg_json_extract_path_text == | |||
implements PostgreSQL json_extract_path_text | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-82"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-82"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== pg_jsonb_set == | |||
implements PostgreSQL jsonb_set | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-83"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-83"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== pg_jsonb_set_lax == | |||
implements PostgreSQL jsonb_set_lax | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-84"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-84"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== pg_jsonb_insert == | |||
implements PostgreSQL jsonb_insert | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-85"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-85"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== pg_json_strip_nulls == | |||
implements PostgreSQL json_strip_nulls | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-86"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-86"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== pg_json_typeof == | |||
implements PostgreSQL json_typeof | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-87"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-87"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== pg_jsonb_populate_record_valid == | |||
validates PostgreSQL jsonb_populate_record input shape | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-88"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-88"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== pg_jsonb_concat == | |||
implements PostgreSQL jsonb concatenation | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-89"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-89"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== pg_jsonb_delete == | |||
implements PostgreSQL jsonb deletion | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-90"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-90"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== pg_jsonb_delete_path == | |||
implements PostgreSQL jsonb path deletion | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-91"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-91"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== pg_subtract == | |||
dispatches PostgreSQL numeric and jsonb subtraction | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-92"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-92"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== pg_jsonb_exists == | |||
implements PostgreSQL jsonb top-level existence | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-93"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-93"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== pg_jsonb_path_exists == | |||
implements PostgreSQL jsonb_path_exists | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-94"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-94"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== pg_jsonb_path_match == | |||
implements PostgreSQL jsonb_path_match | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-95"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-95"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== pg_jsonb_path_query_array == | |||
implements PostgreSQL jsonb_path_query_array | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-96"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-96"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== pg_jsonb_path_query_first == | |||
implements PostgreSQL jsonb_path_query_first | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-97"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-97"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== pg_json_value == | |||
implements PostgreSQL SQL/JSON JSON_VALUE | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-98"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-98"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== json_get == | |||
implements PostgreSQL JSON object and array extraction | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-99"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-99"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== json_arrayagg_entry == | |||
wraps one JSON_ARRAYAGG input value | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-100"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-100"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== json_arrayagg_reduce == | |||
JSON_ARRAYAGG reducer | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-101"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-101"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== json_arrayagg_finalize == | |||
builds one BSON array from a collected JSON_ARRAYAGG value list | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-102"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-102"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== json_objectagg_entry == | |||
constructs a JSON_OBJECTAGG key/value entry | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-103"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-103"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== json_objectagg_reduce == | |||
JSON_OBJECTAGG reducer | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-104"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-104"></span> | |||
=== Returns === | |||
* '''value''' (<code>any</code>) | |||
== pg_json_table_rows == | |||
materializes a PostgreSQL JSON table function as rows | |||
'''Allowed number of parameters:''' 0–10000 | |||
<span id="parameters-105"></span> | |||
=== Parameters === | |||
* '''arguments''' (<code>any</code>) ''(variadic)'' | |||
<span id="returns-105"></span> | |||
=== Returns === | |||
''' | * '''value''' (<code>any</code>) | ||
Latest revision as of 11:59, 28 August 2026
Strings
The Strings module provides text and binary-string processing for Scheme and SQL compatibility. It includes:
- validation, length, concatenation, slicing, padding, trimming, and case conversion;
- splitting, searching, replacement, wildcard/regular-expression matching, and simplification;
- locale-aware collation and natural ordering;
- URL, HTML, Base64, hexadecimal, JSON, BSON, and SQL-string conversion;
- hashes, checksums, random data, and SQL-dialect compatibility functions.
Indexing and length semantics can differ between bytes and Unicode characters; consult each function's parameter description rather than assuming one unit for every operation.
string?
tells if the value is a string
Allowed number of parameters: 1–1
Parameters
- value (
any): value
Returns
- value (
bool)
concat
concatenates stringable values and returns a string
Allowed number of parameters: 1–10000
Parameters
- value (
any): first value to concat - more... (
any): additional values to concat (variadic)
Returns
- value (
string)
sql_concat
SQL CONCAT semantics: returns NULL if any argument is NULL
Allowed number of parameters: 1–10000
Parameters
- value (
any): first value to concat - more... (
any): additional values to concat (variadic)
Returns
- value (
any)
substr
returns a substring (0-based index)
Allowed number of parameters: 2–3
Parameters
- value (
string): string to cut - start (
number): first character index (0-based) - len (
number): optional length (optional)
Returns
- value (
string)
sql_substr
SQL SUBSTR/SUBSTRING with 1-based index and bounds checking
Allowed number of parameters: 2–3
Parameters
- value (
string): string to cut - start (
number): first character position (1-based) - len (
number): optional length (optional)
Returns
- value (
string)
simplify
Converts numeric text to a number. Text beginning with { or [ becomes a native JSON value when it is valid JSON; other input remains a string.
Allowed number of parameters: 1–1
Parameters
- value (
any): value to interpret as a number or JSON value
Returns
- value (
any)
strlen
returns the length of a string
Allowed number of parameters: 1–1
Parameters
- value (
string): input string
Returns
- value (
int)
strlike
matches the string against a wildcard pattern using SQL NULL semantics
Allowed number of parameters: 2–3
Parameters
- value (
string): input string - pattern (
string): pattern with % and _ in them - collation (
string): collation in which to compare them (optional)
Returns
- value (
bool)
strlike_cs
matches the string against a wildcard pattern case-sensitively using SQL NULL semantics
Allowed number of parameters: 2–3
Parameters
- value (
string): input string - pattern (
string): pattern with % and _ in them - collation (
string): ignored (present for parser compatibility) (optional)
Returns
- value (
bool)
toLower
turns a string into lower case
Allowed number of parameters: 1–1
Parameters
- value (
string): input string
Returns
- value (
string)
toUpper
turns a string into upper case
Allowed number of parameters: 1–1
Parameters
- value (
string): input string
Returns
- value (
string)
replace
replaces all occurances in a string with another string
Allowed number of parameters: 3–3
Parameters
- s (
string): input string - find (
string): search string - replace (
string): replace string
Returns
- value (
string)
strtrim
trims whitespace from both ends of a string
Allowed number of parameters: 1–1
Parameters
- value (
string): input string
Returns
- value (
string)
strltrim
trims whitespace from the left of a string
Allowed number of parameters: 1–1
Parameters
- value (
string): input string
Returns
- value (
string)
strrtrim
trims whitespace from the right of a string
Allowed number of parameters: 1–1
Parameters
- value (
string): input string
Returns
- value (
string)
sql_trim
SQL TRIM(): NULL-safe trim of whitespace from both ends
Allowed number of parameters: 1–1
Parameters
- value (
string): input string
Returns
- value (
string)
sql_ltrim
SQL LTRIM(): NULL-safe trim of whitespace from left
Allowed number of parameters: 1–1
Parameters
- value (
string): input string
Returns
- value (
string)
sql_rtrim
SQL RTRIM(): NULL-safe trim of whitespace from right
Allowed number of parameters: 1–1
Parameters
- value (
string): input string
Returns
- value (
string)
split
splits a string using a separator or space
Allowed number of parameters: 1–2
Parameters
- value (
string): input string - separator (
string): (optional) parameter, defaults to " " (optional)
Returns
- value (
list)
string_repeat
repeats a string n times
Allowed number of parameters: 2–2
Parameters
- value (
string): string to repeat - count (
number): number of repetitions
Returns
- value (
string)
collate
returns a canonical order relation for a collation and direction. MemCP allows natural sorting of numeric literals.
Allowed number of parameters: 1–2
Parameters
- collation (
string): collation string of the form LANG or LANG_cs or LANG_ci where LANG is a BCP 47 code, for compatibility to MySQL, a CHARSET_ prefix is allowed and ignored as well as the aliases bin, danish, general, german1, german2, spanish and swedish are allowed for language codes - reverse (
bool): whether to reverse the order like in ORDER BY DESC (optional)
Returns
- relation (
func): compares two values using the selected collation and direction- Parameters
- a (
any): left operand - b (
any): right operand
- a (
- Returns
- ordered (
bool): whether a sorts before b
- ordered (
- Parameters
htmlentities
escapes the string for use in HTML
Allowed number of parameters: 1–1
Parameters
- value (
string): input string
Returns
- value (
string)
urlencode
encodes a string according to URI coding schema
Allowed number of parameters: 1–1
Parameters
- value (
string): string to encode
Returns
- value (
string)
urldecode
decodes a string according to URI coding schema
Allowed number of parameters: 1–1
Parameters
- value (
string): string to decode
Returns
- value (
string)
json_encode
encodes a value in JSON, treats lists as lists
Allowed number of parameters: 1–1
Parameters
- value (
any): value to encode
Returns
- value (
string)
json_quote
quotes a string as JSON
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
json_encode_assoc
encodes a value in JSON, treats lists as associative arrays
Allowed number of parameters: 1–1
Parameters
- value (
any): value to encode
Returns
- value (
string)
json_decode
parses JSON into a map
Allowed number of parameters: 1–1
Parameters
- value (
string): string to decode
Returns
- value (
any)
json_decode_scmer
parses JSON produced by json_encode and preserves Scheme symbols and lists
Allowed number of parameters: 1–1
Parameters
- value (
string): Scmer JSON to decode
Returns
- value (
any)
base64_encode
encodes a string as Base64 (standard encoding)
Allowed number of parameters: 1–1
Parameters
- value (
string): binary string to encode
Returns
- value (
string)
base64_decode
decodes a Base64 string (standard encoding)
Allowed number of parameters: 1–1
Parameters
- value (
string): base64-encoded string
Returns
- value (
string)
sql_unescape
unescapes the inner part of a sql string
Allowed number of parameters: 1–1
Parameters
- value (
string): string to decode
Returns
- value (
string)
bin2hex
turns binary data into hex with lowercase letters
Allowed number of parameters: 1–1
Parameters
- value (
string): string to encode
Returns
- value (
string)
bin2hex
turns binary data into hex with lowercase letters
Allowed number of parameters: 1–1
Parameters
- value (
string): string to encode
Returns
- value (
string)
hex2bin
decodes a hex string into binary data
Allowed number of parameters: 1–1
Parameters
- value (
string): hex string (even length)
Returns
- value (
string)
uuid
generates a new random UUID v4 string
Allowed number of parameters: 0–0
Parameters
This function has no parameters.
Returns
- value (
string)
randomBytes
returns a string with numBytes cryptographically secure random bytes
Allowed number of parameters: 1–1
Parameters
- numBytes (
number): number of random bytes
Returns
- value (
string)
regexp_replace
replaces matches of a regex pattern in a string
Allowed number of parameters: 3–3
Parameters
- str (
string): input string - pattern (
string): regex pattern - replacement (
string): replacement string
Returns
- value (
string)
fnv_hash
computes a fast non-cryptographic 64-bit FNV-1a hash of a string, returns a 16-character hex string
Allowed number of parameters: 1–1
Parameters
- str (
string): input string to hash
Returns
- value (
string)
stable_structural_hash
streams the string or serialized representation of a Scheme value into stable FNV-1a without constructing the complete representation
Allowed number of parameters: 1–2
Parameters
- value (
any): value to hash - serialize (
bool): use the Scheme serializer instead of string rendering (optional)
Returns
- value (
string)
sha1
computes the SHA-1 digest of a string, returns a 40-character lowercase hex string
Allowed number of parameters: 1–1
Parameters
- str (
string): input string to hash
Returns
- value (
string)
sha256
computes the SHA-256 digest of a string, returns a 64-character lowercase hex string
Allowed number of parameters: 1–1
Parameters
- str (
string): input string to hash
Returns
- value (
string)
regexp_test
tests if a string matches a regex pattern, returns true/false
Allowed number of parameters: 2–2
Parameters
- str (
string): input string - pattern (
string): regex pattern
Returns
- value (
bool)
json_parse_bson
validates JSON and returns a BSON-backed value
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
json_array
creates a MySQL-compatible JSON array
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
json_object
creates a MySQL-compatible JSON object
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
json_quote
quotes a string as JSON
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
json_unquote
unquotes a JSON string
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
json_valid
tests whether a value contains valid JSON
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
json_type
returns the MySQL JSON type name
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
json_depth
returns maximum JSON document depth
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
json_length
returns JSON object or array length
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
json_extract
extracts one or more JSON paths
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
json_keys
returns object member names
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
json_contains_path
tests whether one or all JSON paths exist
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
json_contains
tests JSON containment
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
json_overlaps
tests whether JSON values overlap
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
json_member_of
tests whether a JSON scalar is a member of an array
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
json_pretty
pretty-prints JSON
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
json_storage_size
returns BSON payload size
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
json_storage_free
returns unused BSON storage space
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
json_schema_valid
validates a document against a MySQL Draft 4 JSON schema
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
json_schema_validation_report
reports MySQL Draft 4 JSON schema validation
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
json_set
sets or inserts JSON path values
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
json_insert
inserts missing JSON path values
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
json_replace
replaces existing JSON path values
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
json_remove
removes JSON path values
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
json_array_append
appends values to JSON arrays
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
json_array_insert
inserts values into JSON arrays
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
json_merge_patch
merges documents using RFC 7396 semantics
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
json_merge_preserve
merges documents while preserving values
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
json_search
searches JSON string values
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
json_value
extracts a scalar JSON value
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
pg_to_json
implements PostgreSQL to_json and to_jsonb
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
pg_row_to_json
implements PostgreSQL row_to_json
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
pg_json_build_array
implements PostgreSQL JSON array builders
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
pg_json_array_absent
implements SQL/JSON ARRAY ABSENT ON NULL
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
pg_json_build_object
implements PostgreSQL JSON object builders
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
pg_json_object
implements PostgreSQL json_object and jsonb_object array forms
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
pg_json_serialize
implements PostgreSQL json_serialize
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
pg_json_array_length
implements PostgreSQL json_array_length
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
pg_json_extract_path
implements PostgreSQL json_extract_path
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
pg_json_extract_path_text
implements PostgreSQL json_extract_path_text
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
pg_jsonb_set
implements PostgreSQL jsonb_set
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
pg_jsonb_set_lax
implements PostgreSQL jsonb_set_lax
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
pg_jsonb_insert
implements PostgreSQL jsonb_insert
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
pg_json_strip_nulls
implements PostgreSQL json_strip_nulls
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
pg_json_typeof
implements PostgreSQL json_typeof
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
pg_jsonb_populate_record_valid
validates PostgreSQL jsonb_populate_record input shape
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
pg_jsonb_concat
implements PostgreSQL jsonb concatenation
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
pg_jsonb_delete
implements PostgreSQL jsonb deletion
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
pg_jsonb_delete_path
implements PostgreSQL jsonb path deletion
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
pg_subtract
dispatches PostgreSQL numeric and jsonb subtraction
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
pg_jsonb_exists
implements PostgreSQL jsonb top-level existence
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
pg_jsonb_path_exists
implements PostgreSQL jsonb_path_exists
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
pg_jsonb_path_match
implements PostgreSQL jsonb_path_match
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
pg_jsonb_path_query_array
implements PostgreSQL jsonb_path_query_array
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
pg_jsonb_path_query_first
implements PostgreSQL jsonb_path_query_first
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
pg_json_value
implements PostgreSQL SQL/JSON JSON_VALUE
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
json_get
implements PostgreSQL JSON object and array extraction
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
json_arrayagg_entry
wraps one JSON_ARRAYAGG input value
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
json_arrayagg_reduce
JSON_ARRAYAGG reducer
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
json_arrayagg_finalize
builds one BSON array from a collected JSON_ARRAYAGG value list
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
json_objectagg_entry
constructs a JSON_OBJECTAGG key/value entry
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
json_objectagg_reduce
JSON_OBJECTAGG reducer
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)
pg_json_table_rows
materializes a PostgreSQL JSON table function as rows
Allowed number of parameters: 0–10000
Parameters
- arguments (
any) (variadic)
Returns
- value (
any)