On Sun, Jul 11, 2010 at 11:31 AM, Matt Shotwell <shotw...@musc.edu> wrote:
> On Fri, 2010-07-09 at 20:02 -0400, Erik Wright wrote:
>> Hi Matt,
>>
>> This works great, thanks!
>>
>> At first I got an error message saying BLOB is not implemented in RSQLite.  
>> When I updated to the latest version it worked.
>
> SQLite began to support BLOBs from version 3.0.

And RSQLite began supporting BLOBs only just recently :-)
See the NEWS file for details.

Below is a minimal example of how you might use BLOBs:

    db <- dbConnect(SQLite(), dbname = ":memory:")
    dbGetQuery(db, "CREATE TABLE t1 (name TEXT, data BLOB)")

    z <- paste("hello", 1:10)
    df <- data.frame(a = letters[1:10],
                     z = I(lapply(z, charToRaw)))
    dbGetPreparedQuery(db, "insert into t1 values (:a, :z)", df)
    a <- dbGetQuery(db, "select name from t1")
    checkEquals(10, nrow(a))
    a <- dbGetQuery(db, "select data from t1")
    checkEquals(10, nrow(a))
    a <- dbGetQuery(db, "select * from t1")
    checkEquals(10, nrow(a))
    checkEquals(2, ncol(a))

    checkEquals(z, sapply(a$data, rawToChar))
    dbDisconnect(db)


-- 
Seth Falcon | @sfalcon | http://userprimary.net/

______________________________________________
R-help@r-project.org 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.

Reply via email to