[Twisted-Python] adapi.Connection._runQuery always does rollback()

Eric C. Newton ecn at metaslash.com
Sat Apr 26 14:30:18 EDT 2003

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

On Sat, Apr 26, 2003 at 07:33:25PM +0200, Federico Di Gregorio wrote:
> Il sab, 2003-04-26 alle 15:55, Eric C. Newton ha scritto:
> > not understand the logic of always running a rollback even if the
> > query is successful.  I would, instead, expect this:
> i introduced such buglet but i thought it was fixed (see discussion on
> this list some weeks ago). 
> > PS. This buglet brought to you by MySQL which does not support rollback(), 
> >     and tells you with an exception.
> your adapter is b0rked. as per dbapi-2.0 document:
>             Database modules that do not support transactions should
>             implement this method with void functionality.
> -- 
> Federico Di Gregorio
> Debian GNU/Linux Developer                                fog at debian.org
> INIT.D Developer                                           fog at initd.org
>                            Don't dream it. Be it. -- Dr. Frank'n'further

More information about the Twisted-Python mailing list