From 284b3221a2c17af5bfe2edbf851ac0a9901f91a0 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Wed, 5 Dec 2018 13:14:47 -0500 Subject: [PATCH] Fixed #30013 -- Fixed DatabaseOperations.last_executed_query() with mysqlclient 1.3.14+. --- django/db/backends/mysql/operations.py | 4 ++-- django/db/backends/oracle/operations.py | 2 +- docs/releases/2.1.5.txt | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/django/db/backends/mysql/operations.py b/django/db/backends/mysql/operations.py index 1414520effc..43f4f748d4e 100644 --- a/django/db/backends/mysql/operations.py +++ b/django/db/backends/mysql/operations.py @@ -138,10 +138,10 @@ class DatabaseOperations(BaseDatabaseOperations): return [(None, ("NULL", [], False))] def last_executed_query(self, cursor, sql, params): - # With MySQLdb, cursor objects have an (undocumented) "_last_executed" + # With MySQLdb, cursor objects have an (undocumented) "_executed" # attribute where the exact query sent to the database is saved. # See MySQLdb/cursors.py in the source distribution. - query = getattr(cursor, '_last_executed', None) + query = getattr(cursor, '_executed', None) if query is not None: query = query.decode(errors='replace') return query diff --git a/django/db/backends/oracle/operations.py b/django/db/backends/oracle/operations.py index 16955630bf2..40a1f730ce3 100644 --- a/django/db/backends/oracle/operations.py +++ b/django/db/backends/oracle/operations.py @@ -258,7 +258,7 @@ END; # https://cx-oracle.readthedocs.io/en/latest/cursor.html#Cursor.statement # The DB API definition does not define this attribute. statement = cursor.statement - # Unlike Psycopg's `query` and MySQLdb`'s `_last_executed`, CxOracle's + # Unlike Psycopg's `query` and MySQLdb`'s `_executed`, CxOracle's # `statement` doesn't contain the query parameters. refs #20010. return super().last_executed_query(cursor, statement, params) diff --git a/docs/releases/2.1.5.txt b/docs/releases/2.1.5.txt index bf645c0cfd8..25ec9fb8042 100644 --- a/docs/releases/2.1.5.txt +++ b/docs/releases/2.1.5.txt @@ -10,4 +10,4 @@ Django 2.1.5 fixes several bugs in 2.1.4. Bugfixes ======== -* ... \ No newline at end of file +* Fixed compatibility with mysqlclient 1.3.14 (:ticket:`30013`).