summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorINADA Naoki <inada-n@klab.com>2013-05-21 12:09:55 +0900
committerINADA Naoki <inada-n@klab.com>2013-05-21 12:09:55 +0900
commitc1b8e8a0474c44f60ed8e08b3be8dc7f293ce7b8 (patch)
tree1fb0f46a57bfabd99bccbbb6e1de0c39be1c0409
parent9b83342879fc444ce527e1adf357ce47f7a99dce (diff)
downloadmysqldb1-c1b8e8a0474c44f60ed8e08b3be8dc7f293ce7b8.tar.gz
autocommit=None means using server default.
-rw-r--r--MySQLdb/connections.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/MySQLdb/connections.py b/MySQLdb/connections.py
index aeac731..2b423e7 100644
--- a/MySQLdb/connections.py
+++ b/MySQLdb/connections.py
@@ -140,7 +140,9 @@ class Connection(_mysql.connection):
integer, non-zero enables LOAD LOCAL INFILE; zero disables
autocommit
+ If False (default), autocommit is disabled.
If True, autocommit is enabled.
+ If None, autocommit isn't set and server default is used.
There are a number of undocumented, non-standard methods. See the
documentation for the MySQL C API for some hints on what they do.
@@ -227,9 +229,11 @@ 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 and not kwargs2.pop('autocommit', False):
+ if self._transactional:
# PEP-249 requires autocommit to be initially off
- self.autocommit(False)
+ autocommit = kwargs2.pop('autocommit', False)
+ if autocommit is not None:
+ self.autocommit(bool(True))
self.messages = []
def cursor(self, cursorclass=None):