You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit adds a new method named xPrepareSql to sqlite3_module and an
associated opcode VPrepareSql. That opcode is emitted immediately before
a VFilter opcode when querying virtual tables.
xPrepareSql takes two arguments: a pointer to the virtual table's cursor
and, missing from existing sqlite3_module methods, the SQL string being
executed by the application.
Prior to the introduction of this method, a virtual table that mirrored
a remote table had no way to tell which columns of the remote server
were requested by the application. Therefore, such an implementation
would typically `SELECT *` from the remote table and let callbacks such
as xColumn() and xNext() decide which data to send back to the
application. The problem with this approach is that queries that SELECT
just a subset of the remote columns trigger the transfer of data over
the network even though they won't be used.
xPrepareSql gives an opportunity for the virtual table implementation to
inspect the query string and selectively choose which columns from the
remote server to pull and cache locally.
Because this change introduces a new method to sqlite3_module, new
modules wishing to implement a callback for xPrepareSql must declare
a module version (iVersion) 4 or above.
0 commit comments