]> source.dussan.org Git - jackcess.git/commitdiff
implement more operations
authorJames Ahlborn <jtahlborn@yahoo.com>
Thu, 15 Dec 2016 04:09:08 +0000 (04:09 +0000)
committerJames Ahlborn <jtahlborn@yahoo.com>
Thu, 15 Dec 2016 04:09:08 +0000 (04:09 +0000)
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/branches/exprs@1070 f203690c-595d-4dc9-a70b-905162fa7fd2

src/main/java/com/healthmarketscience/jackcess/impl/expr/BuiltinOperators.java

index 040bcf179a7898ab71e220222996f9aea707bbcd..3b952ed119812eaf772dbd138acbf95132e54564 100644 (file)
@@ -490,14 +490,22 @@ public class BuiltinOperators
   }
 
   public static Value between(Value param1, Value param2, Value param3) {
-    // FIXME, use delay for and() or check here?
     // null propagate any param.  uses short circuit eval of params
     if(anyParamIsNull(param1, param2, param3)) {
       // null propagation
       return NULL_VAL;
     }
 
-    return and(greaterThanEq(param1, param2), lessThanEq(param1, param3));
+    // the between values can be in either order!?!
+    Value min = param2;
+    Value max = param3;
+    Value gt = greaterThan(min, max);
+    if(gt.getAsBoolean()) {
+      min = param3;
+      max = param2;
+    }
+
+    return and(greaterThanEq(param1, min), lessThanEq(param1, max));
   }
 
   public static Value notBetween(Value param1, Value param2, Value param3) {
@@ -517,11 +525,13 @@ public class BuiltinOperators
         continue;
       }
 
-      // FIXME test
+      Value eq = equals(param1, val);
+      if(eq.getAsBoolean()) {
+        return TRUE_VAL;
+      }
     }
 
-    // FIXME
-    return null;
+    return FALSE_VAL;
   }
 
   public static Value notIn(Value param1, Value[] params) {