Documentation
¶
Overview ¶
Package statement implements a virtual table that turns any SQL statement into a parametrized view. The statement is supplied as the USING argument; its bound parameters become HIDDEN columns on the vtab, so WHERE-clause equality constraints get pushed back through the prepared statement.
CREATE VIRTUAL TABLE adults USING statement(
'SELECT id, name FROM users WHERE age >= ?');
-- min_age is exposed as a HIDDEN column; constrain it to bind ?1.
SELECT * FROM adults WHERE "?1" = 18;
Named parameters become correspondingly-named HIDDEN columns:
CREATE VIRTUAL TABLE q USING statement(
'SELECT id FROM users WHERE name LIKE :pat');
SELECT * FROM q WHERE pat = 'al%';
Constraints ¶
Only positional `?` and named `:name`/`@name`/`$name` parameters are supported as HIDDEN columns. Output columns inherit their declared types from the underlying SELECT via sqlite3_column_decltype.
Ported from ncruces/ext/statement, the SQLite community's statement-vtab extension.
Index ¶
Constants ¶
const ModuleName = "statement"
ModuleName is the name the vtab registers under: `statement`.
Variables ¶
This section is empty.
Functions ¶
Types ¶
This section is empty.