Title: | Virtual tables for RSQLite |
---|---|
Description: | This package uses SQLite's loadable extension feature to provide virtual table access to SVO-files. |
Authors: | Reijo Sund <[email protected]> |
Maintainer: | Reijo Sund <[email protected]> |
License: | Artistic-2.0 |
Version: | 0.9.6 |
Built: | 2024-11-19 04:09:42 UTC |
Source: | https://github.com/rsund/survor |
This function loads extension virtual tables to make them available to an
RSQLite database connection. The databse connection needs to have been
created by passing loadable.extensions = TRUE
to dbConnect
(this is the default as of RSQLite 0.9-1).
init_virtualtables(db)
init_virtualtables(db)
db |
An RSQLite database connection as returned by |
TRUE if the virtual tables were successfully loaded.
Reijo Sund
For details on loadable extensions in SQLite, see http://www.sqlite.org/cvstrac/wiki?p=LoadableExtensions.
For details on virtual tables in SQLite, see http://www.sqlite.org/cvstrac/wiki?p=VirtualTables.
db <- dbConnect(SQLite(), dbname = ":memory:", loadable.extensions = TRUE) init_virtualtables(db) dbSendQuery(db, "create virtual table t1 using test") dbGetQuery(db,"select * from t1") dbDisconnect(db)
db <- dbConnect(SQLite(), dbname = ":memory:", loadable.extensions = TRUE) init_virtualtables(db) dbSendQuery(db, "create virtual table t1 using test") dbGetQuery(db,"select * from t1") dbDisconnect(db)
This package uses SQLite's loadable extension feature to provide virtual tables.
You can enable all of the following virtual tables by calling the
init_virtualtables
function on an RSQLite database connection
object.
Reijo Sund <[email protected]> Maintainer: Reijo Sund <[email protected]>
## basic usage looks like this db <- dbConnect(SQLite(), dbname = ":memory:") init_virtualtables(db) ## now you can use virtual tables in SQL queries. dbDisconnect(db)
## basic usage looks like this db <- dbConnect(SQLite(), dbname = ":memory:") init_virtualtables(db) ## now you can use virtual tables in SQL queries. dbDisconnect(db)
Makes it possible to easily utilize Muste (SVO)-files in SQL-queries and also move output results directly to SVO-files.
virta.sql(query,destfile,database,encod)
virta.sql(query,destfile,database,encod)
query |
SQL query |
destfile |
path to SVO-output file |
database |
path to RSQLite database file to be used (defaults to memory) |
encod |
force enconding (defaults to UTF-8) |
Initializes database connection, enables virtual tables (references to SVO-files in queries must be given as MUSTE.<path to SVO-file>), runs the query, returns R data frame or outputs SVO-file.
R data frame or SVO-file.
Reijo Sund