Skip to content

Commit

Permalink
Fix utils.
Browse files Browse the repository at this point in the history
  • Loading branch information
ej2 committed Aug 28, 2023
1 parent 8dbbb55 commit 2709f02
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions quickbooks/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ def build_where_clause(**kwargs):
where = []

for key, value in kwargs.items():
where.append("{0} = {1}".format(key, value))
if isinstance(value, str):
where.append("{0} = '{1}'".format(key, value.replace(r"'", r"\'")))
else:
where.append("{0} = {1}".format(key, value))

where_clause = " AND ".join(where)

Expand All @@ -19,7 +22,10 @@ def build_choose_clause(choices, field):
where = []

for choice in choices:
where.append("{0}".format(choice))
if isinstance(choice, str):
where.append("'{0}'".format(choice.replace(r"'", r"\'")))
else:
where.append("{0}".format(choice))

where_clause = ", ".join(where)
where_clause = "{0} in ({1})".format(field, where_clause)
Expand Down

0 comments on commit 2709f02

Please sign in to comment.