all repos — litestore @ 5fab9e284cfe22fb2435be396c4a45af23267baa

A minimalist nosql document store.

Closes #37.
h3rald h3rald@h3rald.com
Sun, 08 May 2016 13:55:59 +0200
commit

5fab9e284cfe22fb2435be396c4a45af23267baa

parent

d1fb3abac771f07f6259e1f645242fef8dd69aba

1 files changed, 5 insertions(+), 4 deletions(-)

jump to
M lib/utils.nimlib/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("'", "''") & "' "