[DB-SIG] Controlling return types for DB APIs
M.-A. Lemburg
mal at egenix.com
Tue Apr 17 10:16:46 CEST 2007
On 2007-04-17 06:05, Jim Patterson wrote:
> All,
>
> Over on the cx_Oracle list we have been discussing adding support
> for returning native Unicode strings and decimal objects. We have
> so far been talking about using a settable attribute on the connection
> and the cursor with the cursor inheriting the value from the connection
> by default. The is very similar to the existing technique used
> by cx_Oracle for the "numbersAsString" and the technique used
> by mxODBC for the "stringFormat" and "datetimeFormat".
>
> Anyone have any thoughts/feelings/opinions about moving towards
> standardizing how we do this kind of thing across the different
> database modules?
While mxODBC does use this kind of approach, I don't think
it's all that flexible, e.g. we have now added a new attribute
.decimalformat for specifying whether you want floats or
decimals for decimal database columns.
Ideally, it should be possible to set converters for all
kinds of output types as well as ones for input parameters.
In some situations, it's also desirable to be able to do this
based on the output variable or parameter position. This would,
of course, only apply to cursors with already prepared statements.
While this can be solved using a registry of types conversions,
I see problems in standardizing the way to define the type
mappings since different database backends tend to have
or need different types.
Thanks,
--
Marc-Andre Lemburg
eGenix.com
Professional Python Services directly from the Source (#1, Apr 17 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