[R-sig-DB] dbSendPreparedQuery in RSQLite

James Bullard bu||@rd @end|ng |rom berke|ey@edu
Wed Apr 16 05:45:42 CEST 2008


Yes, in this example that would certainly work. However, I have a  
large number of queries in a tight loop and it would be nice to avoid  
the overhead of the query parsing and compiling on each call through  
the loop. I believe it is not supported on select statements as well  
and wonder if this would be a hard addition, also, I wonder if this is  
the correct syntax below. From other settings it seems a little off  
(see the link in the original email).

thanks again, jim


On Apr 15, 2008, at 7:21 PM, Sean Davis wrote:
> On Tue, Apr 15, 2008 at 8:31 PM, James Bullard  
> <bullard using berkeley.edu> wrote:
>> How do we send prepared queries in RSQLite. We are interested in
>> something along the lines of
>>
>> ps = dbSendPreparedQuery(conn, "SELECT * FROM table1 WHERE chr = ?",
>> data.frame("integer"))
>> for( i in 1:2)
>>   rs = dbGetPreparedQuery(ps, i)
>>
>> In C it would look something along the lines of
>> http://www.mail-archive.com/sqlite-users@sqlite.org/msg31854.html
>
> It looks like this is not supported for select statements, though I
> could easily be wrong.  In this particular case, you could rewrite
> your select as:
>
> "SELECT * from table1 where chr in (1,2)"
>
> Sean




More information about the R-sig-DB mailing list