From 86c20e39eb9ea0bbd25889403d16d857748aff9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anssi=20K=C3=A4=C3=A4ri=C3=A4inen?= Date: Wed, 13 Jun 2012 14:13:56 +0300 Subject: [PATCH] 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. --- django/db/backends/oracle/base.py | 2 +- tests/regressiontests/backends/tests.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/django/db/backends/oracle/base.py b/django/db/backends/oracle/base.py index 785e4b72a6..64e038e1a6 100644 --- a/django/db/backends/oracle/base.py +++ b/django/db/backends/oracle/base.py @@ -212,7 +212,7 @@ WHEN (new.%(col_name)s IS NULL) 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. - return cursor.statement + return cursor.statement.decode("utf-8") def last_insert_id(self, cursor, table_name, pk_name): sq_name = self._get_sequence_name(table_name) diff --git a/tests/regressiontests/backends/tests.py b/tests/regressiontests/backends/tests.py index cf6b964070..cf4242d62c 100644 --- a/tests/regressiontests/backends/tests.py +++ b/tests/regressiontests/backends/tests.py @@ -154,7 +154,7 @@ class LastExecutedQueryTest(TestCase): """ Test that last_executed_query() returns an Unicode string """ - tags = models.Tag.objects.filter(name="й", object_id=12).extra(select={'föö':1}) + tags = models.Tag.objects.extra(select={'föö':1}) sql, params = tags.query.sql_with_params() cursor = tags.query.get_compiler('default').execute_sql(None) last_sql = cursor.db.ops.last_executed_query(cursor, sql, params)