Kaydet (Commit) 10849069 authored tarafından Tim Graham's avatar Tim Graham

[2.1.x] Fixed #30013 -- Fixed DatabaseOperations.last_executed_query() with mysqlclient 1.3.14+.

Backport of 284b3221 from master.
üst 87874458
...@@ -132,10 +132,10 @@ class DatabaseOperations(BaseDatabaseOperations): ...@@ -132,10 +132,10 @@ class DatabaseOperations(BaseDatabaseOperations):
return [(None, ("NULL", [], False))] return [(None, ("NULL", [], False))]
def last_executed_query(self, cursor, sql, params): 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. # attribute where the exact query sent to the database is saved.
# See MySQLdb/cursors.py in the source distribution. # See MySQLdb/cursors.py in the source distribution.
return force_text(getattr(cursor, '_last_executed', None), errors='replace') return force_text(getattr(cursor, '_executed', None), errors='replace')
def no_limit_value(self): def no_limit_value(self):
# 2**64 - 1, as recommended by the MySQL documentation # 2**64 - 1, as recommended by the MySQL documentation
......
...@@ -254,7 +254,7 @@ END; ...@@ -254,7 +254,7 @@ END;
# https://cx-oracle.readthedocs.io/en/latest/cursor.html#Cursor.statement # https://cx-oracle.readthedocs.io/en/latest/cursor.html#Cursor.statement
# The DB API definition does not define this attribute. # The DB API definition does not define this attribute.
statement = cursor.statement 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. # `statement` doesn't contain the query parameters. refs #20010.
return super().last_executed_query(cursor, statement, params) return super().last_executed_query(cursor, statement, params)
......
...@@ -10,4 +10,4 @@ Django 2.1.5 fixes several bugs in 2.1.4. ...@@ -10,4 +10,4 @@ Django 2.1.5 fixes several bugs in 2.1.4.
Bugfixes Bugfixes
======== ========
* ... * Fixed compatibility with mysqlclient 1.3.14 (:ticket:`30013`).
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment