dbSetDataMappings {DBI}R Documentation

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.

Details

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

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.

Note

No driver has yet implemented this functionality.

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

## Not run: 
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)
## End(Not run)

[Package DBI version 0.2-4 Index]