dbSendQuery-methods         package:RSQLite         R Documentation

_E_x_e_c_u_t_e _a _S_Q_L _s_t_a_t_e_m_e_n_t _o_n _a _d_a_t_a_b_a_s_e _c_o_n_n_e_c_t_i_o_n

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

     These are the primary methods for interacting with a database via
     SQL queries.

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


     _c_o_n_n a 'SQLiteConnection' object.

     _s_t_a_t_e_m_e_n_t a character vector of length one specifying the SQL
          statement that should be executed.  Only a single SQL
          statment should be provided.

     _r_e_s a 'SQLiteResult' object.

     ...  additional parameters.

_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', 'dbDriver', 'dbConnect', 'fetch', 'dbCommit',
     'dbGetInfo', 'dbReadTable'.

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

     con <- dbConnect(SQLite(), ":memory:")
     data(USArrests)
     dbWriteTable(con, "arrests", USArrests)

     res <- dbSendQuery(con, "SELECT * from arrests")
     data <- fetch(res, n = 2)
     data
     dbClearResult(res)

     dbGetQuery(con, "SELECT * from arrests limit 3")

     tryCatch(dbGetQuery(con, "SELECT * FROM tableDoesNotExist"),
              error=function(e) { print("caught") })
     dbGetException(con)

