[DB-SIG] API 3.0 limiting paramstyle to ['named', 'qmark'] is okay. ('format' is not desirable)
M.-A. Lemburg
mal at egenix.com
Fri May 17 17:45:04 CEST 2013
On 17.05.2013 17:01, Vernon D. Cole wrote:
> Good point, the others would be optional.
>
> How should the switching be done? My present development head has four
> methods:
>
> 1) adodbapi.apibase.paramstyle = 'named'
> I think this one should be deprecated. Stepping on a module quasi-constant
> is never a good idea.
Not a good idea, agreed.
It's very difficult for a database module to detect changes like these
to e.g. detect wrong parameter values.
Example:
module.paramstyle = 'oracle'
would likely not generate an exception, but a subsequent query then
would and you'd have to search your application code for the
assignment line, provided the database module tells you what to
look for :-)
> 2) adodbapi.connect(connection_string, paramstyle='named')
> I just added this one, so a django adapter can hand me a bucketfull of
> keyword arguments. I think I like this the best in terms of ease-of-use.
Interesting idea.
> 3) conn = adodbapi.connect(connection_string)
> conn.paramstyle = 'named'
> This is the most obvious, and provides lots of power. The programmer could
> use 'qmark' to load big INSERT statements, then switch to 'named' for
> detailed SELECT or UPDATE. The default value is determined by the module
> author.
>
> 4) cursor.paramstyle = 'named'
> I have this implemented, but the more I think about it, the more it seems
> unnecessary.
Those two are the most natural in terms of how the rest of the
DB-API works, so +1 on those. I think we already agreed on this
approach being added as optional extension to DB-API 2.0, but
could be wrong.
> What other options should be considered?
I think those are sufficient to configure your application
to whatever param style you need/like best.
--
Marc-Andre Lemburg
eGenix.com
Professional Python Services directly from the Source (#1, May 17 2013)
>>> Python Projects, Consulting and Support ... http://www.egenix.com/
>>> mxODBC.Zope/Plone.Database.Adapter ... http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
________________________________________________________________________
2013-05-07: Released mxODBC Zope DA 2.1.2 ... http://egenix.com/go46
2013-05-06: Released mxODBC 3.2.3 ... http://egenix.com/go45
::::: Try our mxODBC.Connect Python Database Interface 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
http://www.egenix.com/company/contact/
More information about the DB-SIG
mailing list