Learn R Programming

DBI (version 0.2-1)

dbSetDataMappings: Set data mappings between an DBMS and R/Splus

Description

Sets one or more conversion functions to handle the translation of DBMS data types to R/Splus objects. This is only needed for non-primitive data, since all DBI drivers handle the common base types (integers, numeric, strings, etc.)

Usage

dbSetDataMappings(res, flds, ...)

Arguments

res
a DBIResult object as returned by dbSendQuery.
flds
a field description object as returned by dbColumnInfo.
...
any additional arguments are passed to the implementing method.

Value

  • a logical specifying whether the conversion functions were successfully installed or not.

Side Effects

Conversion functions are set up to be invoked for each element of the corresponding fields in the result set.

Details

The details on conversion functions (e.g., arguments, whether they can invoke initializers and/or destructors) have not been specified.

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

dbSendQuery, fetch, dbColumnInfo.

Examples

Run this code
makeImage <- function(x) {
  .C("make_Image", as.integer(x), length(x))
}

res <- dbSendQuery(con, statement)
flds <- dbColumnInfo(res)
flds[3, "Sclass"] <- makeImage

dbSetDataMappings(rs, flds)

im <- fetch(rs, n = -1)

Run the code above in your browser using DataLab