Learn R Programming

RMySQL (version 0.4-6)

setDataMappings: Set data mappings between an RDBMS and R/S

Description

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

Usage

setDataMappings(res, ...)

Arguments

res
a dbResultSet object as returned by dbExecStatement.
...
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.

See Also

dbExecStatement dbExec fetch getFields

Examples

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

rs <- dbExecStatement(con, sql.query)
flds <- getFields(rs)
flds[3, "Sclass"] <- makeImage

setDataMappings(rs, flds)

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

Run the code above in your browser using DataLab