SQLiteDriver-class {RSQLite}R Documentation

Class SQLiteDriver with constructor SQLite.

Description

An SQLite driver implementing the R/S-Plus database (DBI) API. This class should always be initializes with the SQLite() function. It returns a singleton object that allows you to connect to the SQLite engine embedded in R.

Usage

SQLite(max.con = 200L, fetch.default.rec = 500, force.reload = FALSE,
  shared.cache = FALSE)

Arguments

max.con,force.reload

Ignored and deprecated.

fetch.default.rec

default number of records to fetch at one time from the database. The fetch method will use this number as a default, but individual calls can override it.

shared.cache

logical describing whether shared-cache mode should be enabled on the SQLite driver. The default is FALSE.

Details

This implementation allows the R embedded SQLite engine to work with multiple database instances through multiple connections simultaneously.

SQLite keeps each database instance in one single file. The name of the database is the file name, thus database names should be legal file names in the running platform.

Value

An object of class SQLiteDriver which extends dbDriver and dbObjectId. This object is needed to create connections to the embedded SQLite database. There can be many SQLite database instances running simultaneously.

Examples

# initialize a new database to a tempfile and copy some data.frame
# from the base package into it
con <- dbConnect(SQLite(), ":memory:")
data(USArrests)
dbWriteTable(con, "USArrests", USArrests)

# query
rs <- dbSendQuery(con, "select * from USArrests")
d1 <- fetch(rs, n = 10)      # extract data in chunks of 10 rows
dbHasCompleted(rs)
d2 <- fetch(rs, n = -1)      # extract all remaining data
dbHasCompleted(rs)
dbClearResult(rs)
dbListTables(con)

# clean up
dbDisconnect(con)

[Package RSQLite version 1.0.0 Index]