dbNextResult             package:RMySQL             R Documentation

_F_e_t_c_h _n_e_x_t _r_e_s_u_l_t _s_e_t _f_r_o_m _a_n _S_Q_L _s_c_r_i_p_t _o_r _s_t_o_r_e_d _p_r_o_c_e_d_u_r_e (_e_x_p_e_r_i_m_e_n_t_a_l)

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

     Fetches the next result set from the output of a multi-statement
     SQL  script or stored procedure; checkes whether there are
     additonal result sets to process.

_U_s_a_g_e:

     dbNextResult(con, ...)
     dbMoreResults(con, ...)

_A_r_g_u_m_e_n_t_s:

     con: a connection object (see 'dbConnect').

     ...: any additional arguments to be passed to the dispatched
          method

_D_e_t_a_i_l_s:

     SQL scripts (i.e., multiple SQL statements separated by ';') and
     stored procedures oftentimes generate multiple result sets.  These
     DBI generic functions provide a means to process them
     sequentially.

     'dbNextResult' fetches the next result from the sequence of
     pending results sets;  'dbMoreResults' returns a logical to 
     indicate whether there are additional results to process.

_V_a_l_u_e:

     'dbNextResult' returns a result set or 'NULL'.

     'dbMoreResults' returns a logical specifying whether or not there
     are additional result sets to process in the connection.

_N_o_t_e:

     Currently only the 'MySQL' driver implements these methods. See
     'methods?dbNextMethod'.

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

     'MySQL' 'dbConnect' 'dbSendQuery' 'fetch'

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

     ## Not run: 
     rs1 <- dbSendQuery(con, 
              paste(
                  "select Agent, ip\_addr, DATA from pseudo\_data order by Agent",
                  "select * from Agent\_name",
                   sep = ";")
              )
     x1 <- fetch(rs1, n = -1)
     if(dbMoreResults(con)){
        rs2 <- dbNextResult(con)
        x2 <- fetch(rs2, n = -1)
     }
     ## End(Not run)

