I just ran into an issue with RSQLite and 64bit integers from the bit64 package.
Here is a simplified example:
library(DBI)
library(bit64)
dbcon = dbConnect(RSQLite::SQLite(), ":memory:")
df = data.frame(int64=as.integer64("12345678901234567"))
dbWriteTable(dbcon, "table", df)
dbReadTable(dbcon, "table")
# int64
#1 7.749004e-308
A version with dbBind yields similar results:
dbExecute(dbcon, "create table 'b' ('int64' INTEGER)")
dbres = dbSendStatement(dbcon, "insert into b(int64) values (?)")
dbBind(dbres, as.integer64(1))
dbGetRowsAffected(dbres)
dbClearResult(dbres)
dbGetQuery(dbcon, "select * from b")
# int64
#1 4.940656e-324
A remedy is of course to as.character or as.numeric the offending values, but it would be nice if cases like these could be handled transparently.
I ran into this when transferring data from one sqlite-db to another via R, where one column marked as integer had one very large value>2^32, thus making the whole column a bit64::integer64 column in R. If I hadn't been careful I wouldn't have noticed it immediately.
I just ran into an issue with RSQLite and 64bit integers from the bit64 package.
Here is a simplified example:
A version with
dbBindyields similar results:A remedy is of course to
as.characteroras.numericthe offending values, but it would be nice if cases like these could be handled transparently.I ran into this when transferring data from one sqlite-db to another via R, where one column marked as integer had one very large value>2^32, thus making the whole column a bit64::integer64 column in R. If I hadn't been careful I wouldn't have noticed it immediately.