[Zope3-dev] Phantom of GadflyAdapter

Tadashi Matsumoto ma2 at city.plala.jp
Tue Dec 13 09:54:43 EST 2005


Phantom of GadflyAdapter

GadflyAdapter sometimes causes phantom read.

The reason is that many connections are made simultaneously
on a gadfly database through the thead local variable
_v_connection. Threadsafety level 2 or higher is required
to use the thread local variable.

To remedy this fault, it is enough to use
usual variable as _v_connection. But users need to control
lock/unlock of the connection by themselves.

Simple patch:

--- gadflyda.py.org     2005-12-06 22:19:47.000000000 +0900
+++ gadflyda.py 2005-12-12 22:41:07.000000000 +0900
@@ -51,6 +51,8 @@
 
     # The registerable object needs to have a container
     __name__ = __parent__ = None 
+    _v_connection = None
+    paramstyle = 'qmark'
 
     def _connection_factory(self):
         """Create a Gadfly DBI connection based on the DSN.

----
Tadashi Matsumoto
ma2 at city.plala.jp


More information about the Zope3-dev mailing list