def connect(self):
SQLObjectStore.connect(self)
if self._autocommit:
# Since our autocommit patch above does not get applied to pooled
# connections, we have to monkey-patch the pool connection method
try:
pool = self._pool
connection = pool.connection
except AttributeError:
pass
else:
def newConnection(self):
conn = self._normalConnection()
try:
conn.autocommit(True)
except AttributeError:
pass
return conn
pool._normalConnection = connection
pool._autocommit = self._autocommit
pool.connection = new.instancemethod(
newConnection, pool, pool.__class__)
评论列表
文章目录