I'm trying to understand how RODBC determines the column types of a newly created (Access) table? The R documentation of sqlSave is very cryptic: "types are selected by consulting arguments varTypes and typeInfo". And no examples for this arguments. Where can I find a better explanation?
RODBC sqlSave column types: how determined?
No need to look at the sources. Use "getSqlTypeInfo(driver)" instead.
> getSqlTypeInfo("ACCESS")
$double
[1] "DOUBLE"
$integer
[1] "INTEGER"
$character
[1] "VARCHAR(255)"
$logical
[1] "varchar(5)"
>
Just look at the sources of the RODBC package.
# from R/TypeInfo.R:
typesR2DBMS <-
list(MySQL = list(double="double", integer="integer",
character="varchar(255)", logical="varchar(5)"),
ACCESS = list(double="DOUBLE", integer="INTEGER",
character="VARCHAR(255)", logical="varchar(5)"),
# etc ...
cran.r-project.org/src/contrib/RODBC_1.3-2.tar.gz, File R/TypeInfo.R, Line 41 –
Marduk
Thanks. But I'm using Windows, my C:\Program Files\R\R-2.10.1\library\RODBC directory doesn't contains TypeInfo.R. Is there no example on the net? –
Penurious
You have to download the source package from the link above to view the source of
TypeInfo.R
–
Marduk fantastic answer. I love that you pulled from the source and then gave a reference to where in the source it came from. That's excellent. –
Convection
str(getAnywhere(typesR2DBMS)) –
Aubarta
How can we increase the default varchar length (without changing the source code)? –
Sterol
No need to look at the sources. Use "getSqlTypeInfo(driver)" instead.
> getSqlTypeInfo("ACCESS")
$double
[1] "DOUBLE"
$integer
[1] "INTEGER"
$character
[1] "VARCHAR(255)"
$logical
[1] "varchar(5)"
>
© 2022 - 2024 — McMap. All rights reserved.