D. Richard Hipp wrote: > Parameters can be in any of three forms: > > * <question-mark> > * <colon><identifier> > * <dollar-sign><tcl-variable-name>
I repeat the other calls for continued (or added) support of the ?n style of numbered parameters. They can of course be replaced by named parameters using names like :Pn but that involves extra overhead in SQLite to handle a name for the parameter when only its number is really used. > > Each parameter is assigned a number. Numbers are sequential from left > to right and begin with 1. The parameter number is used to bind > values to the parameter. All parameters get a different number, even > those with identical names. Why do all parameters, even those with the same name, get a different number? Doesn't this imply that I need to bind each of these parameters separately? This seems to defeat the purpose of having named parameters. I want to use the same parameter value at multiple places in the SQL statement. I should be able to use the same named parameter multiple times, and then bind a value to that parameter once before executing the statement. > The sqlite3_bind_parameter_count() API returns the number of > parameters in a compiled SQL statement. > sqlite3_bind_parameter_name() returns the text of a particular bound > parameter. Just for clarity, I assume you mean that sqlite3_bind_parameter_name() returns the text of the parameter name, and not a text representation of the value bound to that parameter. Your description isn't clear to me. I think there should also be an API function int sqlite3_bind_parameter_number(const char* name) that returns the parameter number assigned to the named parameter. This number is then used with the existing bind_parameter calls to bind a value to that parameter. This one (actually two because of the two string types)API function prevents the need for an second set of bind_parameter calls that take the parameter name as an argument. > The <dollar-sign><tcl-variable-name> is not standard SQL. It is an > extension. SQLite supports many other non-standard extensions in > its lexer, including things like the use of [...] to quote identifies, > the ability to use certain keywords (ex: DESC, BEGIN, VIEW) as > the names of tables or columns, and a very broad understanding of > what it means to be an identifier so that characters from non-latin > character sets can be used in identifer names without quoting. > <dollar-sign><tcl-variable-name> is yet another extension. Nobody > is forced to use it if they do not want to. It only consumes 182 > bytes of compiled code space (i486 with GCC) and it makes life much > nicer for TCL programmers, so I think it is well worth including. I don't have any problems with extensions as long as the basic functions support the SQL standard (i.e. <colon><identifier>) where ever possible. I'm sure this will be useful in the test suite if nothing else.