On 2017-09-16 12:01 PM, Jens Alfke wrote:
On Sep 15, 2017, at 11:40 PM, Wout Mertens <wout.mert...@gmail.com> wrote:

This would be handy when specifying `INSERT INTO t(@?) VALUES(@?)` or `SELECT
* FROM t WHERE v IN (@?)`.

I'm definitely not an expert on the SQLite virtual machine, but I believe that 
changing these parameters [or at least the number of parameters] would alter 
the opcodes generated for the statement. Which would require recompiling the 
statement. So it wouldn't be feasible to make them bindings.

I agree with you. The first use case, the INSERT, given by Wout is not feasible and misunderstands how things work.

The second use case however is entirely reasonable, saying "SELECT * FROM t WHERE v in ?" where that single bind parameter is an array.

Or, if a bind parameter could correspond to an entire tuple/row, which is reasonable, then the ? could only replace the entire "VALUES(...)" and not the field list for INTO, such as to say "INSERT INTO t ?".

Generally speaking, the only places where a parameter makes sense is anywhere a single value literal of any type makes sense, such as anywhere one can use a VALUES clause or whatever can go in the second argument for an IN.

-- Darren Duncan

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

Reply via email to