Search in sources :

Example 11 with ASTEqual

use of org.apache.cayenne.exp.parser.ASTEqual 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

ASTEqual (org.apache.cayenne.exp.parser.ASTEqual)11 Test (org.junit.Test)8 ASTObjPath (org.apache.cayenne.exp.parser.ASTObjPath)7 Expression (org.apache.cayenne.exp.Expression)6 ASTScalar (org.apache.cayenne.exp.parser.ASTScalar)4 ASTPath (org.apache.cayenne.exp.parser.ASTPath)3 ReturnTypesMap1 (org.apache.cayenne.testdo.return_types.ReturnTypesMap1)3 ASTDbPath (org.apache.cayenne.exp.parser.ASTDbPath)2 ASTNotEqual (org.apache.cayenne.exp.parser.ASTNotEqual)2 SimpleNode (org.apache.cayenne.exp.parser.SimpleNode)2 Artist (org.apache.cayenne.testdo.testmap.Artist)2 ArrayList (java.util.ArrayList)1 ObjectId (org.apache.cayenne.ObjectId)1 ASTBitwiseAnd (org.apache.cayenne.exp.parser.ASTBitwiseAnd)1 ASTBitwiseOr (org.apache.cayenne.exp.parser.ASTBitwiseOr)1 ASTBitwiseXor (org.apache.cayenne.exp.parser.ASTBitwiseXor)1 ASTEnclosingObject (org.apache.cayenne.exp.parser.ASTEnclosingObject)1 ASTFullObject (org.apache.cayenne.exp.parser.ASTFullObject)1 ASTTrue (org.apache.cayenne.exp.parser.ASTTrue)1