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 797d9c3

Browse filesBrowse files
committed
Support autocommit=True for constructor argument.
1 parent 52894fd commit 797d9c3
Copy full SHA for 797d9c3

File tree

Expand file treeCollapse file tree

1 file changed

+4
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-1
lines changed

‎MySQLdb/connections.py

Copy file name to clipboardExpand all lines: MySQLdb/connections.py
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,9 @@ class object, used to create cursors (keyword only)
139139
local_infile
140140
integer, non-zero enables LOAD LOCAL INFILE; zero disables
141141
142+
autocommit
143+
If True, autocommit is enabled.
144+
142145
There are a number of undocumented, non-standard methods. See the
143146
documentation for the MySQL C API for some hints on what they do.
144147
@@ -224,7 +227,7 @@ def string_decoder(s):
224227
self.encoders[types.StringType] = string_literal
225228
self.encoders[types.UnicodeType] = unicode_literal
226229
self._transactional = self.server_capabilities & CLIENT.TRANSACTIONS
227-
if self._transactional:
230+
if self._transactional and not kwargs2.pop('autocommit', False):
228231
# PEP-249 requires autocommit to be initially off
229232
self.autocommit(False)
230233
self.messages = []

0 commit comments

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