Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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
@akaariai akaariai authored
View
2  django/db/backends/oracle/base.py
@@ -212,7 +212,7 @@ 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.
- 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)
View
2  tests/regressiontests/backends/tests.py
@@ -154,7 +154,7 @@ def test_query_encoding(self):
"""
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)

0 comments on commit 86c20e3

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