Hello everyone,
I have a question which I'm hoping someone who knows a bit about
SQlite's internals can answer easily.

I have a query such as this:

SELECT * FROM local INNER JOIN foreign ON local.foreign_id =
foreign.id WHERE foreign.id IN (4, 3, 6, 7) ORDER BY local.name;

Here the list of numbers in the WHERE clause is subject to change. How
possible do you think it is to have this as a prepared query?

SELECT * ... WHERE foreign.id IN ($list) ...;

Bearing in mind:
 - the length of the list is completely variable.
 - binding text results in SELECT * ... WHERE foreign.id IN ("4. 3, 6,
7") ...; which of course doesn't work.
 - binding seems to set specific values in the VM, so my instinct says
this won't be possible because the query will change too much based on
the list of ids - it will need too much recompiling each time.

However, I thought I would throw this problem out to people who knew
sqlite in more depth than me to see if there's an easy answer that I'm
missing.

Thanks in advance for any help!
Sam
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to