On Sat, May 4, 2013 at 3:26 PM, Igor Tandetnik <i...@tandetnik.org> wrote:

> There is no bind-by-name API in SQLite. You must explicitly call
> sqlite3_bind_parameter_index, then bind by index.
>

Doh, you're absolutely right - i was apparently dreaming at the time.



> Why? It doesn't matter how many times a parameter is used. You bind a
> value to it once, and that value applies everywhere.
>

My assumption(!) is that :param in this example refers to 2 indexes:

  UPDATE foo set x=:param, y=:param ...

Maybe the problem is simply my understanding of how sqlite3 internally
references those. If it, e.g., internally replaces them both with "?1" then
i can see how it would work as-is.



> i'm curious if there is a way to get all of the
>
>> indexes of a given named parameter?
>>
>
> When you say "index", you seem to mean "a particular occurrence of a
> parameter within the query".


Yes, but after reading your reply i can imagine that :param is internally
replaced with ?NNN, in which case it becomes clear how bind-by-index(1) can
do the right thing in the face of multiple instances of a given name.


> For example, for the above SQL snippet
>
>> i "would like to" be able to get the values (1, 2) in some manner.
>>
>
> What do you mean, get the values? There's only one parameter, to which you
> can bind one value.


By "values" (admittedly a poor choice of words) i meant the parameter
indexes.

:)

-- 
----- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to