Fix named db query list parameters when query ends with parameter

This commit is contained in:
shortcutme 2018-01-05 20:22:25 +01:00
parent 520fd6e063
commit a3a7af73bd
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE

View file

@ -56,7 +56,7 @@ class DbCursor:
new_params[key + "__" + str(idx)] = val
new_names = [":" + key + "__" + str(idx) for idx in range(len(value))]
query = re.sub(r":" + re.escape(key) + r"([)\s])", ", ".join(new_names) + r"\1", query)
query = re.sub(r":" + re.escape(key) + r"([)\s]|$)", "(%s)%s" % (", ".join(new_names), r"\1"), query)
else:
new_params[key] = value