Allow special characters to be escaped

This commit is contained in:
luoliyan 2017-02-28 08:10:43 +09:30
parent 97f280923c
commit 491b8ea63f

View File

@ -246,10 +246,10 @@ select distinct(n.id) from cards c, notes n where c.nid=n.id and """+preds
val = val.replace("*", "%") val = val.replace("*", "%")
if not val.startswith("%"): if not val.startswith("%"):
val = "% " + val val = "% " + val
if not val.endswith("%"): if not val.endswith("%") or val.endswith('\\%'):
val += " %" val += " %"
args.append(val) args.append(val)
return "n.tags like ?" return "n.tags like ? escape '\\'"
def _findCardState(self, args): def _findCardState(self, args):
(val, args) = args (val, args) = args