Closes #37.
h3rald h3rald@h3rald.com
Sun, 08 May 2016 13:55:59 +0200
1 files changed,
5 insertions(+),
4 deletions(-)
jump to
M
lib/utils.nim
→
lib/utils.nim
@@ -64,14 +64,15 @@ result = result & options.select.join(", ")
result = result & " FROM documents WHERE 1=1 " if options.single: result = result & "AND id = ?" - if options.folder.len > 0: - result = result & "AND id LIKE ?" - if options.tags.len > 0: - var doc_id_col: string + var doc_id_col: string + if options.tags.len > 0 or options.folder.len > 0: if options.search.len > 0 and options.select[0] != "COUNT(docid)": doc_id_col = "documents.id" else: doc_id_col = "id" + if options.folder.len > 0: + result = result & "AND " & doc_id_col & " LIKE ? " + if options.tags.len > 0: result = result & options.tags.selectDocumentsByTags(doc_id_col) if options.search.len > 0: result = result & "AND searchdata MATCH '" & options.search.replace("'", "''") & "' "