Repository navigation
Commit 4e9d1df
committed
feat(sqlite): add MariaDB-only functions
Add functions that exist in MariaDB but not in MySQL 8.4, so they are purely
additive with no MySQL-parity concern (#586): JSON_EXISTS, CHR, JSON_COMPACT,
JSON_DETAILED, JSON_NORMALIZE, JSON_OBJECT_FILTER_KEYS and CRC32C. CRC32C is
verified against MariaDB's documented vectors and falls back to a pure-PHP table
when hash('crc32c') is unavailable, which also covers the chained two-argument
form.
JSON_OBJECT_FILTER_KEYS accepts both MariaDB's array-of-keys form and a
variadic key list, and CHR accepts multiple code points as a strict superset of
MariaDB's single-argument signature.
Review follow-ups addressed:
- JSON_PRETTY is no longer registered as an alias of JSON_DETAILED. The name
belongs to MySQL, which lays it out with 2-space indentation, and a separate
change provides that implementation; keeping the alias here would shadow it.
- CHR() encodes code points 128-255 as UTF-8 instead of emitting a single
latin1 byte, so CHR(200) is U+00C8 in two bytes rather than one raw byte.
- CRC32C returns an integer when the checksum fits in signed 32 bits and a
float above that, because the PDO bridge truncates integer returns to 32 bits
while PHP before 8.1 renders integral floats with a trailing ".0".
Deliberately excluded, as recorded in the tracking issue: JSON_LOOSE, whose
status in recent MariaDB versions is uncertain; MEDIAN, which needs cross-row
state that a scalar UDF cannot provide; and the dynamic-column family, vector
functions, Oracle-mode functions and legacy crypt/password functions.
Refs #586, #592.1 parent 70bdaf3 commit 4e9d1df
2 files changed
Lines changed: 1308 additions & 0 deletions
File tree
- packages/mysql-on-sqlite
- src/sqlite
- tests
0 commit comments