VirtualTableModule
public protocol VirtualTableModule
An SQLite virtual table module.
In the context of SQLite modules, init(arguments:create:) is conceptually equivalent
to xConnect when create is false and to xCreate when create is true.
That is, create is true if the module instance is being constructed as part of a CREATE VIRTUAL TABLE statement.
deinit is conceptually equivalent to xDisconnect while destroy is conceptually equivalent to xDestroy.
destroy() is invoked by a DROP TABLE statement.
Seealso
Virtual Table Object-
Opens a connection to an SQLite virtual table module.
Throws
SQLiteErrorif the module could not be createdDeclaration
Swift
init(database: Database, arguments: [String], create: Bool) throwsParameters
databaseThe database to which this virtual table module is being added.
argumentsThe arguments used to create the virtual table module. The first argument is the name of the module being invoked. The second argument is the name of the database in which the virtual table is being created. The third argument is the name of the new virtual table. Any additional arguments are those passed to the module name in the
CREATE VIRTUAL TABLEstatement.createWhether the virtual table module is being initialized as the result of a
CREATE VIRTUAL TABLEstatement and should create any persistent state. -
The options supported by this virtual table module
Declaration
Swift
var options: Database.VirtualTableModuleOptions { get } -
The SQL
CREATE TABLEstatement used to tell SQLite about the virtual table’s columns and datatypes.Note
The name of the table and any constraints are ignored.Declaration
Swift
var declaration: String { get } -
Destroys any persistent state associated with the virtual table module
Note
This is only called as the result of aDROP TABLEstatement.Declaration
Swift
func destroy() throws -
Determines the query plan to use for a given query
Throws
SQLiteErrorif an error occursDeclaration
Swift
func bestIndex(_ indexInfo: inout sqlite3_index_info) throws -> VirtualTableModuleBestIndexResultParameters
indexInfoAn
sqlite3_index_infostruct containing information on the queryReturn Value
.okon success or.constraintif the configuration of unusable flags inindexInfocannot result in a usable query plan -
Opens and returns a cursor for the virtual table
Throws
SQLiteErrorerror if the cursor could not be createdDeclaration
Swift
func openCursor() throws -> VirtualTableCursorReturn Value
An initalized cursor for the virtual table
View on GitHub
VirtualTableModule Protocol Reference