dbConnect-methods          package:RSQLite          R Documentation

_C_r_e_a_t_e _a _c_o_n_n_e_c_t_i_o_n _o_b_j_e_c_t _t_o _a_n _S_Q_L_i_t_e _D_B_M_S

_D_e_s_c_r_i_p_t_i_o_n:

     These methods are straight-forward implementations of the
     corresponding generic functions.

_M_e_t_h_o_d_s:

     _d_r_v an object of class 'SQLiteDriver', or the character string
          "SQLite" or an 'SQLiteConnection'.

     _c_o_n_n an 'SQLiteConnection' object as produced by 'dbConnect'.

     ...  As of RSQLite 0.4-1 you may specify values for the two
          'PRAGMAs' 'cache_size' and 'synchronous' when initializing a
          new connection (this does not applies, obviously, to cloning
          an existing connection).

          RSQLite defaults 'synchronous' to 0 (or "OFF"), although
          SQLite's default as of 3.2.8 is 2 (FULL). Possible values for
          'synchronous' are 0, 1, or 2 or the  corresponding strings
          "OFF", "NORMAL", or "FULL". Users have reported significant
          speed ups using 'sychronous=0', and the SQLite documentation
          itself implies considerable improved performance at the very
          modest risk of database corruption in the unlikely case of
          the operating system (_not_ the R application)  crashing. See
          the SQLite documentation for the full details of this
          'PRAGMA'.

          'cache_size' can be a positive integer to change the maximum
          number of disk pages that SQLite holds in memory (SQLite's
          default is 2000 pages). 

_S_i_d_e _E_f_f_e_c_t_s:

     A connection between R/S-Plus and the embeddable SQLite server is 
     established.  Note that since the SQLite is embedded in R/S-Plus,
     connections are not too resource hungry.

     SQLite connections only require the file name where the SQLite
     database reside.  For details see 'SQLite'.

_R_e_f_e_r_e_n_c_e_s:

     See the Database Interface definition document 'DBI.pdf' in the
     base directory of this package or <URL:
     http://stat.bell-labs.com/RS-DBI>.

_S_e_e _A_l_s_o:

     'SQLite', 'dbConnect', 'dbSendQuery', 'dbGetQuery', 'fetch',
     'dbCommit', 'dbGetInfo', 'dbReadTable'.

_E_x_a_m_p_l_e_s:

     ## Not run: 
     # create an SQLite instance and create one connection.
     drv <- dbDriver("SQLite")

     # open the connection using user, passsword, etc., as
     con <- dbConnect(drv, dbname = "sqlite.db")

     # Run an SQL statement by creating first a resultSet object
     rs <- dbSendQuery(con, statement = paste(
                           "SELECT w.laser_id, w.wavelength, p.cut_off",
                           "FROM WL w, PURGE P", 
                           "WHERE w.laser_id = p.laser_id", 
                           "SORT BY w.laser_id")
     # we now fetch records from the resultSet into a data.frame
     data <- fetch(rs, n = -1)   # extract all rows
     dim(data)
     ## End(Not run)

