Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f0188de

Browse files
author
Masse
committed
Move the two lines to the end of the format_sql method.
1 parent 4073980 commit f0188de

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

django_pyodbc/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,8 @@ def format_sql(self, sql, n_params=None):
454454
else:
455455
if '%s' in sql:
456456
sql = sql.replace('%s', '?')
457+
if sys.version.startswith('3') and type(sql) is not str:
458+
sql = sql.decode(self.encoding or sys.stdout.encoding)
457459
return sql
458460

459461
def format_params(self, params):
@@ -483,8 +485,6 @@ def format_params(self, params):
483485
def execute(self, sql, params=()):
484486
self.last_sql = sql
485487
sql = self.format_sql(sql, len(params))
486-
if sys.version.startswith('3') and type(sql) is not str:
487-
sql = sql.decode(sys.stdout.encoding)
488488
params = self.format_params(params)
489489
self.last_params = params
490490
try:

0 commit comments

Comments
 (0)