dbSetTypeMaps.Rd
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.
dbSetTypeMaps(...)
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.
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)
Named list of currently registered type mapping functions. If
...
is empty then visibly, otherwise invisibly.
str(dbSetTypeMaps())
#> List of 3
#> $ DATETIME :function (x)
#> $ TIMESTAMP:function (x)
#> $ DATE :function (x)
## 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)