diff options
author | INADA Naoki <songofacandy@gmail.com> | 2013-10-02 02:10:02 +0900 |
---|---|---|
committer | INADA Naoki <songofacandy@gmail.com> | 2013-10-02 02:10:02 +0900 |
commit | 3dbf035fa5866364a53e17b79172746fe7e9b11e (patch) | |
tree | d30b9429d3bec3afaf735621b8134dc4e8687c6e /MySQLdb/connections.py | |
parent | c8b2744ea2b1e4419b7e3d93928e92c95f366815 (diff) | |
download | mysqldb1-3dbf035fa5866364a53e17b79172746fe7e9b11e.tar.gz |
More precise get_autocommit based on server_status.
Diffstat (limited to 'MySQLdb/connections.py')
-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): """ |