On Thu, Apr 17, 2008 at 08:50:46AM +0930, Bas Scheffers wrote:
> Subject: Re: [AOLSERVER] aolserver and Pgtcl

> I don't really like bind variables, I would much rather see it  
> implemented like:

There are other people who prefer different styles of
bind-variable-like support too, notably D. Richard Hipp.  His SQLite
Tcl API is probably a good source of such alternate ideas, for those
interested in such things.

> ns_db select $db "select * from people where country = $1 and age >  
> $2" [list "au" 25]
> 
> The api could even fall back to emulating this when the database  
> itself does not support it.
> 
> This would be in a database independent way, instead of the current  
> way with Postgres and Oracle implementing their own commands.

Note, when a database actually supports real bind variables and
provides an interface to use them in its C API, like Oracle does, you
REALLY want to use it, NOT ignore it and roll your own emulation of
bind variables in higher level code.  This means that the various ns*
database drivers MUST be involved in proper AOLserver bind variable
support.  Now, ns_db certainly can and should provide the various
calls, which hook into the driver-specific code underneath, rather
than just punting completely and letting the user call driver-provided
Tcl commands directly like it does now.

As a design principle, remember that ns_db itself never cares what is
in the query at all!  ns_db doesn't even care whether the "query" is
SQL or something else, the query is just some opaque string which gets
passed allong to the proper database driver.  Therefore, the right
default approach for ns_db bind variable support is to transparently
pass through whatever bind variable syntax and usage each database and
its driver natively supports and expects.

If you want to experiment with building something extra to support a
single style of alternative bind-variable-like syntax across multiple
datbasese, that's fine, but it should never be the default behavior of
ns_db.

-- 
Andrew Piskorski <[EMAIL PROTECTED]>
http://www.piskorski.com/


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> 
with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: 
field of your email blank.

Reply via email to