dbSetTypeMaps: Manage type mapping functions.

View source: R/maptypes.R

dbSetTypeMapsR Documentation

Manage type mapping functions.

Description

Type mapping functions are functions that perform conversions between types as they are received from JDBC to R objects. For any JDBC type it is possible to define a function which is called before returning results from fetch().

dbSetTypeMaps() function sets, removes or lists the mapping functions.

Usage

dbSetTypeMaps(...)

Arguments

...

one or more arguments of the form TYPE=function(x) ... (set a new conversion function) or TYPE=NULL (remove conversion). If empty, no changes are made.

Details

The type names correspond to the column type names as defined by JDBC (see java.sql.Types Java documentation). For example, if you want to convert NUMERIC columns to numeric values in R (regardless of precision)

Value

Named list of currently registered type mapping functions. If ... is empty then visibly, otherwise invisibly.

Examples

str(dbSetTypeMaps())

## use bit64::as.integer64 (if available) to convert BIGINT to integer64
if (is.environment(bit64 <- tryCatch(getNamespace("bit64"), error=function(e) FALSE)))
    dbSetTypeMaps(BIGINT=bit64$as.integer64)

s-u/RJDBC documentation built on Aug. 24, 2023, 2:30 a.m.