Dennis Cote wrote:

I haven't looked at the implementation of the named parameters in SQLite...


Parameters can be in any of three forms:

    *  <question-mark>
    *  <colon><identifier>
    *  <dollar-sign><tcl-variable-name>

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.

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.

This implementation is very simple and compact.  And with the exception
of not supporting <question-mark><number> parameters, the implementation
is sufficient, I believe to efficiently emulate all of the behaviors
described by Darren and Dennis.  Support for <question-mark><number>
can be added in the future if a genuine need appears.

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.

--
D. Richard Hipp -- [EMAIL PROTECTED] -- 704.948.4565



Reply via email to