[DB-SIG] paramstyles, again

Carsten Haese carsten at uniqsys.com
Mon Jun 4 15:24:31 CEST 2007


On Mon, 2007-06-04 at 15:00 +0200, M.-A. Lemburg wrote:
> 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).

I'm not sure I follow. The proposal on the table is to require all
interfaces to support qmark, numeric, and named, and to automatically
detect from the query string which style the query uses. Since the
programmer controls both the query string and the corresponding
parameters, there is no use case for inspecting the current paramstyle
setting.

To me, there is no practical difference between saying "the parameters
argument is a sequence or a mapping as determined by the query's
parameter style" and "the parameters argument may be any object with a
__getitem__ method that provides appropriate keys", so I'm fine with
either one as long as that gives us auto-detection of parameter styles.

-- 
Carsten Haese
http://informixdb.sourceforge.net




More information about the DB-SIG mailing list