Package org.apache.derby.impl.sql.compile

Examples of org.apache.derby.impl.sql.compile.FromList


/*
* <A NAME="tableExpression">tableExpression</A>
*/
  final public SelectNode tableExpression(ResultColumnList selectList) throws ParseException, StandardException {
        SelectNode      selectNode;
        FromList        fromList;
        ValueNode       whereClause = null;
        GroupByList     groupByList = null;
        ValueNode       havingClause = null;
        Token           whereToken;
    fromList = fromClause();
View Full Code Here


/*
* <A NAME="fromClause">fromClause</A>
*/
  final public FromList fromClause() throws ParseException, StandardException {
        FromList fromList = (FromList) nodeFactory.getNode(
                                                                        C_NodeTypes.FROM_LIST,
                                                                        getNodeFactory().doJoinOrderOptimization(),
                                                                        getContextManager());
        int     tokKind;
        Token   beginToken;
        Token   endToken;
    jj_consume_token(FROM);
                beginToken = getToken(1);
    switch (jj_nt.kind) {
    case DERBYDASHPROPERTIES:
      fromListProperties(fromList);
      break;
    default:
      jj_la1[175] = jj_gen;
      ;
    }
    dummyTableReferenceRule(fromList);
    label_25:
    while (true) {
      switch (jj_nt.kind) {
      case COMMA:
        ;
        break;
      default:
        jj_la1[176] = jj_gen;
        break label_25;
      }
      jj_consume_token(COMMA);
      dummyTableReferenceRule(fromList);
    }
                                                                         endToken = getToken(0);
                fromList.setBeginOffset( beginToken.beginOffset);
                fromList.setEndOffset( endToken.endOffset);
                {if (true) return fromList;}
    throw new Error("Missing return statement in function");
  }
View Full Code Here

         private QueryTreeNode getDeleteNode(FromTable fromTable,
                                                                                 TableName tableName,
                                                                                 ValueNode whereClause)
                throws StandardException
        {
                FromList   fromList = (FromList) nodeFactory.getNode(
                                                                C_NodeTypes.FROM_LIST,
                                                                getContextManager());
                QueryTreeNode retval;
                SelectNode resultSet;

                fromList.addFromTable(fromTable);

                resultSet = (SelectNode) nodeFactory.getNode(
                                                                                C_NodeTypes.SELECT_NODE,
                                                                                null,
                                                                                null,   /* AGGREGATE list */
 
View Full Code Here

                                                                                 TableName tableName,
                                                                                 ResultColumnList setClause,
                                                                                 ValueNode whereClause)
                throws StandardException
        {
                FromList   fromList = (FromList) nodeFactory.getNode(
                                                                C_NodeTypes.FROM_LIST,
                                                                getContextManager());
                QueryTreeNode retval;
                SelectNode resultSet;

                fromList.addFromTable(fromTable);

                resultSet = (SelectNode) nodeFactory.getNode(
                                                                                C_NodeTypes.SELECT_NODE,
                                                                                setClause,
                                                                                null,   /* AGGREGATE list */
 
View Full Code Here

/*
* <A NAME="tableExpression">tableExpression</A>
*/
  final public SelectNode tableExpression(ResultColumnList selectList) throws ParseException, StandardException {
        SelectNode      selectNode;
        FromList        fromList;
        ValueNode       whereClause = null;
        GroupByList     groupByList = null;
        ValueNode       havingClause = null;
        Token           whereToken;
    fromList = fromClause();
    switch (jj_nt.kind) {
    case WHERE:
      whereToken = jj_consume_token(WHERE);
      whereClause = whereClause(whereToken);
      break;
    default:
      jj_la1[161] = jj_gen;
      ;
    }
    switch (jj_nt.kind) {
    case GROUP:
      groupByList = groupByClause();
      break;
    default:
      jj_la1[162] = jj_gen;
      ;
    }
    switch (jj_nt.kind) {
    case HAVING:
      havingClause = havingClause();
      break;
    default:
      jj_la1[163] = jj_gen;
      ;
    }
                selectNode = (SelectNode) nodeFactory.getNode(
                                                        C_NodeTypes.SELECT_NODE,
                                                        selectList,
                                                        null,           /* AGGREGATE list */
                                                        fromList,
                                                        whereClause,
                                                        groupByList,
                                                        getContextManager());

                /* A SELECT with a GROUP BY or HAVING clause is the one instance where the
     * parser will generate a tree that does not exactly match the query.
     * The resulting tree is an outer SelectNode with the HAVING clause
     * as its WHERE clause and a FromList containing a single FromSubquery -
     * the user SELECT, minus the HAVING clause.
     * The outer SELECT gets a SELECT *.
     * The FromSubquery will have a null name, something that the user cannot do,
     * to enable the binding of any correlated columns in the HAVING clause.
     */
                if (groupByList != null || havingClause != null)
                {
                        FromSubquery            fromSubquery;
                        ResultColumnList        outerRCL =
                                                                                (ResultColumnList) nodeFactory.getNode(
                                                                                                C_NodeTypes.RESULT_COLUMN_LIST,
                                                                                                getContextManager());

                        /* Wrap the user SELECT in a FromSubquery */
                        fromList = (FromList) nodeFactory.getNode(
                                                                        C_NodeTypes.FROM_LIST,
                                                                        getNodeFactory().doJoinOrderOptimization(),
                                                                        getContextManager());
                        fromSubquery = (FromSubquery) nodeFactory.getNode(
                                                                                                        C_NodeTypes.FROM_SUBQUERY,
                                                                                                        selectNode,
                                                                                                        null,
                                                                                                        null,
                                                                                                        null,
                                                                                                        getContextManager());
                        fromList.addElement(fromSubquery);

                        /* Pull any aggregates out of the HAVING clause and append them to
       * SELECT list in the user's select, replacing the aggregates in
       * the HAVING clause with ColumnReferences to the aggregate.
       * Do NOT replace anything below a ResultSetNode.  This means that
View Full Code Here

/*
* <A NAME="fromClause">fromClause</A>
*/
  final public FromList fromClause() throws ParseException, StandardException {
        FromList fromList = (FromList) nodeFactory.getNode(
                                                                        C_NodeTypes.FROM_LIST,
                                                                        getNodeFactory().doJoinOrderOptimization(),
                                                                        getContextManager());
        int     tokKind;
        Token   beginToken;
        Token   endToken;
    jj_consume_token(FROM);
                beginToken = getToken(1);
    if (propertyListFollows()) {
      fromListProperties(fromList);
    } else {
      ;
    }
    dummyTableReferenceRule(fromList);
    label_24:
    while (true) {
      switch (jj_nt.kind) {
      case COMMA:
        ;
        break;
      default:
        jj_la1[164] = jj_gen;
        break label_24;
      }
      jj_consume_token(COMMA);
      dummyTableReferenceRule(fromList);
    }
                                                                         endToken = getToken(0);
                fromList.setBeginOffset( beginToken.beginOffset);
                fromList.setEndOffset( endToken.endOffset);
                {if (true) return fromList;}
    throw new Error("Missing return statement in function");
  }
View Full Code Here

         private QueryTreeNode getDeleteNode(FromTable fromTable,
                                                                                 TableName tableName,
                                                                                 ValueNode whereClause)
                throws StandardException
        {
                FromList   fromList = (FromList) nodeFactory.getNode(
                                                                C_NodeTypes.FROM_LIST,
                                                                getContextManager());
                QueryTreeNode retval;
                SelectNode resultSet;

                fromList.addFromTable(fromTable);

                resultSet = (SelectNode) nodeFactory.getNode(
                                                                                C_NodeTypes.SELECT_NODE,
                                                                                null,
                                                                                null,   /* AGGREGATE list */
 
View Full Code Here

                                                                                 TableName tableName,
                                                                                 ResultColumnList setClause,
                                                                                 ValueNode whereClause)
                throws StandardException
        {
                FromList   fromList = (FromList) nodeFactory.getNode(
                                                                C_NodeTypes.FROM_LIST,
                                                                getContextManager());
                QueryTreeNode retval;
                SelectNode resultSet;

                fromList.addFromTable(fromTable);

                resultSet = (SelectNode) nodeFactory.getNode(
                                                                                C_NodeTypes.SELECT_NODE,
                                                                                setClause,
                                                                                null,   /* AGGREGATE list */
 
View Full Code Here

/*
* <A NAME="tableExpression">tableExpression</A>
*/
  final public SelectNode tableExpression(ResultColumnList selectList) throws ParseException, StandardException {
        SelectNode      selectNode;
        FromList        fromList;
        ValueNode       whereClause = null;
        GroupByList     groupByList = null;
        ValueNode       havingClause = null;
        Token           whereToken;
    fromList = fromClause();
    switch (jj_nt.kind) {
    case WHERE:
      whereToken = jj_consume_token(WHERE);
      whereClause = whereClause(whereToken);
      break;
    default:
      jj_la1[161] = jj_gen;
      ;
    }
    switch (jj_nt.kind) {
    case GROUP:
      groupByList = groupByClause();
      break;
    default:
      jj_la1[162] = jj_gen;
      ;
    }
    switch (jj_nt.kind) {
    case HAVING:
      havingClause = havingClause();
      break;
    default:
      jj_la1[163] = jj_gen;
      ;
    }
                selectNode = (SelectNode) nodeFactory.getNode(
                                                        C_NodeTypes.SELECT_NODE,
                                                        selectList,
                                                        null,           /* AGGREGATE list */
                                                        fromList,
                                                        whereClause,
                                                        groupByList,
                                                        getContextManager());

                /* A SELECT with a GROUP BY or HAVING clause is the one instance where the
     * parser will generate a tree that does not exactly match the query.
     * The resulting tree is an outer SelectNode with the HAVING clause
     * as its WHERE clause and a FromList containing a single FromSubquery -
     * the user SELECT, minus the HAVING clause.
     * The outer SELECT gets a SELECT *.
     * The FromSubquery will have a null name, something that the user cannot do,
     * to enable the binding of any correlated columns in the HAVING clause.
     */
                if (groupByList != null || havingClause != null)
                {
                        FromSubquery            fromSubquery;
                        ResultColumnList        outerRCL =
                                                                                (ResultColumnList) nodeFactory.getNode(
                                                                                                C_NodeTypes.RESULT_COLUMN_LIST,
                                                                                                getContextManager());

                        /* Wrap the user SELECT in a FromSubquery */
                        fromList = (FromList) nodeFactory.getNode(
                                                                        C_NodeTypes.FROM_LIST,
                                                                        getNodeFactory().doJoinOrderOptimization(),
                                                                        getContextManager());
                        fromSubquery = (FromSubquery) nodeFactory.getNode(
                                                                                                        C_NodeTypes.FROM_SUBQUERY,
                                                                                                        selectNode,
                                                                                                        null,
                                                                                                        null,
                                                                                                        null,
                                                                                                        getContextManager());
                        fromList.addElement(fromSubquery);

                        /* Pull any aggregates out of the HAVING clause and append them to
       * SELECT list in the user's select, replacing the aggregates in
       * the HAVING clause with ColumnReferences to the aggregate.
       * Do NOT replace anything below a ResultSetNode.  This means that
View Full Code Here

/*
* <A NAME="fromClause">fromClause</A>
*/
  final public FromList fromClause() throws ParseException, StandardException {
        FromList fromList = (FromList) nodeFactory.getNode(
                                                                        C_NodeTypes.FROM_LIST,
                                                                        getNodeFactory().doJoinOrderOptimization(),
                                                                        getContextManager());
        int     tokKind;
        Token   beginToken;
        Token   endToken;
    jj_consume_token(FROM);
                beginToken = getToken(1);
    if (propertyListFollows()) {
      fromListProperties(fromList);
    } else {
      ;
    }
    dummyTableReferenceRule(fromList);
    label_24:
    while (true) {
      switch (jj_nt.kind) {
      case COMMA:
        ;
        break;
      default:
        jj_la1[164] = jj_gen;
        break label_24;
      }
      jj_consume_token(COMMA);
      dummyTableReferenceRule(fromList);
    }
                                                                         endToken = getToken(0);
                fromList.setBeginOffset( beginToken.beginOffset);
                fromList.setEndOffset( endToken.endOffset);
                {if (true) return fromList;}
    throw new Error("Missing return statement in function");
  }
View Full Code Here

TOP

Related Classes of org.apache.derby.impl.sql.compile.FromList

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.