Search in sources :

Example 1 with ASTBitwiseOr

use of org.apache.cayenne.exp.parser.ASTBitwiseOr in project cayenne by apache.

the class SelectQueryReturnTypesIT method testSelectBitwiseOr.

@Test
public void testSelectBitwiseOr() throws Exception {
    if (!accessStackAdapter.supportsBitwiseOps()) {
        return;
    }
    createNumericsDataSet();
    // to simplify result checking, do double NOT
    Expression left = new ASTBitwiseOr(new Object[] { new ASTObjPath(ReturnTypesMap1.INTEGER_COLUMN.getName()), new ASTScalar(1) });
    Expression right = new ASTScalar(1);
    Expression equal = new ASTEqual();
    equal.setOperand(0, left);
    equal.setOperand(1, right);
    List<ReturnTypesMap1> objects = ObjectSelect.query(ReturnTypesMap1.class, equal).select(context);
    assertEquals(2, objects.size());
}
Also used : ASTObjPath(org.apache.cayenne.exp.parser.ASTObjPath) ReturnTypesMap1(org.apache.cayenne.testdo.return_types.ReturnTypesMap1) Expression(org.apache.cayenne.exp.Expression) ASTEqual(org.apache.cayenne.exp.parser.ASTEqual) ASTBitwiseOr(org.apache.cayenne.exp.parser.ASTBitwiseOr) ASTScalar(org.apache.cayenne.exp.parser.ASTScalar) Test(org.junit.Test)

Aggregations

Expression (org.apache.cayenne.exp.Expression)1 ASTBitwiseOr (org.apache.cayenne.exp.parser.ASTBitwiseOr)1 ASTEqual (org.apache.cayenne.exp.parser.ASTEqual)1 ASTObjPath (org.apache.cayenne.exp.parser.ASTObjPath)1 ASTScalar (org.apache.cayenne.exp.parser.ASTScalar)1 ReturnTypesMap1 (org.apache.cayenne.testdo.return_types.ReturnTypesMap1)1 Test (org.junit.Test)1