From 820f44da14822653a96a31c078433092e1008453 Mon Sep 17 00:00:00 2001 From: James Ahlborn Date: Thu, 15 Dec 2016 04:09:08 +0000 Subject: [PATCH] implement more operations git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/branches/exprs@1070 f203690c-595d-4dc9-a70b-905162fa7fd2 --- .../jackcess/impl/expr/BuiltinOperators.java | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/healthmarketscience/jackcess/impl/expr/BuiltinOperators.java b/src/main/java/com/healthmarketscience/jackcess/impl/expr/BuiltinOperators.java index 040bcf1..3b952ed 100644 --- a/src/main/java/com/healthmarketscience/jackcess/impl/expr/BuiltinOperators.java +++ b/src/main/java/com/healthmarketscience/jackcess/impl/expr/BuiltinOperators.java @@ -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) { -- 2.39.5