Skip to content

Commit 36c28b8

Browse files
rybeshymph
authored andcommitted
Propagate the fix to the py3compat version.
1 parent 7208cbd commit 36c28b8

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

rdflib_sqlalchemy/SQLAlchemy.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -327,11 +327,16 @@ def pycompat_executeSQL(self, connection, qStr, params=None, paramList=False):
327327
except:
328328
pass
329329

330-
def locproc(item):
330+
def py_to_sql(param):
331+
if param is None:
332+
return 'NULL'
333+
if isinstance(param, int):
334+
return param
331335
try:
332-
return "'%s'" % item.decode()
336+
return "'%s'" % param.decode()
333337
except:
334-
return item
338+
return param
339+
335340
# _logger.debug("SQLGenerator %s - %s" % (qStr,params))
336341
if not params:
337342
querystr = qStr.replace('"', "'")
@@ -344,7 +349,7 @@ def locproc(item):
344349
elif paramList:
345350
raise Exception("Not supported!")
346351
else:
347-
params = tuple([locproc(item) for item in params])
352+
params = tuple(map(py_to_sql, params))
348353
querystr = qStr.replace('"', "'")
349354
querystr = querystr % params
350355
# if isinstance(qStr, bytes): qStr = qStr.decode()

0 commit comments

Comments
 (0)