sqliteSupport

0th

Percentile

Support Functions

These functions are the workhorses behind the RSQLite package, but users need not invoke these directly.

Keywords
datasets, interface, database
Usage
## SQLiteDriver-related
   sqliteInitDriver(max.con=10, fetch.default.rec = 500, force.reload=FALSE)
   sqliteDriverInfo(obj, what)
   sqliteDescribeDriver(obj, verbose = FALSE, ...)
   sqliteCloseDriver(drv, ...)

## SQLiteConnection-related sqliteNewConnection(drv, dbname, mode = 0) sqliteCloneConnection(drv, ...) sqliteConnectionInfo(obj, what) sqliteDescribeConnection(obj, verbose = FALSE, ...) sqliteCloseConnection(con, ..., force = FALSE)

## SQLiteResult-related sqliteExecStatement(con, statement) sqliteFetch(res, n=0, ...) sqliteQuickSQL(con, statement, ...) sqliteResultInfo(obj, what) sqliteDescribeResult(obj, verbose = FALSE, ...) sqliteCloseResult(res, ...)

## data mappings and convenience functions sqliteDataType(obj, ...) sqliteReadTable(con, name, row.names = "row.names", check.names = TRUE, ...) sqliteWriteTable(con, name, value, field.types, row.names = TRUE, overwrite=FALSE, append=FALSE, ...) sqliteTableFields(con, name, ...)

Arguments
max.con
positive integer specifying maximum number of open connections. The default is 10. Note that since SQLite is embedded in R/S-Plus connections are simple, very efficient direct C calls.
fetch.default.rec
default number of rows to fetch (move to R/S-Plus). This default is used in sqliteFetch. The default is 500.
force.reload
logical indicating whether to re-initialize the driver. This may be useful if you want to change the defaults (e.g., fetch.default.rec). Note that the driver is a singleton (subsequent inits just returned the previously initialized
obj
any of the SQLite DBI objects (e.g., SQLiteConnection, SQLiteResult).
what
character vector of metadata to extract, e.g., "version", "statement", "isSelect".
verbose
logical controlling how much information to display. Defaults to FALSE.
drv
an SQLiteDriver object as produced by sqliteInit.
con
an SQLiteConnection object as produced by sqliteNewConnection and sqliteCloneConnection.
res
an SQLiteResult object as produced by by sqliteExecStatement.
dbname
character string with the SQLite database file name (SQLite, like Microsoft's Access, stores an entire database in one file).
mode
positive integer describing the mode for opening the database (SQLite's underlying API currently does not yet use it, but it is reserved for future functionality). The default is 0.
max.results
positive integer indicating the maximum number of results that SQLite connections will hold open. The current default of 1 is hardcoded in the C code.
force
logical indicating whether to close a connection that has open result sets. The default is FALSE.
statement
character string holding SQL statements.
n
number of rows to fetch from the given result set. A value of -1 indicates to retrieve all the rows. The default of 0 specifies to extract whatever the fetch.default.rec was specified during driver initialization sqliteInit
name
character vector of names (table names, fields, keywords).
value
a data.frame.
field.types
a list specifying the mapping from R/S-Plus fields in the data.frame value to SQL data types. The default is sapply(value,SQLDataType), see SQLiteSQLType.
row.names
a logical specifying whether to prepend the value data.frame row names or not. The default is TRUE.
check.names
a logical specifying whether to convert DBMS field names into legal S names. Default is TRUE.
overwrite
logical indicating whether to replace the table name with the contents of the data.frame value. The defauls is FALSE.
append
logical indicating whether to append value to the existing table name.
...
placeholder for future use.
Value

  • sqliteInitDriver returns an SQLiteDriver object.

    sqliteDriverInfo returns a list of name-value metadata pairs.

    sqliteDescribeDriver returns NULL (displays the object's metadata).

    sqliteCloseDriver returns a logical indicating whether the operation succeeded or not.

    sqliteNewConnection returns an SQLiteConnection object.

    sqliteCloneConnection returns an SQLiteConnection object.

    sqliteConnectionInforeturns a list of name-value metadata pairs.

    sqliteDescribeConnection returns NULL (displays the object's metadata).

    sqliteCloseConnection returns a logical indicating whether the operation succeeded or not.

    sqliteExecStatement returns an SQLiteResult object.

    sqliteFetch returns a data.frame.

    sqliteQuickSQL returns either a data.frame if the statement is a select-like or NULL otherwise.

    sqliteDescribeResult returns NULL (displays the object's metadata). sqliteCloseResult returns a logical indicating whether the operation succeeded or not. sqliteReadTable returns a data.frame with the contents of the DBMS table. sqliteWriteTable returns a logical indicating whether the operation succeeded or not. sqliteTableFields returns a character vector with the table name field names. sqliteDataType retuns a character string with the closest SQL data type. Note that SQLite is typeless, so this is mostly for creating table that are compatible across RDBMS. sqliteResultInfo returns a list of name-value metadata pairs.

Constants

.SQLitePkgName (currently "RSQLite"), .SQLitePkgVersion (the R package version), .SQLitePkgRCS (the RCS revision), .SQLitecle.NA.string (character that SQLite uses to denote NULL on input),.conflicts.OK.

Aliases
  • sqliteInitDriver
  • sqliteDriverInfo
  • sqliteDescribeDriver
  • sqliteCloseDriver
  • sqliteNewConnection
  • sqliteCloneConnection
  • sqliteConnectionInfo
  • sqliteDescribeConnection
  • sqliteCloseConnection
  • sqliteExecStatement
  • sqliteFetch
  • sqliteQuickSQL
  • sqliteResultInfo
  • sqliteDescribeResult
  • sqliteCloseResult
  • sqliteReadTable
  • sqliteWriteTable
  • sqliteTableFields
  • sqliteDataType
  • .SQLitePkgName
  • .SQLitePkgVersion
  • .SQLitePkgRCS
  • .SQLite.NA.string
  • .conflicts.OK
Documentation reproduced from package RSQLite, version 0.3-0, License: LGPL version 2 or newer

Community examples

Looks like there are no examples yet.