Package 'virta'

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

Help Index


Initialize SQLite extension virtual tables on a SQLite DB connection

Description

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).

Usage

init_virtualtables(db)

Arguments

db

An RSQLite database connection as returned by dbConnect.

Value

TRUE if the virtual tables were successfully loaded.

Author(s)

Reijo Sund

References

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.

Examples

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)

Virtual tables for RSQLite

Description

This package uses SQLite's loadable extension feature to provide virtual tables.

Available virtual tables

You can enable all of the following virtual tables by calling the init_virtualtables function on an RSQLite database connection object.

Author(s)

Reijo Sund <[email protected]> Maintainer: Reijo Sund <[email protected]>

Examples

## basic usage looks like this
db <- dbConnect(SQLite(), dbname = ":memory:")
init_virtualtables(db)

## now you can use virtual tables in SQL queries.
dbDisconnect(db)

SQL queries from Muste (SVO)-files using virtual tables

Description

Makes it possible to easily utilize Muste (SVO)-files in SQL-queries and also move output results directly to SVO-files.

Usage

virta.sql(query,destfile,database,encod)

Arguments

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)

Details

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.

Value

R data frame or SVO-file.

Author(s)

Reijo Sund