Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

SQL.InternalSQLiteLibrary.SetUUIDExtensionEnabled

Whether to enable the uuid extensions.

Component Version macOS Windows Linux Server iOS SDK
SQL 15.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "SQL.InternalSQLiteLibrary.SetUUIDExtensionEnabled"; Value )   More

Parameters

Parameter Description Example
Value The new setting.
Pass 1 to enable or 0 to disable.
1

Result

Returns OK or error.

Description

Whether to enable the uuid extensions.
This SQLite extension implements functions that handling RFC-4122 UUIDs

Three SQL functions are implemented:

uuid()generate a version 4 UUID as a string
uuid_str(X)convert a UUID X into a well-formed UUID string
uuid_blob(X)convert a UUID X into a 16-byte blob

The output from uuid() and uuid_str(X) are always well-formed RFC-4122 UUID strings in this format:

xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx

All of the 'x', 'M', and 'N' values are lower-case hexadecimal digits. The M digit indicates the "version". For uuid()-generated UUIDs, the version is always "4" (a random UUID). The upper three bits of N digit are the "variant". This library only supports variant 1 (indicated by values of N between '8' and 'b') as those are overwhelming the most common. Other variants are for legacy compatibility only.

The output of uuid_blob(X) is always a 16-byte blob. The UUID input string is converted in network byte order (big-endian) in accordance with RFC-4122 specifications for variant-1 UUIDs. Note that network byte order is *always* used, even if the input self-identifies as a variant-2 UUID.

The input X to the uuid_str() and uuid_blob() functions can be either a string or a BLOB. If it is a BLOB it must be exactly 16 bytes in length or else a NULL is returned. If the input is a string it must consist of 32 hexadecimal digits, upper or lower case, optionally surrounded by {...} and with optional "-" characters interposed in the middle. The flexibility of input is inspired by the PostgreSQL implementation of UUID functions that accept in all of the following formats:

  • A0EEBC99-9C0B-4EF8-BB6D-6BB9BD380A11
  • {a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11}
  • a0eebc999c0b4ef8bb6d6bb9bd380a11
  • a0ee-bc99-9c0b-4ef8-bb6d-6bb9-bd38-0a11
  • {a0eebc99-9c0b4ef8-bb6d6bb9-bd380a11}

If any of the above inputs are passed into uuid_str(), the output will always be in the canonical RFC-4122 format:

  • a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11

If the X input string has too few or too many digits or contains stray characters other than {, }, or -, then NULL is returned.

See also

Release notes

  • Version 15.3
    • Added SQL.InternalSQLiteLibrary.GetBase64ExtensionEnabled, SQL.InternalSQLiteLibrary.GetUUIDExtensionEnabled, SQL.InternalSQLiteLibrary.SetBase64ExtensionEnabled and SQL.InternalSQLiteLibrary.SetUUIDExtensionEnabled functions.

Blog Entries

Created 2nd June 2025, last changed 8th June 2025


SQL.InternalSQLiteLibrary.SetICUEnabled - SQL.InternalSQLiteLibrary.SourceID