Learn R Programming

DBI (version 0.1-2)

dbGetInfo: Database interface meta-data

Description

Extract meta-data associated with various objects

Usage

dbGetInfo(dbObj, ...)       # meta-data for any DBIObject
  dbGetStatement(res, ...)    # statement that produced result "res"
  dbHasCompleted(res, ...)    # are there more rows to fetch on "res"?
  dbColumnInfo(res, ...)      # result set data types

Arguments

dbObj
any object that implements some functionality in the R/S interface to databases (a driver, a connection or a result set).
res
refers to a DBIResult object.
...
any driver-specific arguments.

Value

  • 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.

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

    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.

Note

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).

Details

These functions implement a minimal set of meta-data describing the most important aspects of the R/S 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.

References

See the Database Interface definition document DBI.pdf in the base directory of this package or http://developer.r-project.org/db.

See Also

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

Examples

Run this code
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))

Run the code above in your browser using DataLab