{"repo":"0x09/sqlite-statement-vtab","free":true,"listed":false,"github":"https://github.com/0x09/sqlite-statement-vtab","clone":"git clone https://github.com/0x09/sqlite-statement-vtab.git","description":"SQLite module to define virtual tables and table-valued functions natively using SQL.","language":"C","stars":33,"topics":["sqlite","virtual-tables"],"license":null,"category":"databases-storage","readme_excerpt":"SQLite module to define virtual tables and table-valued functions natively using SQL. statement vtab is particularly handy as an interface for deriving multiple outputs from built-in or user-defined functions without the need to create a specialized module. Example Example which dynamically creates a virtual table split date that uses the built-in strftime function to extract year, month, and day from a date input into columns: Syntax CREATE VIRTUAL TABLE tablename USING statement((stmt)) Where stmt may be any select statement supported by SQLite: https://www.sqlite.org/lang select.html Column definitions Columns defined by the provided statement become columns in the resulting virtual table: This extends to other (virtual) tables as well. Using the built in dbstat virtual table as an example, we can reproduce its columns with: And in this case the declared type affinity of the columns is preserved as well. Parameter binding For substituting values into the statement, statement vtab relies on SQLite's parameter binding syntax. Any bound parameter names become hidden columns in the virtual table, and so can be used as arguments to the resulting table-valued function or referenced directly. See https://www.sqlite.org/lang expr.html#varparam for a detailed description of SQLite's syntax for parameter binding. Anonymous params Unnamed arguments are indexed by position: Note that this will create a new numbered parameter for each ? . Unnamed parameters can be referenced multiple t","default_branch":null,"files":null,"tree":[],"storefront":"/r/0x09","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/0x09/sqlite-statement-vtab/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}