R (for example RMySQL or ROracle). DBIDriver
DBIConnection
DBIResult DBI::dbDataType(dbiCon, rObj) returns a proposed SQL (database) data type with which an R objects should be stored on a specific database backend. dbExistsTable(con, tab) checks if a table exists. dbColumnInfo describes a result set (that is: a DBIResult). dbListFields(con, 'tab_name') returns a vector that contains the names of the columns of the table named `*tab_name*. select * from table combined with a SQL limit clause that truncates the returned record set to 0 records: db <- dbConnect(…) empty_res <- dbSendQuery(db_omis_lab, 'select top 0 * from data') col_info <- dbColumnInfo(empty_res) dbClearResult(empty_res)
dbSendQuery cannot be used here.
col_info is a data frame with two columns, named name and type. dbSendQuery(…), dbExecute needs to be prefixed with DBI::: DBI::dbExecute(con, 'create table t (v varchar(20))');