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

+5
View File
@@ -83,6 +83,11 @@ namespace jetc {
// otherwise), it was previously miscategorized as void.
"set", "include", "cookie", "header", "read", "write",
"call", "system", "dump",
// <bind> (see __bind.cpp) supplies one <sql> placeholder value
// and never has a closing tag - without this a bare
// <bind value="..."> outside a <sql> span would scan forward
// for a "</bind>" that doesn't exist.
"bind",
// <container> (see parseContainerSlot/Tag::renderContainer) -
// real content always writes it as a bare marker with no
// separate closing tag, even when it carries its own