I would like to +1 the idea about virtual talbe. 

Using variable number of '?'s is never the option. You must know that there is 
limit to how many '?'s can be there. 
One day this approach will stab you in the back. The very day when you will 
need to bind more elements than limit value.


> 
> 
> >Is it possible to have a variable number of parameters in an IN clause in
> >a prepared statement, i.e. "select * from Table where Col1 in
> >(?,?,?,...);"?
> 
> >Or do I need a constant number of parameters in there to be able to re-
> >use the prepared statement?
> 
> The closest solution would be to create a table/temporary table and populate 
> it with your value list. You can then use a statement like:
> 
> SELECT <columns ...> FROM <table> WHERE <column> IN <list-table>
> 
> This assumes that your <list-table> has only one column, it is the correct 
> type. 
> 
> If your list is only integers take a look at test_intarray.c in the full 
> source. It implements a virtual table that maps from a C array to a virtual 
> table. With minimal changes this would work for doubles as well. Since it 
> would be your own custom extension virtual table, you could make it work with 
> whatever weird data structure and data you required.
> 
> 
> 
> 
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 


факамака фо
 
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to