diff options
Diffstat (limited to 'MySQLdb')
-rw-r--r-- | MySQLdb/connections.py | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/MySQLdb/connections.py b/MySQLdb/connections.py index 40a6150..0c529f7 100644 --- a/MySQLdb/connections.py +++ b/MySQLdb/connections.py @@ -240,21 +240,10 @@ class Connection(_mysql.connection): def autocommit(self, on): on = bool(on) - _mysql.connection.autocommit(self, on) + if self.get_autocommit() != on: + _mysql.connection.autocommit(self, on) self._autocommit = on - def get_autocommit(self): - if self._autocommit is None: - self._update_autocommit() - return self._autocommit - - def _update_autocommit(self): - cursor = cursors.Cursor(self) - cursor.execute("SELECT @@AUTOCOMMIT") - row = cursor.fetchone() - self._autocommit = bool(row[0]) - cursor.close() - def cursor(self, cursorclass=None): """ |