changeset 15:9fb0d4f24486

comments with a bit of documentation
author casties
date Thu, 17 Nov 2011 14:06:52 +0100
parents 9cea47dc6926
children 5b99c04c567c
files ZDBInterfaceFolder.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ZDBInterfaceFolder.py	Thu Nov 10 19:59:59 2011 +0100
+++ b/ZDBInterfaceFolder.py	Thu Nov 17 14:06:52 2011 +0100
@@ -88,23 +88,26 @@
                 wheres.append(param + " ILIKE %s")
                 args.append("%" + val + "%")
             elif op == "all":
+                # p="a b c" -> WHERE (p ILIKE '%a%' AND p ILIKE '%b%' AND p ILIKE '%c%')
                 words = []
                 for word in val.split(" "):
                     words.append(param + " ILIKE %s")
                     args.append("%" + word + "%")
                 wheres.append("(" + " AND ".join(words) + ")")
             elif op == "one":
+                # p="a b c" -> WHERE (p ILIKE '%a%' OR p ILIKE '%b%' OR p ILIKE '%c%')
                 words = []
                 for word in val.split(" "):
                     words.append(param + " ILIKE %s")
                     args.append("%" + word + "%")
                 wheres.append("(" + " OR ".join(words) + ")")
             elif op == "in":
+                # p="a b c" -> WHERE p IN ('a', 'b', 'c')
                 words = []
                 for word in val.split(" "):
                     words.append("%s")
                     args.append(word)
-                wheres.append(param + " in (" + ", ".join(words) + ")")
+                wheres.append(param + " IN (" + ", ".join(words) + ")")
             else:
                 logging.error("getSQLquery: unknown op=%s!"%op)