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 b84c54bbcb
commit 8c7a931f65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

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