Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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 authored

Showing 1 changed file with 7 additions and 10 deletions. Show diff stats Hide diff stats

  1. 17  django/db/backends/oracle/base.py
17  django/db/backends/oracle/base.py
@@ -5,7 +5,6 @@
5 5
 """
6 6
 from __future__ import unicode_literals
7 7
 
8  
-import datetime
9 8
 import decimal
10 9
 import re
11 10
 import sys
@@ -45,16 +44,13 @@ def _setup_environment(environ):
45 44
     from django.core.exceptions import ImproperlyConfigured
46 45
     raise ImproperlyConfigured("Error loading cx_Oracle module: %s" % e)
47 46
 
48  
-from django.conf import settings
49 47
 from django.db import utils
50 48
 from django.db.backends import *
51 49
 from django.db.backends.oracle.client import DatabaseClient
52 50
 from django.db.backends.oracle.creation import DatabaseCreation
53 51
 from django.db.backends.oracle.introspection import DatabaseIntrospection
54 52
 from django.utils.encoding import force_bytes, force_text
55  
-from django.utils.functional import cached_property
56  
-from django.utils import six
57  
-from django.utils import timezone
  53
+
58 54
 
59 55
 DatabaseError = Database.DatabaseError
60 56
 IntegrityError = Database.IntegrityError
@@ -267,11 +263,12 @@ def field_cast_sql(self, db_type):
267 263
     def last_executed_query(self, cursor, sql, params):
268 264
         # http://cx-oracle.sourceforge.net/html/cursor.html#Cursor.statement
269 265
         # The DB API definition does not define this attribute.
270  
-        if six.PY3:
271  
-            return cursor.statement
272  
-        else:
273  
-            query = cursor.statement
274  
-            return query if isinstance(query, unicode) else query.decode("utf-8")
  266
+        statement = cursor.statement
  267
+        if not six.PY3 and not isinstance(statement, unicode):
  268
+            statement = statement.decode('utf-8')
  269
+        # Unlike Psycopg's `query` and MySQLdb`'s `_last_executed`, CxOracle's
  270
+        # `statement` doesn't contain the query parameters. refs #20010.
  271
+        return super(DatabaseOperations, self).last_executed_query(cursor, statement, params)
275 272
 
276 273
     def last_insert_id(self, cursor, table_name, pk_name):
277 274
         sq_name = self._get_sequence_name(table_name)

0 notes on commit bc7a102

Please sign in to comment.
Something went wrong with that request. Please try again.