RSQLite (version 0.4-15)

sqliteSupport: Support Functions

Description

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

Usage

## SQLiteDriver-related
   sqliteInitDriver(max.con=16, fetch.default.rec = 500, force.reload=FALSE,
                    shared.cache=FALSE)
   sqliteDriverInfo(obj, what, ...)
   sqliteDescribeDriver(obj, verbose = FALSE, ...)
   sqliteCloseDriver(drv, ...)

## SQLiteConnection-related sqliteNewConnection(drv, dbname, loadable.extensions=FALSE, cache_size=NULL, synchronous=0) sqliteConnectionInfo(obj, what, ...) sqliteDescribeConnection(obj, verbose = FALSE, ...) sqliteCloseConnection(con, ...)

## SQLiteResult-related sqliteExecStatement(con, statement, bind.data=NULL) sqliteTransactionStatement(con, statement) sqliteFetch(res, n=0, ...) sqliteQuickSQL(con, statement, bind.data=NULL, ...) 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, ...) sqliteImportFile(con, name, value, field.types, overwrite=FALSE, append=FALSE, header, row.names, nrows=50, sep=",", eol="", skip = 0, ...) sqliteWriteTable(con, name, value, row.names = TRUE, ...) sqliteTableFields(con, name, ...) 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 driver, thus this argument). } 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. } 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). } loadable.extensions{ logical describing whether loadable extensions will be enabled for this connection. The default is FALSE. } shared.cache{ logical describing whether shared-cache mode should be enabled on the SQLite driver. The default is FALSE. } bind.data{ a data frame which will be used to bind variables in the statement. } cache_size{ positive integer to pass to the PRAGMA cache_size; this changes the maximum number of disk pages that SQLite will hold in memory (SQLite's default is 2000 pages). } synchronous{ values the PRAGMA synchronous flag, possible values are 0, 1, or 2 or the corresponding strings "OFF", "NORMAL", or "FULL". The RSQLite package uses a default of 0 (OFF), although SQLite's default is 2 (FULL) as of version 3.2.8. Users have reported significant speed ups using sychronous="OFF", and the SQLite documentation itself implies considerably improved performance at the very modest risk of database corruption in the unlikely case of the operating system (not the R application) crashing. }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. } header{ logical, does the input file have a header line? Default is the same heuristic used by read.table, i.e., TRUE if the first line has one fewer column that the second line. } nrows{ number of lines to rows to import using read.table from the input file to create the proper table definition. Default is 50. } sep{field separator character.} eol{end-of-line separator.} skip{ number of lines to skip before reading data in the input file. } ...{ placeholder for future use. } 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.

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.

sqliteImportFile 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.} datasets interface database

Arguments