[Zope3-dev] Re: RDB support

Jeffrey P Shell jeffrey@cuemedia.com
Thu, 11 Apr 2002 14:26:59 -0600


On 4/11/02 8:58 AM, "Matthew T. Kromer" <matt@zope.com> wrote:

> Well, what I'm after is something that will help construct query
> strings, e.g. to build the string
> 
> 'select * from table where foo=:foo'
>
> the bind string is DA specific -- for instance, DCOracle2 can bind by
> name or by position ':foo' vs ':1'.  Other DA's can use different
> methods.  So what you want is a mechanism to tell the DA "help me build
> the next binding parameter string for this value."
> 
> For things like positional binding, its pretty evident you'll need to
> keep some kind of state so you can increment the position.
> 
> You probably want some kind of querybuilder object which keeps track of
> its own state, and either knows about all kinds of DBAPI 2.0 parameter
> binding styles, or leverages a DA-specific binding routine.

One would hope it would at least do that.  A nice thing about The SQL
Methods of Today are the bonus tags - especially sqltest which can nicely
handle situations with zero, one or multiple values (generating a "foo =
'bar'" or "foo in ('bar', 'baz', 'boop')", depending on the value passed in
to the sqltest tag and the parameters set on it, or not generating any SQL
code at all if the value is considered empty and the 'optional' flag is
set).

For ad-hoc queries, especially in web applications that are just doing
simple relational stuff - searching, reporting, maybe light updates, it's my
favorite query building language I've come across so far.

-- 
Jeffrey P Shell 
www.cuemedia.com