fetch-methods            package:RSQLite            R Documentation

_F_e_t_c_h _r_e_c_o_r_d_s _f_r_o_m _a _p_r_e_v_i_o_u_s_l_y _e_x_e_c_u_t_e_d _q_u_e_r_y

_D_e_s_c_r_i_p_t_i_o_n:

     This method is a straight-forward implementation of the
     corresponding generic function.

_D_e_t_a_i_l_s:

     The `RSQLite' implementations retrieves all records into a  buffer
     internally managed by the RSQLite driver (thus this memory in not
     managed by R but its part of the R process), and `fetch' simple
     returns records from this internal buffer.

_M_e_t_h_o_d_s:


     _r_e_s an `SQLiteResult' object.

     _n maximum number of records to retrieve per fetch. Use `n = -1' to
          retrieve all pending records; use a value of `n = 0' for
          fetching the default number  of rows `fetch.default.rec'
          defined in the  `SQLite' initialization invocation.

     ...  currently not used.

_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://developer.r-project.org/db>.

_S_e_e _A_l_s_o:

     `SQLite', `dbConnect', `dbSendQuery', `dbGetQuery',
     `dbClearResult', `dbCommit', `dbGetInfo', `dbReadTable'.

_E_x_a_m_p_l_e_s:

     drv <- dbDriver("SQLite")
     con <- dbConnect(drv, dbname = "sqlite.db")
     res <- 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",
                           "ORDER BY w.laser_id"))
     # we now fetch the first 100 records from the resultSet into a data.frame
     data1 <- fetch(res, n = 100)   
     dim(data1)

     dbHasCompleted(res)

     # let's get all remaining records
     data2 <- fetch(res, n = -1)

