\Header{SQLite}{Instantiate the SQLite engine from the current R/S-Plus session.}
\alias{SQLiteDriver}{SQLite}
\keyword{interface}{SQLite}
\keyword{database}{SQLite}
\begin{Description}\relax
This function creates and initializes the SQLite engine.
It returns an object that allows you to connect to the SQLite 
embedded engine.\end{Description}
\begin{Usage}
\begin{verbatim}
SQLite(max.con = 16, fetch.default.rec = 500, force.reload = F)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{max.con }] maximum number of connections that may be open at one time.
This can be up to 100, a limit defined at compilation time.
Note that since the SQLite engine is embedded (i.e., a set of C 
functions within the R/S-Plus process) connections consume very
little resources.

\item[\code{fetch.default.rec}] number of records to fetch at one time from the database.
(The \code{fetch} method uses this number as a default.)

\item[\code{force.reload}] should the package code be reloaded (reinitialized)?
Setting this to \code{TRUE} allows you to change
default settings.  Notice that all connections should be closed
before re-loading.

\end{ldescription}
\end{Arguments}
\begin{Details}\relax
This object is a singleton, that is, on subsequent invocations
it returns the same initialized object. 

This implementation allows the R/S-Plus 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 \emph{is} the file name, thus database names
should be legal file names in the running platform.\end{Details}
\begin{Value}
An object of class \code{SQLiteDriver} which extends 
\code{dbDriver} and \code{dbObjectId}.
This object is required to create connections
to the embedded SQLite database.
There can be many SQLite database instances running
simultaneously.\end{Value}
\begin{Section}{Side Effects}
The R/S-Plus client part of the database communication is initialized,
but note that connecting to database instances needs to be done through
calls to \code{dbConnect}.\end{Section}
\begin{Section}{User authentication}
SQLite is a single-user database engine, so no authentication
is required.\end{Section}
\begin{Section}{References}
See the Omega Project for Statistical Computing
at \url{http://www.omegahat.org} and \url{http://stat.bell-labs.com/RS-DBI}
for more details on the R/S-Plus database interface.

See the Adobe PDF file \code{DBI.pdf} under the \code{doc}
subdirectory of the DBI package, i.e., 
\code{system.file("doc", "DBI.pdf", package = "DBI")}

See the documentation at the SQLite Web site
\url{http://www.hwaci/com/sw/sqlite/index.html} for details.\end{Section}
\begin{Author}\relax
David A. James\end{Author}
\begin{SeeAlso}\relax
On database drivers:

\code{\Link{dbDriver}},
\code{\Link{dbUnloadDriver}},
\code{\Link{dbListConnections}}.

On connections, SQL statements and resultSets:

\code{\Link{dbConnect}},
\code{\Link{dbDisconnect}},
\code{\Link{dbSendQuery}},
\code{\Link{dbGetQuery}},
\code{\Link{fetch}},
\code{\Link{dbListResults}}.

On transaction management:

\code{\Link{dbCommit}}, 
\code{\Link{dbRollback}}.

On meta-data:

\code{\Link{summary}},
\code{\Link{dbGetInfo}},
\code{\Link{dbListTables}},
\code{\Link{dbListFields}},
\code{\Link{dbColumnsInfo}},
\code{\Link{dbGetException}},
\code{\Link{dbGetStatement}},
\code{\Link{dbHasCompleted}},
\code{\Link{dbGetRowCount}},
\code{\Link{dbGetAffectedRows}}.\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
   # create a SQLite instance and create one connection.
   m <- dbDriver("SQLite")
   
   # initialize a new database "base.dbms" in the current directory
   # and copy some data.frame from the base package into it
   
   con <- dbConnect(m, dbname = "base.dbms")
   data(USArrests)
   dbWriteTable(con, "USArrests", USArrests, overwrite = T)
   
   # 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)    
   
\end{ExampleCode}
\end{Examples}

