Support autocommit=True for constructor argument.

This commit is contained in:
INADA Naoki
2013-01-05 09:34:59 +09:00
parent 52894fd137
commit 797d9c3029

View File

@ -139,6 +139,9 @@ class Connection(_mysql.connection):
local_infile local_infile
integer, non-zero enables LOAD LOCAL INFILE; zero disables 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 There are a number of undocumented, non-standard methods. See the
documentation for the MySQL C API for some hints on what they do. 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.StringType] = string_literal
self.encoders[types.UnicodeType] = unicode_literal self.encoders[types.UnicodeType] = unicode_literal
self._transactional = self.server_capabilities & CLIENT.TRANSACTIONS 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 # PEP-249 requires autocommit to be initially off
self.autocommit(False) self.autocommit(False)
self.messages = [] self.messages = []