
Last chance! 50% off unlimited learning
Sale ends in
getInfo(obj, what) # meta-data for any dbObject
getConnection(what, ...)getConnections(mgr) # meta-data for dbManager objects
getDatabases(obj, ...)
getTables(obj, dbname, row.names, ...)
getVersion(obj, ...)
getTableIndices(res, table, dbname, ...)
getCurrentDatabase(con) # meta-data for dbConnection objects
getException(con, ...)
getResultSets(con, ...)
getTableFields(res, table, dbname, ...)
getStatement(res) # meta-data for dbResultSet objects
getFields(res, ...)
hasCompleted(res, ...)
getRowCount(res, ...)
getRowsAffected(res, ...)
getNullOk(res, ...)
dbManager
,
dbConnection
, dbResultSet
).dbManager
object.dbConnection
object.dbResultSet
object.dbname
.The getInfo
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.
On connections, SQL statements and resultSets:
dbExecStatement
dbExec
fetch
quickSQL
On transaction management:
On meta-data:
describe
getVersion
getDatabases
getTables
getFields
getCurrentDatabase
getTableIndices
getException
getStatement
hasCompleted
getRowCount
getAffectedRows
getNullOk
getInfo
m <- dbManager(dbms)
# Extract meta-data information. What MySQL databases are there
# available on host "wyner"
> getDatabases(m, host = "wyner")
Database
1 mysql
2 opto
3 test
4 iptraffic
5 fraud
# What tables are there in the Oracle "opto" database?
> dbTables(m, dbname = "opto", host = "wyner")
Tables in opto
1 PBCT
2 PURGE
3 WL
4 liv25
5 liv85
# let's look at some result set meta-data
> con <- dbConnect(m)
> rs <- dbExecStatement(con, query.sql)
> getStatement(rs)
[1] "show tables"
> hasCompleted(rs)
[1] 0
> getRowCount(rs)
[1] 3
> info <- getInfo(rs)
> names(info)
[1] "statement" "isSelect" "rowsAffected"
[4] "rowCount" "completed" "fieldDescription"
> getStatement(rs)
[1] "show tables"
# the following are pieces of meta-data associated with
# the R/S DBI implementation, versions for the various pieces
# of software (client, server, interface), etc.
# dbManager object
> names(getInfo(m))
[1] "connectionIds" "fetch_default_rec"
[3] "managerId" "length"
[5] "num_con" "counter"
[7] "clientVersion"
# dbConnection object
> names(getInfo(con))
[1] "host" "user"
[3] "dbname" "conType"
[5] "serverVersion" "protocolVersion"
[7] "threadId" "rsId"
# resultSet object
> names(getInfo(rs))
[1] "statement" "isSelect"
[3] "rowsAffected" "rowCount"
[5] "completed" "fieldDescription"
Run the code above in your browser using DataLab