Package org.apache.derby.iapi.sql.compile

Examples of org.apache.derby.iapi.sql.compile.NodeFactory


    String    columnName
  )
    throws StandardException
  {
    ContextManager  cm = getContextManager();
    NodeFactory    nodeFactory = getNodeFactory();

    ResultColumn  rc = (ResultColumn) nodeFactory.getNode
      (
        C_NodeTypes.RESULT_COLUMN,
        columnName,
        nodeFactory.getNode
        (
          C_NodeTypes.COLUMN_REFERENCE,
          columnName,
          tableName,
          cm
View Full Code Here


        ValueNode whereClause = null;

        TableName tableName = new TableName();
        tableName.init(schemaName , targetTableName);

        NodeFactory nodeFactory = getNodeFactory();
        FromList   fromList = (FromList) nodeFactory.getNode(C_NodeTypes.FROM_LIST, getContextManager());
        FromTable fromTable = (FromTable) nodeFactory.getNode(
                                                    C_NodeTypes.FROM_BASE_TABLE,
                                                    tableName,
                                                    null,
                                                    ReuseFactory.getInteger(FromBaseTable.DELETE),
                                                    null,
                                                    getContextManager());

    //we would like to use references index & table scan instead of
    //what optimizer says for the dependent table scan.
    Properties targetProperties = new FormatableProperties();
    targetProperties.put("index", "null");
    ((FromBaseTable) fromTable).setTableProperties(targetProperties);

        fromList.addFromTable(fromTable);
        SelectNode resultSet = (SelectNode) nodeFactory.getNode(
                                                     C_NodeTypes.SELECT_NODE,
                                                     null,
                                                     null,   /* AGGREGATE list */
                                                     fromList, /* FROM list */
                                                     whereClause, /* WHERE clause */
                                                     null, /* GROUP BY list */
                                                     null, /* having clause */
                           null, /* windows */
                           getContextManager());

        return (StatementNode) nodeFactory.getNode(
                                                    C_NodeTypes.DELETE_NODE,
                                                    tableName,
                                                    resultSet,
                                                    getContextManager());

View Full Code Here

        ValueNode whereClause = null;

        TableName tableName = new TableName();
        tableName.init(schemaName , targetTableName);

        NodeFactory nodeFactory = getNodeFactory();
        FromList   fromList = (FromList) nodeFactory.getNode(C_NodeTypes.FROM_LIST, getContextManager());
        FromTable fromTable = (FromTable) nodeFactory.getNode(
                                                    C_NodeTypes.FROM_BASE_TABLE,
                                                    tableName,
                                                    null,
                                                    ReuseFactory.getInteger(FromBaseTable.DELETE),
                                                    null,
                                                    getContextManager());


    //we would like to use references index & table scan instead of
    //what optimizer says for the dependent table scan.
    Properties targetProperties = new FormatableProperties();
    targetProperties.put("index", "null");
    ((FromBaseTable) fromTable).setTableProperties(targetProperties);

        fromList.addFromTable(fromTable);

        SelectNode resultSet = (SelectNode) nodeFactory.getNode(
                                                     C_NodeTypes.SELECT_NODE,
                                                     getSetClause(tableName, cdl),
                                                     null,   /* AGGREGATE list */
                                                     fromList, /* FROM list */
                                                     whereClause, /* WHERE clause */
                                                     null, /* GROUP BY list */
                           null, /* having clause */
                           null, /* windows */
                                                     getContextManager());

        return (StatementNode) nodeFactory.getNode(
                                                    C_NodeTypes.UPDATE_NODE,
                                                    tableName,
                                                    resultSet,
                                                    getContextManager());

View Full Code Here

    throws StandardException
  {
    ResultColumn resultColumn;
    ValueNode   valueNode;

    NodeFactory nodeFactory = getNodeFactory();
    ResultColumnList  columnList = (ResultColumnList) nodeFactory.getNode(
                        C_NodeTypes.RESULT_COLUMN_LIST,
                        getContextManager());

    valueNode =  (ValueNode) nodeFactory.getNode(C_NodeTypes.UNTYPED_NULL_CONSTANT_NODE,
                               getContextManager());
    for(int index =0 ; index < cdl.size() ; index++)
    {
      ColumnDescriptor cd = (ColumnDescriptor) cdl.elementAt(index);
      //only columns that are nullable need to be set to 'null' for ON
      //DELETE SET NULL
      if((cd.getType()).isNullable())
      {
        resultColumn = (ResultColumn) nodeFactory.getNode(
                         C_NodeTypes.RESULT_COLUMN,
                    cd,
                    valueNode,
                    getContextManager());
View Full Code Here

    String    columnName
  )
    throws StandardException
  {
    ContextManager  cm = getContextManager();
    NodeFactory    nodeFactory = getNodeFactory();

    ResultColumn  rc = (ResultColumn) nodeFactory.getNode
      (
        C_NodeTypes.RESULT_COLUMN,
        columnName,
        nodeFactory.getNode
        (
          C_NodeTypes.COLUMN_REFERENCE,
          columnName,
          tableName,
          cm
View Full Code Here

      throws StandardException
  {
    BinaryRelationalOperatorNode equalsNode;
    BooleanConstantNode     falseNode;
    boolean         nullableResult;
    NodeFactory        nodeFactory = getNodeFactory();

    falseNode = (BooleanConstantNode) nodeFactory.getNode(
                  C_NodeTypes.BOOLEAN_CONSTANT_NODE,
                  Boolean.FALSE,
                  getContextManager());
    equalsNode = (BinaryRelationalOperatorNode)
              nodeFactory.getNode(
                C_NodeTypes.BINARY_EQUALS_OPERATOR_NODE,
                this,
                falseNode,
                getContextManager());
    nullableResult = getTypeServices().isNullable();
View Full Code Here

   * @exception StandardException    Thrown on error
   */
  public ValueNode putAndsOnTop()
          throws StandardException
  {
    NodeFactory    nodeFactory = getNodeFactory();

        QueryTreeNode trueNode = (QueryTreeNode) nodeFactory.getNode(
                    C_NodeTypes.BOOLEAN_CONSTANT_NODE,
                    Boolean.TRUE,
                    getContextManager());
    AndNode andNode = (AndNode) nodeFactory.getNode(
                    C_NodeTypes.AND_NODE,
                    this,
                    trueNode,
                    getContextManager());
    andNode.postBindFixup();
View Full Code Here

      throws StandardException
  {
    BinaryRelationalOperatorNode equalsNode;
    BooleanConstantNode     falseNode;
    boolean         nullableResult;
    NodeFactory        nodeFactory = getNodeFactory();

    falseNode = (BooleanConstantNode) nodeFactory.getNode(
                  C_NodeTypes.BOOLEAN_CONSTANT_NODE,
                  Boolean.FALSE,
                  getContextManager());
    equalsNode = (BinaryRelationalOperatorNode)
              nodeFactory.getNode(
                C_NodeTypes.BINARY_EQUALS_OPERATOR_NODE,
                this,
                falseNode,
                getContextManager());
    nullableResult = dataTypeServices.isNullable();
View Full Code Here

   * @exception StandardException    Thrown on error
   */
  public ValueNode putAndsOnTop()
          throws StandardException
  {
    NodeFactory    nodeFactory = getNodeFactory();

        QueryTreeNode trueNode = nodeFactory.getNode(
                    C_NodeTypes.BOOLEAN_CONSTANT_NODE,
                    Boolean.TRUE,
                    getContextManager());
    AndNode andNode = (AndNode) nodeFactory.getNode(
                    C_NodeTypes.AND_NODE,
                    this,
                    trueNode,
                    getContextManager());
    andNode.postBindFixup();
View Full Code Here

    String    columnName
  )
    throws StandardException
  {
    ContextManager  cm = getContextManager();
    NodeFactory    nodeFactory = getNodeFactory();

    ResultColumn  rc = (ResultColumn) nodeFactory.getNode
      (
        C_NodeTypes.RESULT_COLUMN,
        null,
        nodeFactory.getNode
        (
          C_NodeTypes.COLUMN_REFERENCE,
          columnName,
          tableName,
          cm
View Full Code Here

TOP

Related Classes of org.apache.derby.iapi.sql.compile.NodeFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.