summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorINADA Naoki <inada-n@klab.com>2013-01-05 09:34:59 +0900
committerINADA Naoki <inada-n@klab.com>2013-01-05 09:34:59 +0900
commit797d9c3029c0660a43b71130cac093343e15f0dc (patch)
tree237b1e343e0b67cc409d7784ce09d94ab551fcd9
parent52894fd137e040b67604b9a27f434567e508b485 (diff)
downloadmysqldb1-797d9c3029c0660a43b71130cac093343e15f0dc.tar.gz
Support `autocommit=True` for constructor argument.
-rw-r--r--MySQLdb/connections.py5
1 files changed, 4 insertions, 1 deletions
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 = []