On Fri, 30 Nov 2018 23:25:48 +0900
Simon Walter <si...@gikaku.com> wrote:

> > SELECT id, data FROM val WHERE id IN ("1, 893, 121212");
...
> I have no idea yet if MySQL and/or PostgreSQL can handle this
> scenario and how they do it. 

The important thing to understand about parameterized queries is that
they are not a generalized macro system. Only data -- not metadata, not
arbitrary strings -- can be parameterized.  That's why your IN list
can't be parameterized (except as individual elements) and why can't say

        SELECT id, data FROM ?
or
        SELECT id, ? FROM val

as would occasionally be convenient.  

Other than string-slinging, the only generalized standard solution for
your parameterized IN list, where the number of elements is variable,
is to first insert the list into a table, then use IN or EXISTS against
it.  

--jkl
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to