diff options
author | James Ahlborn <jtahlborn@yahoo.com> | 2018-07-14 03:05:57 +0000 |
---|---|---|
committer | James Ahlborn <jtahlborn@yahoo.com> | 2018-07-14 03:05:57 +0000 |
commit | 0dc74ed6799971c4cdcb8470bf94c59f4259a9ed (patch) | |
tree | 10c81d33b380967026e1cdc609d39b8496833f49 /src/main/java/com/healthmarketscience/jackcess/impl/expr | |
parent | 62f72892480c45b56d1880891478e6a9757a3779 (diff) | |
download | jackcess-0dc74ed6799971c4cdcb8470bf94c59f4259a9ed.tar.gz jackcess-0dc74ed6799971c4cdcb8470bf94c59f4259a9ed.zip |
fix handling of certain field validator expressions; add some tests for various expressions
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@1180 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/Expressionator.java | 27 |
1 files changed, 16 insertions, 11 deletions
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 4988f3e..c9af948 100644 --- a/src/main/java/com/healthmarketscience/jackcess/impl/expr/Expressionator.java +++ b/src/main/java/com/healthmarketscience/jackcess/impl/expr/Expressionator.java @@ -434,12 +434,12 @@ public class Expressionator // normal expression handling Expr expr = parseExpression(buf, false); - if((exprType == Type.FIELD_VALIDATOR) && !expr.isConditionalExpr()) { - // a non-conditional expression for a FIELD_VALIDATOR treats the result - // as an equality comparison with the field in question. so, transform - // the expression accordingly - expr = new EImplicitCompOp(expr); - } + if((exprType == Type.FIELD_VALIDATOR) && !expr.isValidationExpr()) { + // a non-validation expression for a FIELD_VALIDATOR treats the result + // as an equality comparison with the field in question. so, transform + // the expression accordingly + expr = new EImplicitCompOp(expr); + } switch(exprType) { case DEFAULT_VALUE: @@ -1387,7 +1387,7 @@ public class Expressionator return sb.toString(); } - protected boolean isConditionalExpr() { + protected boolean isValidationExpr() { return false; } @@ -1596,8 +1596,8 @@ public class Expressionator } @Override - protected boolean isConditionalExpr() { - return _expr.isConditionalExpr(); + protected boolean isValidationExpr() { + return _expr.isValidationExpr(); } @Override @@ -1776,7 +1776,7 @@ public class Expressionator } @Override - protected boolean isConditionalExpr() { + protected boolean isValidationExpr() { return true; } @@ -1811,6 +1811,11 @@ public class Expressionator } @Override + protected boolean isValidationExpr() { + return true; + } + + @Override public Value eval(final EvalContext ctx) { // logical operations do short circuit evaluation, so we need to delay @@ -1854,7 +1859,7 @@ public class Expressionator } @Override - protected boolean isConditionalExpr() { + protected boolean isValidationExpr() { return true; } } |