refactor(archive): sqlite query optimization. replace or-ed equal conditions list with in-list

This commit is contained in:
Lorenzo Delgado 2023-01-25 16:52:13 +01:00 committed by GitHub
parent 9949996ed7
commit 61e68da89e

View File

@ -255,10 +255,10 @@ proc whereClause(cursor: Option[DbCursor],
let contentTopicClause = if contentTopic.len <= 0: let contentTopicClause = if contentTopic.len <= 0:
none(string) none(string)
else: else:
var where = "(" var where = "contentTopic IN ("
where &= "contentTopic = (?)" where &= "?"
for _ in contentTopic[1..^1]: for _ in 1..<contentTopic.len:
where &= " OR contentTopic = (?)" where &= ", ?"
where &= ")" where &= ")"
some(where) some(where)