Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #20010 -- Make sure `last_executed_query` contains it's associa…

…ted parameters on Oracle.

Also removed some unused imports.
  • Loading branch information...
commit bc7a10299f7ad7f468fa78d5990b7b545d4d599d 1 parent 1b12e24
Simon Charette charettes authored
Showing with 7 additions and 10 deletions.
  1. +7 −10 django/db/backends/oracle/base.py
17 django/db/backends/oracle/base.py
View
@@ -5,7 +5,6 @@
"""
from __future__ import unicode_literals
-import datetime
import decimal
import re
import sys
@@ -45,16 +44,13 @@ def _setup_environment(environ):
from django.core.exceptions import ImproperlyConfigured
raise ImproperlyConfigured("Error loading cx_Oracle module: %s" % e)
-from django.conf import settings
from django.db import utils
from django.db.backends import *
from django.db.backends.oracle.client import DatabaseClient
from django.db.backends.oracle.creation import DatabaseCreation
from django.db.backends.oracle.introspection import DatabaseIntrospection
from django.utils.encoding import force_bytes, force_text
-from django.utils.functional import cached_property
-from django.utils import six
-from django.utils import timezone
+
DatabaseError = Database.DatabaseError
IntegrityError = Database.IntegrityError
@@ -267,11 +263,12 @@ def field_cast_sql(self, db_type):
def last_executed_query(self, cursor, sql, params):
# http://cx-oracle.sourceforge.net/html/cursor.html#Cursor.statement
# The DB API definition does not define this attribute.
- if six.PY3:
- return cursor.statement
- else:
- query = cursor.statement
- return query if isinstance(query, unicode) else query.decode("utf-8")
+ statement = cursor.statement
+ if not six.PY3 and not isinstance(statement, unicode):
+ statement = statement.decode('utf-8')
+ # Unlike Psycopg's `query` and MySQLdb`'s `_last_executed`, CxOracle's
+ # `statement` doesn't contain the query parameters. refs #20010.
+ return super(DatabaseOperations, self).last_executed_query(cursor, statement, params)
def last_insert_id(self, cursor, table_name, pk_name):
sq_name = self._get_sequence_name(table_name)
Please sign in to comment.
Something went wrong with that request. Please try again.