[DB-SIG] paramstyles, again
M.-A. Lemburg
mal at egenix.com
Mon Jun 4 15:00:15 CEST 2007
On 2007-06-04 14:43, Carsten Haese wrote:
> On Mon, 2007-06-04 at 10:41 +0200, M.-A. Lemburg wrote:
>> I'd suggest to make the current module read-only paramstyle
>> attribute and writable connection/cursor attribute which gets
>> inherited from connections to cursors.
>>
>> There's also the problem of parameter type if we allow named
>> style. The parameters would then have to be dictionaries for
>> named and tuples for qmark/numeric. So you effectively change
>> the signature of the .execute() methods based on a parameter
>> which is not good style.
>
> In addition to what I said before, you're proposing that the .execute()
> signature depend on a connection/cursor attribute. I'm not sure that
> that's much better than having it depend directly on the query string.
Well, no: I'm saying that it's not a good idea to have the
signature depend on a parameter.
OTOH, you need such a parameter to allow programmers to query
the current paramstyle setting, if you do allow multiple param
styles.
This creates a conflict.
The only way around it would be to say that the 'parameters'
parameter in .execute() must have a __getitem__ compatible
interface which is then used to either get the positional
argument (via an integer key) or the named argument (via
a string or Unicode object).
--
Marc-Andre Lemburg
eGenix.com
Professional Python Services directly from the Source (#1, Jun 04 2007)
>>> Python/Zope Consulting and Support ... http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
________________________________________________________________________
:::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! ::::
eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
Registered at Amtsgericht Duesseldorf: HRB 46611
More information about the DB-SIG
mailing list