SQLite                package:RSQLite                R Documentation

_I_n_s_t_a_n_t_i_a_t_e _t_h_e _S_Q_L_i_t_e _e_n_g_i_n_e _f_r_o_m _t_h_e _c_u_r_r_e_n_t _R/_S-_P_l_u_s _s_e_s_s_i_o_n.

_D_e_s_c_r_i_p_t_i_o_n:

     This function creates and initializes the SQLite engine. It
     returns an object that allows you to connect to the SQLite 
     embedded engine.

_U_s_a_g_e:

     SQLite(max.con = 16, fetch.default.rec = 500, force.reload = F)

_A_r_g_u_m_e_n_t_s:

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. 

fetch.default.rec: number of records to fetch at one time from the
          database. (The `fetch' method uses this number as a default.) 

force.reload: should the package code be reloaded (reinitialized)?
          Setting this to `TRUE' allows you to change default settings.
           Notice that all connections should be closed before
          re-loading. 

_D_e_t_a_i_l_s:

     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 is the file name, thus database names should be
     legal file names in the running platform.

_V_a_l_u_e:

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

_S_i_d_e _E_f_f_e_c_t_s:

     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 `dbConnect'.

_U_s_e_r _a_u_t_h_e_n_t_i_c_a_t_i_o_n:

     SQLite is a single-user database engine, so no authentication is
     required.

_R_e_f_e_r_e_n_c_e_s:

     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 `DBI.pdf' under the `doc' subdirectory of
     the DBI package, i.e.,  `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.

_A_u_t_h_o_r(_s):

     David A. James

_S_e_e _A_l_s_o:

     On database drivers:

     `dbDriver', `dbUnloadDriver', `dbListConnections'.

     On connections, SQL statements and resultSets:

     `dbConnect', `dbDisconnect', `dbSendQuery', `dbGetQuery', `fetch',
     `dbListResults'.

     On transaction management:

     `dbCommit',  `dbRollback'.

     On meta-data:

     `summary', `dbGetInfo', `dbListTables', `dbListFields',
     `dbColumnsInfo', `dbGetException', `dbGetStatement',
     `dbHasCompleted', `dbGetRowCount', `dbGetAffectedRows'.

_E_x_a_m_p_l_e_s:

        # 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)    


