Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c1b8e8a

Browse filesBrowse files
committed
autocommit=None means using server default.
1 parent 9b83342 commit c1b8e8a
Copy full SHA for c1b8e8a

File tree

Expand file treeCollapse file tree

1 file changed

+6
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-2
lines changed

‎MySQLdb/connections.py

Copy file name to clipboardExpand all lines: MySQLdb/connections.py
+6-2Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,9 @@ class object, used to create cursors (keyword only)
140140
integer, non-zero enables LOAD LOCAL INFILE; zero disables
141141
142142
autocommit
143+
If False (default), autocommit is disabled.
143144
If True, autocommit is enabled.
145+
If None, autocommit isn't set and server default is used.
144146
145147
There are a number of undocumented, non-standard methods. See the
146148
documentation for the MySQL C API for some hints on what they do.
@@ -227,9 +229,11 @@ def string_decoder(s):
227229
self.encoders[types.StringType] = string_literal
228230
self.encoders[types.UnicodeType] = unicode_literal
229231
self._transactional = self.server_capabilities & CLIENT.TRANSACTIONS
230-
if self._transactional and not kwargs2.pop('autocommit', False):
232+
if self._transactional:
231233
# PEP-249 requires autocommit to be initially off
232-
self.autocommit(False)
234+
autocommit = kwargs2.pop('autocommit', False)
235+
if autocommit is not None:
236+
self.autocommit(bool(True))
233237
self.messages = []
234238

235239
def cursor(self, cursorclass=None):

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.