1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

Fixed #18592 -- Prevented crash when accessing MySQL _last_executed

Thanks reames at asymmetricventures.com for the report.
This commit is contained in:
Claude Paroz
2013-06-29 18:44:41 +02:00
parent 7fbab3ebaf
commit 59b0c48ce2
2 changed files with 12 additions and 1 deletions

View File

@@ -284,7 +284,7 @@ class DatabaseOperations(BaseDatabaseOperations):
# With MySQLdb, cursor objects have an (undocumented) "_last_executed"
# attribute where the exact query sent to the database is saved.
# See MySQLdb/cursors.py in the source distribution.
return force_text(cursor._last_executed, errors='replace')
return force_text(getattr(cursor, '_last_executed', None), errors='replace')
def no_limit_value(self):
# 2**64 - 1, as recommended by the MySQL documentation