Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed connection.queries encoding handling on Oracle

In addition, removed a possibly problematic .filter() call from
backends.test_query_encoding test. It is possible the .filter could
cause collation problems on MySQL, and as it wasn't absolutely needed
for the test it seemed better to get rid of the call.

Refs #18461.
  • Loading branch information...
commit 86c20e39eb9ea0bbd25889403d16d857748aff9b 1 parent e9ef977
Anssi Kääriäinen authored June 13, 2012
2  django/db/backends/oracle/base.py
@@ -212,7 +212,7 @@ def field_cast_sql(self, db_type):
212 212
     def last_executed_query(self, cursor, sql, params):
213 213
         # http://cx-oracle.sourceforge.net/html/cursor.html#Cursor.statement
214 214
         # The DB API definition does not define this attribute.
215  
-        return cursor.statement
  215
+        return cursor.statement.decode("utf-8")
216 216
 
217 217
     def last_insert_id(self, cursor, table_name, pk_name):
218 218
         sq_name = self._get_sequence_name(table_name)
2  tests/regressiontests/backends/tests.py
@@ -154,7 +154,7 @@ def test_query_encoding(self):
154 154
         """
155 155
         Test that last_executed_query() returns an Unicode string
156 156
         """
157  
-        tags = models.Tag.objects.filter(name="й", object_id=12).extra(select={'föö':1})
  157
+        tags = models.Tag.objects.extra(select={'föö':1})
158 158
         sql, params = tags.query.sql_with_params()
159 159
         cursor = tags.query.get_compiler('default').execute_sql(None)
160 160
         last_sql = cursor.db.ops.last_executed_query(cursor, sql, params)

0 notes on commit 86c20e3

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