Expand description
SQL-level PRAGMA dispatcher (SQLR-13).
sqlparser-rs already produces a Statement::Pragma AST variant, but
its pragma-value parser is narrow: only numbers, single/double quoted
strings, and ? placeholders are accepted. Bare identifiers like
OFF / NONE (which SQLite has historically accepted in PRAGMA
position) get rejected before the dispatcher ever sees them.
We bypass that constraint by intercepting PRAGMA statements before
Parser::parse_sql runs: peek the first non-whitespace token, and
if it’s the PRAGMA keyword, route through this module’s tokenizer
pass instead. Non-PRAGMA input falls straight through (returns
Ok(None)).
This is the first SQL pragma SQLRite ships. The dispatcher is a
single function with a match on pragma name; switch to a registry
when the second pragma lands.
Structs§
- Pragma
Statement - One parsed
PRAGMAstatement.valueisNonefor the read form (PRAGMA name;).
Enums§
- Pragma
Value - Parsed pragma value.
Functions§
- execute_
pragma - Dispatch a parsed
PRAGMAstatement against the database. New pragmas plug in here. - try_
parse_ pragma - Returns
Ok(Some(stmt))whensqlis aPRAGMAstatement,Ok(None)otherwise. Errors only when the input is shaped likePRAGMA …but malformed — that path used to surface as a sqlparserParserError; with this module taking over, the error becomes a typedSQLRiteError::Generalso SDK consumers see a stable shape.