[egenix-users] cursor.executedirect configurable?
mal at egenix.com
Wed Sep 10 12:13:15 CEST 2008
On 2008-09-10 04:18, Brad Allen wrote:
> I am using mxODBC 3 with the Storm ORM, which makes use of
> cursor.execute. I would like to find a way to configure mxODBC to use
> executedirect without having to change or override Storm's call to
> Is there some way to configure mxODBC to use the executedirect behavior
> when cursor.execute is called?
No, that's not possible without wrapping the cursor object and
then redirecting the method in the wrapper.
Note that cursor.execute() will work like cursor.executedirect()
when called without parameters.
You should check the performance of using one over the other.
cursor.executedirect() will bypass the prepare step, so the
statement will have to be parsed and processed over and over
Some database backends do clever caching on the server, so this
is not an issue, in fact, it's faster for simple queries since
you avoid a few network round-trips.
For other backends, it's slower, since they don't implement
Another issue is related to parameter binding: using
cursor.executedirect() the ODBC driver does not have any
parameter type information available (this only becomes
available via the prepare step), so mxODBC cannot do
any efficient conversion to database data types on the
client side. This may result in conversion problems on
the server side and introduce extra overhead.
Professional Python Services directly from the Source (#1, Sep 10 2008)
>>> 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 egenix-users