From 797d9c3029c0660a43b71130cac093343e15f0dc Mon Sep 17 00:00:00 2001 From: INADA Naoki Date: Sat, 5 Jan 2013 09:34:59 +0900 Subject: Support `autocommit=True` for constructor argument. --- MySQLdb/connections.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/MySQLdb/connections.py b/MySQLdb/connections.py index 6bc1613..aeac731 100644 --- a/MySQLdb/connections.py +++ b/MySQLdb/connections.py @@ -139,6 +139,9 @@ class Connection(_mysql.connection): local_infile integer, non-zero enables LOAD LOCAL INFILE; zero disables + autocommit + If True, autocommit is enabled. + There are a number of undocumented, non-standard methods. See the documentation for the MySQL C API for some hints on what they do. @@ -224,7 +227,7 @@ class Connection(_mysql.connection): self.encoders[types.StringType] = string_literal self.encoders[types.UnicodeType] = unicode_literal self._transactional = self.server_capabilities & CLIENT.TRANSACTIONS - if self._transactional: + if self._transactional and not kwargs2.pop('autocommit', False): # PEP-249 requires autocommit to be initially off self.autocommit(False) self.messages = [] -- cgit v1.2.1