Search in sources :

Example 1 with ASTBitwiseAnd

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

the class SelectQueryReturnTypesIT method testSelectBitwiseAnd.

@Test
public void testSelectBitwiseAnd() throws Exception {
    if (!accessStackAdapter.supportsBitwiseOps()) {
        return;
    }
    createNumericsDataSet();
    // to simplify result checking, do double NOT
    Expression left = new ASTBitwiseAnd(new Object[] { new ASTObjPath(ReturnTypesMap1.INTEGER_COLUMN.getName()), new ASTScalar(1) });
    Expression right = new ASTScalar(0);
    Expression equal = new ASTEqual();
    equal.setOperand(0, left);
    equal.setOperand(1, right);
    List<ReturnTypesMap1> objects = ObjectSelect.query(ReturnTypesMap1.class, equal).select(context);
    assertEquals(3, 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) ASTBitwiseAnd(org.apache.cayenne.exp.parser.ASTBitwiseAnd) ASTScalar(org.apache.cayenne.exp.parser.ASTScalar) Test(org.junit.Test)

Aggregations

Expression (org.apache.cayenne.exp.Expression)1 ASTBitwiseAnd (org.apache.cayenne.exp.parser.ASTBitwiseAnd)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