Expand description
What kind of answer an SQL statement expects, from its leading keyword.
The SQL servers (postgresql, mysql) hand the model the statement text and three ways to
answer it: a result set, a command tag / OK packet, or an error. The real-model eval showed
a small model answering SELECT current_user with the command tag INSERT 0 1 — copied from
the ok action’s example — so the client got “INSERT 0 1” for a query that asked for a value.
Both servers know the statement exactly, so each tells the model which shape answers it
(answer_with in the event) instead of leaving it to map SQL to the wire in its head.
This is a classifier over the first keyword, not a parser: it reads past leading whitespace,
-- and /* */ comments and opening parentheses, and nothing else. A statement it cannot
place is StatementShape::Unknown, and the caller says nothing rather than guess.
Enums§
- Statement
Shape - The answer a statement’s leading keyword calls for.
Functions§
- statement_
shape - Classify
sqlby its first keyword. See the module docs for what “first” means.