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_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 = FALSE)

_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 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 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 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 <URL:
     http://stat.bell-labs.com/RS-DBI> for more details on the R
     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.sqlite.org> 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:

     ## Not run: 
        # 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(Not run)

