SQLite Forum

Clarification re parameters needed.
The name given is exactly the name specified.  That is, if the parameter used in the SQL statement is @boogaloo then the recorded name string is exactly '@boogaloo'.  The same applies for all parameters that are not purely anonymous positional parameters (a bare ?).

The assignment of paramters works as follows.

Firstly, the "number of parameters" is set to 0.  
The SQL statement is scanned from left to right.  
For each purely anonymous positional parameter marker found, increment "number of parameters".  
For each "numbered positional found" (?nnn) set the "number of parameters" to nnn if nnn is greater than the current "number of parameters".  
If a parameter is encountered which commences with :, @, $ that has not previously been seen (determined by searching the name:position mapping table) in this statement then increment "number of parameters" and record that the name (:xxx, @xxx, or $xxx as used in the statement) maps to the new "number of parameters" position.  
Stop when the end of the statement is reached.  

Now, allocate an array long enough to store all of the parameters from 1 to the "number of parameters" (even if there are some that are not referenced).

`sqlite3_bind_parameter_count` returns the upper extent of the array.
`sqlite3_bind_parameter_index` looks up the given string (exactly) in the mapping table of "names to locations" and returns the parameter number stored for that name.

`sqlite3_bind_parameter_name` looks up the parameter number given in the table of "names to locations" and returns the name associated with that location.

In some cases if a positional name is used, that positional name might be stored against the location number (that is, if the parameter marker ?437 is stored, then there may be a mapping created between the name ?437 and the location 437).

**Edited to exchange the work greater for the word less**