On Tue, Aug 24, 2004 at 02:55:51PM -0400, D. Richard Hipp wrote:
> In this way, I get to specify TCL variables directly in the
> SQL statement, not as parameters added to the end. For
> example:
>
> db eval {UPDATE t1 SET value=$bigblob WHERE rowid=$id}
Dr. Hipp, this is a great little feature, but is there some reason you
chose to use '$' to indicate a bind variable rather than the more
typical ':' symbol?
At least for Tcl, '$' seems like a particularly poor choice, as it
means you'll have to escape it whenever using double quoted strings in
Tcl. E.g.:
db eval "UPDATE t1_SET value=\$bigblob WHERE rowid=\$id $and_clause"
Is there some advantage to using '$' here that I've missed?
Btw, I've used these database APIs and know that they all use ':' to
indicate a named bind variable which then maps to a Tcl variable, in
very much the same scheme you've explained above:
- AOLserver's Oracle and PostgreSQL drivers. (Which is then used and
further extended by the OpenACS db api.)
- nstcl (which wraps Oratcl, Pgtcl, etc.)
I don't know what other db APIs do or don't do with bind variables.
--
Andrew Piskorski <[EMAIL PROTECTED]>
http://www.piskorski.com/