[R] sqlSave, fast=F option, bug?

chao gai chaogai at duineveld.demon.nl
Wed Oct 18 20:09:30 CEST 2006


The bug spot seems to be the fast option
sqlDrop(chan,'test')
df <- data.frame(T=1, S=10)
sqlSave(chan, df, "test", rownames=F)
df <- data.frame(S=20, T=2)
sqlSave(chan, df, "test", rownames=F, append=T,fast=T)
df <- data.frame(S=30, T=3)
sqlSave(chan, df, "test", rownames=F, append=T,fast=F)
sqlFetch(chan,'test')
   T  S
1  1 10
2  2 20
3 30  3
On Linux & MySQL  


On Wednesday 18 October 2006 17:06, Dieter Menne wrote:
> Paul MacManus <paul.macmanus <at> gmail.com> writes:
> > Using the fast=F option, sqlSave saves without matching column names.
> > It looks like a bug to me..........
>
> ....
>
> > In other words, sqlSave didn't check column names, it simply mapped
> > column 1 to column 1 and column 2 to column 2.
>
> This seems to be a problem with SQLServer. The following example with
> Access works correctly for me, even if I close the connection in between.
> (Win2k, R 2.4.0)
>
> Dieter Menne
>
> -----
> library(RODBC)
> channel <- odbcConnectAccess("db1.mdb")
> df <- data.frame(T=1, S=10)
> sqlSave(channel, df, "test", rownames=F)
> #odbcClose(channel)
>
> #channel <- odbcConnectAccess("db1.mdb")
> df <- data.frame(S=20, T=2)
> sqlSave(channel, df, "test", rownames=F, append=T,fast=T)
> odbcClose(channel)
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html and provide commented, minimal,
> self-contained, reproducible code.



More information about the R-help mailing list