Dear list,

I find the IN operator quite useful for selecting a set number of things.
However, I often have a Tcl list with the things I want to match
already when I get to the stage there I should issue a SELECT on the
database.
I then paste all the elements of the list together with ',' or just ,
chars and supply that inside a () to the sqlite3 database command.

Would it not be a nice, and safer, addition to the interface to be
able to do something like this (i.e. sot that there would be no syntax
error at the end):

--------------
package require sqlite3
sqlite3 db :memory:
db eval {create table a (id INTEGER);}
db eval {insert into a values (1);}
db eval {insert into a values (2);}
db eval {select * from a where id in (1,3);} vals {parray vals}
vals(*)  = id
vals(id) = 1
set alist [list 1 3]
1 3
db eval {select * from a where id in $alist;} vals {parray vals}
near "$alist": syntax error
--------------

Also seems much safer to have a proper binding of values here..

/Fredrik



-- 
"Life is like a trumpet - if you don't put anything into it, you don't
get anything out of it."
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to