Skip to main content

Module pragma

Module pragma 

Source
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§

PragmaStatement
One parsed PRAGMA statement. value is None for the read form (PRAGMA name;).

Enums§

PragmaValue
Parsed pragma value.

Functions§

execute_pragma
Dispatch a parsed PRAGMA statement against the database. New pragmas plug in here.
try_parse_pragma
Returns Ok(Some(stmt)) when sql is a PRAGMA statement, Ok(None) otherwise. Errors only when the input is shaped like PRAGMA … but malformed — that path used to surface as a sqlparser ParserError; with this module taking over, the error becomes a typed SQLRiteError::General so SDK consumers see a stable shape.