Add <bind> bound parameters for <sql> (phase 1)

Implements phase 1 of docs/design-sql-bound-parameters.md: <bind> supplies
the value for the next ? placeholder of the enclosing <sql>, with typed
validation (int, decimal, date, datetime, bool, ident with allow list),
null="empty", and refusal to change the connection character set.

- SqlBind.*: MySQL-free placeholder scanning and binding logic
- __bind.*, __sql, __mysql: runtime wiring
- Tag.cpp, jetc/JetParser.cpp: bind is a void tag in both
- jetc/JetCodegen: emit sized ZString literals for text holding a NUL,
  which previously truncated the compiled page
- tests: unit tests, end-to-end test against MySQL (interpreted and
  jetc-compiled), and the generator for the binary test page

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
brad ArantandClaude Opus 5.5 committed 2026-11-20 19:55:23 -08:00
1 parent 9fae14eb96
commit a18d1358b0
18 files changed
+1103 -9

No files matched your search

+38
View File
@@ -0,0 +1,38 @@
default plain: 68656C6C6F
default or-injection: 7827206F72202731273D2731
default backslash-quote: 5C27
default trailing-backslash: 615C
default dashdash: 2D2D20
default semicolon: 3B2064726F70207461626C6520743B202D2D
default gbk-bf27: BF27206F7220313D31202D2D20
default double-quote: 7361792022686922
default question: 776861743F
default nul: 610062
default utf8: 68C3A96C6C6F20E2809320E29C9320F09F8EB9
nbe plain: 68656C6C6F
nbe or-injection: 7827206F72202731273D2731
nbe backslash-quote: 5C27
nbe trailing-backslash: 615C
nbe dashdash: 2D2D20
nbe semicolon: 3B2064726F70207461626C6520743B202D2D
nbe gbk-bf27: BF27206F7220313D31202D2D20
nbe double-quote: 7361792022686922
nbe question: 776861743F
nbe nul: 610062
nbe utf8: 68C3A96C6C6F20E2809320E29C9320F09F8EB9
types: 42 -12.50 2026-10-23 2026-10-23 14:05:00 1 1
literals: ? ? bound
nobind: what?
nested: from-if
ident: 9 5 3
rows: 3 columns: 2 first column: n second column: s
mismatch: sql: 3 placeholders but 2 bind values
badint: bind 1: value is not a valid int.
baddate: bind 1: value is not a valid date (YYYY-MM-DD).
badident: bind 1: value is not in the allow list.
outside: bind must be inside sql.
novalue: bind must have a value.
badtype: bind 1: unknown type "blob".
setnames: sql: changing the connection character set is not allowed.
setcharset: sql: changing the connection character set is not allowed.
charset: utf8mb4