dbGetInfo-methods            package:DBI            R Documentation

_D_a_t_a_b_a_s_e _i_n_t_e_r_f_a_c_e _m_e_t_a-_d_a_t_a

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

     Extract meta-data associated with various objects

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

       dbGetInfo(dbObj, ...)       # meta-data for any DBIObject
       dbGetDBIVersion()           # DBI version 
       dbGetStatement(res, ...)    # statement that produced result "res"
       dbGetRowCount(res, ...)     # number of rows fetched so far
       dbGetRowsAffected(res, ...) # number of affected rows (e.g., DELETE)
       dbColumnInfo(res, ...)      # result set data types
       dbHasCompleted(res, ...)    # are there more rows to fetch on "res"?

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

   dbObj: any object that implements some functionality in the R/S-Plus
          interface to databases (a driver, a connection or a result
          set). 

     res: refers to a 'DBIResult' object. 

     ...: driver-specific arguments.  

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

     These functions implement a minimal set of meta-data describing
     the  most important aspects of the R/S-Plus to DBMS interface.

     The 'dbGetInfo' works very similarly to the function 'options' in
     that it attempts to extract what the user may request, possibly
     'NULL' if it can't locate the specific piece of meta-data.

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

     'dbGetDBIVersion' returns a character string with the version of
     the database interface API.

     'dbGetInfo' produces either a character vector or a named list  of
     (name, value) pairs.

     'dbGetStatement' returns a character string with the statement 
     associated with the result set 'res'.

     'dbGetRowCount' returns the number of rows fetched so far.

     'dbGetRowsAffected' returns the number of affected rows (e.g., 
     how many rows were deleted, inserted).  Some drivers may set this
     to the total number of rows a query produces.

     'dbColumnInfo' returns a data.frame with one row per output field
     in 'res'.  The columns should report field name, field data type,
     scale and precision (as understood by the DBMS engine), whether
     the field can store 'NULL' values, and possibly other
     DBMS-specific information.

     'dbHasCompleted' returns a logical describing whether the
     operations  has been completed by the DBMS or not.

_N_o_t_e:

     Meta-data associated with a driver should include the version of
     the package, plus the version of the underlying client library. 
     Connection objects should report the version of the DBMS engine,
     database name, user,  possibly password, etc.  Results should
     include the statement being executed, how many rows have been
     fetched so far (in the case of queries), how many rows were
     affected (deleted, inserted, changed, or total number of records
     to be fetched).

_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:

     'dbDriver', 'dbConnect', 'dbSendQuery', 'dbGetQuery', 'fetch',
     'dbCommit', 'dbGetInfo', 'dbListTables', 'dbReadTable'.

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

     ## Not run: 
     drv <- dbDriver("SQLite")
     con <- dbConnect(drv)

     dbListTables(con)

     rs <- dbSendQuery(con, query.sql)
     dbGetStatement(rs)
     dbHasCompleted(rs)

     info <- dbGetInfo(rs)
     names(dbGetInfo(drv))  

     # DBIConnection info
     names(dbGetInfo(con))

     # DBIResult info
     names(dbGetInfo(rs)) 
     ## End(Not run)

