aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/com/healthmarketscience/jackcess/impl/expr
diff options
context:
space:
mode:
authorJames Ahlborn <jtahlborn@yahoo.com>2018-07-01 04:53:06 +0000
committerJames Ahlborn <jtahlborn@yahoo.com>2018-07-01 04:53:06 +0000
commit17d5d661ac7d4ca3f59747b9f6a992b16ea8e3cd (patch)
tree098d50f3df1266025908a47903a871b02d7c2818 /src/main/java/com/healthmarketscience/jackcess/impl/expr
parent0a182fbac9910fa434b2557064673ccfa75174f0 (diff)
downloadjackcess-17d5d661ac7d4ca3f59747b9f6a992b16ea8e3cd.tar.gz
jackcess-17d5d661ac7d4ca3f59747b9f6a992b16ea8e3cd.zip
add more tests; add not like
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@1178 f203690c-595d-4dc9-a70b-905162fa7fd2
Diffstat (limited to 'src/main/java/com/healthmarketscience/jackcess/impl/expr')
-rw-r--r--src/main/java/com/healthmarketscience/jackcess/impl/expr/BuiltinOperators.java4
-rw-r--r--src/main/java/com/healthmarketscience/jackcess/impl/expr/Expressionator.java12
2 files changed, 15 insertions, 1 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 e0f6e25..407ec52 100644
--- a/src/main/java/com/healthmarketscience/jackcess/impl/expr/BuiltinOperators.java
+++ b/src/main/java/com/healthmarketscience/jackcess/impl/expr/BuiltinOperators.java
@@ -485,6 +485,10 @@ public class BuiltinOperators
return toValue(pattern.matcher(param1.getAsString()).matches());
}
+ public static Value notLike(Value param1, Pattern pattern) {
+ return not(like(param1, pattern));
+ }
+
public static Value between(Value param1, Value param2, Value param3) {
// null propagate any param. uses short circuit eval of params
if(anyParamIsNull(param1, param2, param3)) {
diff --git a/src/main/java/com/healthmarketscience/jackcess/impl/expr/Expressionator.java b/src/main/java/com/healthmarketscience/jackcess/impl/expr/Expressionator.java
index 7bd7396..96deb27 100644
--- a/src/main/java/com/healthmarketscience/jackcess/impl/expr/Expressionator.java
+++ b/src/main/java/com/healthmarketscience/jackcess/impl/expr/Expressionator.java
@@ -325,6 +325,11 @@ public class Expressionator
return BuiltinOperators.like(param1, (Pattern)param2);
}
},
+ NOT_LIKE("Not Like") {
+ @Override public Value eval(Value param1, Object param2, Object param3) {
+ return BuiltinOperators.notLike(param1, (Pattern)param2);
+ }
+ },
BETWEEN("Between") {
@Override public Value eval(Value param1, Object param2, Object param3) {
return BuiltinOperators.between(param1, (Value)param2, (Value)param3);
@@ -371,7 +376,8 @@ public class Expressionator
new OpType[]{BinaryOp.PLUS, BinaryOp.MINUS},
new OpType[]{BinaryOp.CONCAT},
new OpType[]{CompOp.LT, CompOp.GT, CompOp.NE, CompOp.LTE, CompOp.GTE,
- CompOp.EQ, SpecOp.LIKE, SpecOp.IS_NULL, SpecOp.IS_NOT_NULL},
+ CompOp.EQ, SpecOp.LIKE, SpecOp.NOT_LIKE,
+ SpecOp.IS_NULL, SpecOp.IS_NOT_NULL},
new OpType[]{UnaryOp.NOT},
new OpType[]{LogOp.AND},
new OpType[]{LogOp.OR},
@@ -846,6 +852,7 @@ public class Expressionator
break;
case LIKE:
+ case NOT_LIKE:
Token t = buf.next();
if((t.getType() != TokenType.LITERAL) ||
(t.getValueType() != Value.Type.STRING)) {
@@ -941,6 +948,9 @@ public class Expressionator
} else if(isString(t, "in")) {
buf.next();
return SpecOp.NOT_IN;
+ } else if(isString(t, "like")) {
+ buf.next();
+ return SpecOp.NOT_LIKE;
}
return SpecOp.NOT;
}