Skip to content

Commit

Permalink
bug fix: invoke replace only on string arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
szampier committed Feb 7, 2024
1 parent 3cbf9d2 commit 8b84ae2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ngamsCore/ngamsLib/ngamsDbCore.py
Original file line number Diff line number Diff line change
Expand Up @@ -824,8 +824,8 @@ def _prepare_query(self, sql, args):

if not self._use_prepared_statement:
markers = ["'{}'" if isinstance(arg, str) else "NULL" if arg is None else "{}" for arg in args]
args = [arg.replace("'", "''") for arg in args]
args = list(filter(lambda x: x is not None, args))
args = list(filter(lambda arg: arg is not None, args))
args = [arg.replace("'", "''") if isinstance(arg, str) else arg for arg in args]
return sql.format(*markers).format(*args), ()

# Depending on the database vendor and its declared paramstyle
Expand Down

0 comments on commit 8b84ae2

Please sign in to comment.