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.
This commit is contained in:
Anssi Kääriäinen 2012-06-13 14:13:56 +03:00
parent e9ef9776d1
commit 86c20e39eb
2 changed files with 2 additions and 2 deletions

View File

@ -212,7 +212,7 @@ WHEN (new.%(col_name)s IS NULL)
def last_executed_query(self, cursor, sql, params): def last_executed_query(self, cursor, sql, params):
# http://cx-oracle.sourceforge.net/html/cursor.html#Cursor.statement # http://cx-oracle.sourceforge.net/html/cursor.html#Cursor.statement
# The DB API definition does not define this attribute. # 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): def last_insert_id(self, cursor, table_name, pk_name):
sq_name = self._get_sequence_name(table_name) sq_name = self._get_sequence_name(table_name)

View File

@ -154,7 +154,7 @@ class LastExecutedQueryTest(TestCase):
""" """
Test that last_executed_query() returns an Unicode string 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() sql, params = tags.query.sql_with_params()
cursor = tags.query.get_compiler('default').execute_sql(None) cursor = tags.query.get_compiler('default').execute_sql(None)
last_sql = cursor.db.ops.last_executed_query(cursor, sql, params) last_sql = cursor.db.ops.last_executed_query(cursor, sql, params)