[Twisted-Python] adapi.Connection._runQuery always does rollback()
Eric C. Newton
ecn at metaslash.com
Sat Apr 26 15:51:08 MDT 2003
Thanks. I know that the MySQLdb API blocks.
You will note that I'm not actually using the MySQLdb API in the code
below, but adding code which adds a rollback method to allocated
connection objects. Long-running calls go through the
twisted.enterprise APIs.
-Eric
On Sat, Apr 26, 2003 at 10:19:01PM +0200, Thomas Raschbacher wrote:
> hi!
>
> you did this in your 'application' code? (you know that this will block
> your whole twisted app for the time of the query right? since MySQLdb is
> not async .. and u'd need a thread to make it kinda async ..)
>
> regards
> <quote who="Eric C. Newton">
> > Alrighty. In case anyone else needs to do this before the MySQL
> > Python API is brought up-to-date, here's how I kludged it without
> > changing twisted:
> >
> > import MySQLdb
> >
> > def doNothing(*args, **kw):
> > return None
> >
> > class AddRollback:
> > def __init__(self, module):
> > self.doConnect = module.connect
> >
> > def connect(self, *args, **kw):
> > result = self.doConnect(*args, **kw)
> > result.rollback = doNothing
> > return result
> >
> > MySQLdb.connect = AddRollback(MySQLdb).connect
More information about the Twisted-Python
mailing list