Fixed #30013 -- Fixed DatabaseOperations.last_executed_query() with mysqlclient 1.3.14+.

This commit is contained in:
Tim Graham 2018-12-05 13:14:47 -05:00
parent fbc7e41389
commit 284b3221a2
3 changed files with 4 additions and 4 deletions

View File

@ -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

View File

@ -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)

View File

@ -10,4 +10,4 @@ Django 2.1.5 fixes several bugs in 2.1.4.
Bugfixes
========
* ...
* Fixed compatibility with mysqlclient 1.3.14 (:ticket:`30013`).