Use WHERE 1 for queries without argument
This commit is contained in:
parent
ca473d6c3b
commit
38c663ee95
1 changed files with 3 additions and 1 deletions
|
@ -32,7 +32,9 @@ class DbCursor:
|
|||
query_wheres.append(key + " = ?")
|
||||
values.append(value)
|
||||
wheres = " AND ".join(query_wheres)
|
||||
query = re.sub("(.*)[?]", "\\1%s" % wheres, query) # Replace the last ?
|
||||
if wheres == "":
|
||||
wheres = "1"
|
||||
query = re.sub("(.*)[?]", "\\1 %s" % wheres, query) # Replace the last ?
|
||||
params = values
|
||||
else:
|
||||
# Convert param dict to INSERT INTO table (key, key2) VALUES (?, ?) format
|
||||
|
|
Loading…
Reference in a new issue