sqliteSupport {RSQLite} | R Documentation

## 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=10, fetch.default.rec = 500, force.reload=FALSE)
       sqliteDriverInfo(obj, what, ...)
       sqliteDescribeDriver(obj, verbose = FALSE, ...)
       sqliteCloseDriver(drv, ...)

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

       ## SQLiteResult-related
       sqliteExecStatement(con, statement, limit)
       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 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).
`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.
`force` | logical indicating whether to close a connection that has open result sets. The default is `FALSE`.
`statement` | character string holding SQL statements.
`limit` | integer specifying maximum number or rows to fetch. The default is -1 (fetch all rows).
`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.
`sqliteConnectionInfo`returns 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`.

[Package Contents]