use of com.blazebit.persistence.parser.predicate.BetweenPredicate in project blaze-persistence by Blazebit.
the class GeneralParserTest method testNotBetweenDate.
@Test
public void testNotBetweenDate() {
GeneralCaseExpression result = (GeneralCaseExpression) parse("CASE WHEN a.x NOT BETWEEN {d '1991-05-21'} AND {d '1991-05-22'} THEN 0 ELSE 1 END");
GeneralCaseExpression expected = new GeneralCaseExpression(Arrays.asList(new WhenClauseExpression(new BetweenPredicate(path("a", "x"), _date(1991, 5, 21), _date(1991, 5, 22), true), _int("0"))), _int("1"));
assertEquals(expected, result);
}
use of com.blazebit.persistence.parser.predicate.BetweenPredicate in project blaze-persistence by Blazebit.
the class GeneralParserTest method testNotBetweenString.
@Test
public void testNotBetweenString() {
GeneralCaseExpression result = (GeneralCaseExpression) parse("CASE WHEN a.x NOT BETWEEN 'ab' AND 'zb' THEN 0 ELSE 1 END");
GeneralCaseExpression expected = new GeneralCaseExpression(Arrays.asList(new WhenClauseExpression(new BetweenPredicate(path("a", "x"), _string("ab"), _string("zb"), true), _int("0"))), _int("1"));
assertEquals(expected, result);
}
use of com.blazebit.persistence.parser.predicate.BetweenPredicate in project blaze-persistence by Blazebit.
the class GeneralParserTest method testBetweenString.
@Test
public void testBetweenString() {
GeneralCaseExpression result = (GeneralCaseExpression) parse("CASE WHEN a.x BETWEEN 'ab' AND 'zb' THEN 0 ELSE 1 END");
GeneralCaseExpression expected = new GeneralCaseExpression(Arrays.asList(new WhenClauseExpression(new BetweenPredicate(path("a", "x"), _string("ab"), _string("zb")), _int("0"))), _int("1"));
assertEquals(expected, result);
}
use of com.blazebit.persistence.parser.predicate.BetweenPredicate in project blaze-persistence by Blazebit.
the class GeneralParserTest method testBetweenDate.
@Test
public void testBetweenDate() {
GeneralCaseExpression result = (GeneralCaseExpression) parse("CASE WHEN a.x BETWEEN {d '1991-05-21'} AND {d '1991-05-22'} THEN 0 ELSE 1 END");
GeneralCaseExpression expected = new GeneralCaseExpression(Arrays.asList(new WhenClauseExpression(new BetweenPredicate(path("a", "x"), _date(1991, 5, 21), _date(1991, 5, 22)), _int("0"))), _int("1"));
assertEquals(expected, result);
}
use of com.blazebit.persistence.parser.predicate.BetweenPredicate in project blaze-persistence by Blazebit.
the class BetweenBuilderImpl method andSubqery.
@Override
public SubqueryInitiator<T> andSubqery(String subqueryAlias, String expression) {
verifySubqueryBuilderEnded();
SubqueryBuilderListenerImpl<T> superExpressionSubqueryListener = new SuperExpressionSubqueryBuilderListener<T>(subqueryAlias, expressionFactory.createSimpleExpression(expression)) {
@Override
public void onBuilderEnded(SubqueryInternalBuilder<T> builder) {
super.onBuilderEnded(builder);
predicate = new BetweenPredicate(left, start, superExpression, negated);
listener.onBuilderEnded(BetweenBuilderImpl.this);
}
};
return startSubqueryInitiator(subqueryInitFactory.createSubqueryInitiator(result, superExpressionSubqueryListener, false, clauseType));
}
Aggregations