James Berry wrote:
I think I was most confused by was the use of the word "index" in the
documentation where associated with the bind calls. Index is a
misnomer. It should really be something like "parameter number" as
I've used it above, since index to me implies the index of the
parameter reference within the SQL.

James,

Index was the correct term when it was first used, since SQLite only supported positional parameters at that time. The parameter number was the index of the parameter in the SQL statement.

Things have gotten more complicated since then. Now, the term index really refers to the internal array of parameter values that is maintained for each statement.

I don't think it means much to talk about the "parameter number" of a named parameter. They should be refered to by their name. To bind a value to a named parameter you need to ask SQLite for the index number to use for that variable when you make the bind call.

For numbered parameters, the parameter's number is the index by design (but it could have been different).

For positional parameters, you still need to count the parameters in the SQL statement to determine its index.

I think index is still the best term, it is just that you need to be clear that it is an index into the array of bound values, not into the text of the SQL statement.

Dennis Cote

Reply via email to