Skip to content

Commit

Permalink
Merge branch 'azure' into azure-1.1
Browse files Browse the repository at this point in the history
Conflicts:
	sql_server/pyodbc/base.py
  • Loading branch information
michiya committed Jan 29, 2014
2 parents e2e290b + 3295928 commit 1d3493e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sql_server/pyodbc/base.py
Expand Up @@ -20,6 +20,7 @@

from django.conf import settings
from django.db.backends import *
from django.utils.encoding import smart_str
from django.utils.functional import cached_property
from django.utils.six import binary_type, text_type
from django.utils.timezone import utc
Expand Down Expand Up @@ -390,7 +391,7 @@ def format_sql(self, sql, n_params=0):
if self.driver_needs_utf8 and isinstance(sql, text_type):
# FreeTDS (and other ODBC drivers?) doesn't support Unicode
# yet, so we need to encode the SQL clause itself in utf-8
sql = sql.encode('utf-8')
sql = smart_str(sql, 'utf-8')

# pyodbc uses '?' instead of '%s' as parameter placeholder.
if n_params > 0:
Expand All @@ -405,7 +406,7 @@ def format_params(self, params):
if self.driver_needs_utf8:
# FreeTDS (and other ODBC drivers?) doesn't support Unicode
# yet, so we need to encode parameters in utf-8
fp.append(p.encode('utf-8'))
fp.append(smart_str(p, 'utf-8'))
else:
fp.append(p)

Expand Down

0 comments on commit 1d3493e

Please sign in to comment.