Search in sources :

Example 6 with ValueNode

use of org.apache.cayenne.access.sqlbuilder.sqltree.ValueNode in project cayenne by apache.

the class FirebirdSQLTreeProcessor method newSliceNode.

private InNode newSliceNode(InNode child, Node arg, ValueNode valueNode, Object slice) {
    InNode nextNode = new InNode(child.isNot());
    nextNode.addChild(arg.deepCopy());
    nextNode.addChild(new ValueNode(slice, valueNode.isArray(), valueNode.getAttribute()));
    return nextNode;
}
Also used : InNode(org.apache.cayenne.access.sqlbuilder.sqltree.InNode) ValueNode(org.apache.cayenne.access.sqlbuilder.sqltree.ValueNode)

Example 7 with ValueNode

use of org.apache.cayenne.access.sqlbuilder.sqltree.ValueNode in project cayenne by apache.

the class QualifierTranslationStageTest method perform.

@Test
public void perform() {
    QualifierTranslationStage stage = new QualifierTranslationStage();
    stage.perform(context);
    assertNotNull(context.getQualifierNode());
    // Content of "Qualifier" node:
    // 
    // OpExpression
    // /        \
    // Column     Value
    Node op = context.getQualifierNode();
    assertThat(op, instanceOf(OpExpressionNode.class));
    assertEquals(">=", ((OpExpressionNode) op).getOp());
    assertEquals(2, op.getChildrenCount());
    assertThat(op.getChild(0), instanceOf(ColumnNode.class));
    assertThat(op.getChild(1), instanceOf(ValueNode.class));
    ColumnNode columnNode = (ColumnNode) op.getChild(0);
    ValueNode valueNode = (ValueNode) op.getChild(1);
    assertEquals("path", columnNode.getColumn());
    assertEquals(10, valueNode.getValue());
}
Also used : OpExpressionNode(org.apache.cayenne.access.sqlbuilder.sqltree.OpExpressionNode) ValueNode(org.apache.cayenne.access.sqlbuilder.sqltree.ValueNode) ColumnNode(org.apache.cayenne.access.sqlbuilder.sqltree.ColumnNode) WhereNode(org.apache.cayenne.access.sqlbuilder.sqltree.WhereNode) Node(org.apache.cayenne.access.sqlbuilder.sqltree.Node) OpExpressionNode(org.apache.cayenne.access.sqlbuilder.sqltree.OpExpressionNode) ColumnNode(org.apache.cayenne.access.sqlbuilder.sqltree.ColumnNode) ValueNode(org.apache.cayenne.access.sqlbuilder.sqltree.ValueNode) Test(org.junit.Test)

Aggregations

ValueNode (org.apache.cayenne.access.sqlbuilder.sqltree.ValueNode)7 Node (org.apache.cayenne.access.sqlbuilder.sqltree.Node)5 OpExpressionNode (org.apache.cayenne.access.sqlbuilder.sqltree.OpExpressionNode)5 ColumnNode (org.apache.cayenne.access.sqlbuilder.sqltree.ColumnNode)4 InNode (org.apache.cayenne.access.sqlbuilder.sqltree.InNode)4 FunctionNode (org.apache.cayenne.access.sqlbuilder.sqltree.FunctionNode)3 LimitOffsetNode (org.apache.cayenne.access.sqlbuilder.sqltree.LimitOffsetNode)3 ArrayList (java.util.ArrayList)2 ExpressionNodeBuilder (org.apache.cayenne.access.sqlbuilder.ExpressionNodeBuilder)2 TextNode (org.apache.cayenne.access.sqlbuilder.sqltree.TextNode)2 TrimmingColumnNode (org.apache.cayenne.access.sqlbuilder.sqltree.TrimmingColumnNode)2 Test (org.junit.Test)2 EmptyNode (org.apache.cayenne.access.sqlbuilder.sqltree.EmptyNode)1 HavingNode (org.apache.cayenne.access.sqlbuilder.sqltree.HavingNode)1 WhereNode (org.apache.cayenne.access.sqlbuilder.sqltree.WhereNode)1 DerbyValueNode (org.apache.cayenne.dba.derby.sqltree.DerbyValueNode)1 FirebirdLimitNode (org.apache.cayenne.dba.firebird.sqltree.FirebirdLimitNode)1 FirebirdSubstringFunctionNode (org.apache.cayenne.dba.firebird.sqltree.FirebirdSubstringFunctionNode)1 MysqlLimitOffsetNode (org.apache.cayenne.dba.mysql.sqltree.MysqlLimitOffsetNode)1