[Zope3-dev] Re: RDB support
Matthew T. Kromer
matt@zope.com
Thu, 11 Apr 2002 10:58:09 -0400
Stephan Richter wrote:
>
>> Insasmuch as I dont have the time to devote to this, I find that
>> there are some restrictions in HOW SQL methods work, as opposed to
>> their user-level syntax; in particular, the notion of collapsing all
>> queries to a single string and then passing that string to a "query"
>> method on the DA is something I'd like to deprecate in favor of:
>>
>> a query string constructor which takes a type and a value and returns
>> a tuple of (string, value) which the string portion is to be embedded
>> into the query string under construction, and the value is to be
>> appended to an array of values to be passed to the extended query
>
>
> Can you elaborate on that? I am a little lost. Also, an example might
> be nice. :-)
>
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.
--
Matt Kromer
Zope Corporation http://www.zope.com/