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

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


  final public StatementNode bareCallStatement() throws ParseException, StandardException {
        ParameterNode           returnParam;

        ValueNode                       value;

        ResultSetNode           resultSetNode;
    switch (jj_nt.kind) {
    case CALL:
      jj_consume_token(CALL);
      value = primaryExpression(true);
                if (! (value instanceof JavaToSQLValueNode) ||
                        ! (((JavaToSQLValueNode) value).getJavaValueNode() instanceof MethodCallNode))
                {
                        {if (true) throw StandardException.newException(SQLState.LANG_INVALID_CALL_STATEMENT);}
                }

                StatementNode callStatement =
                                                                        (StatementNode) nodeFactory.getNode(
                                                                                                C_NodeTypes.CALL_STATEMENT_NODE,
                                                                                                value,
                                                                                                getContextManager());

                setUpAndLinkParameters();

                {if (true) return callStatement;}
      break;
    case QUESTION_MARK:
      returnParam = dynamicParameterSpecification();
                getCompilerContext().setReturnParameterFlag(); //bug4450

      jj_consume_token(EQUALS_OPERATOR);
      jj_consume_token(CALL);
      resultSetNode = rowValueConstructor(null);
                // validate that we have something that is an appropriate call statement
                ResultColumnList rcl = resultSetNode.getResultColumns();

                // we can have only 1 return value/column
                if (rcl == null || rcl.size() > 1)
                {
                        {if (true) throw StandardException.newException(SQLState.LANG_INVALID_CALL_STATEMENT);}
View Full Code Here


* However recursive descent parsers want recursion to be on the right, so this kind of associativity is unnatural
* for our parser. The queryExpression method must know whether it is being called as the right hand side of a
* set operator to produce a query tree with the correct associativity.
*/
  final public ResultSetNode queryExpression(ResultSetNode leftSide, int operatorType) throws ParseException, StandardException {
        ResultSetNode   term;
    term = nonJoinQueryTerm(leftSide, operatorType);
    switch (jj_nt.kind) {
    case EXCEPT:
    case UNION:
      term = unionOrExcept(term);
View Full Code Here

/*
* <A NAME="unionOrExcept">unionOrExcept</A>
*/
  final public ResultSetNode unionOrExcept(ResultSetNode term) throws ParseException, StandardException {
        ResultSetNode   expression;
        Token                   tok = null;
    switch (jj_nt.kind) {
    case UNION:
      jj_consume_token(UNION);
      switch (jj_nt.kind) {
View Full Code Here

* which is not the same as
*   t1 INTERSECT (t2 INTERSECT ALL t3)
* See the comment on queryExpression.
*/
  final public ResultSetNode nonJoinQueryTerm(ResultSetNode leftSide, int operatorType) throws ParseException, StandardException {
        ResultSetNode   term;
    term = nonJoinQueryPrimary();
    switch (jj_nt.kind) {
    case INTERSECT:
      term = intersect(term);
      break;
View Full Code Here

/*
* <A NAME="intersect">intersect</A>
*/
  final public ResultSetNode intersect(ResultSetNode term) throws ParseException, StandardException {
        ResultSetNode   expression;
        Token                   tok = null;
    jj_consume_token(INTERSECT);
    switch (jj_nt.kind) {
    case ALL:
    case DISTINCT:
View Full Code Here

/*
* <A NAME="nonJoinQueryPrimary">nonJoinQueryPrimary</A>
*/
  final public ResultSetNode nonJoinQueryPrimary() throws ParseException, StandardException {
        ResultSetNode   primary;
    switch (jj_nt.kind) {
    case SELECT:
    case VALUES:
      primary = simpleTable();
                {if (true) return primary;}
View Full Code Here

/*
* <A NAME="simpleTable">simpleTable</A>
*/
  final public ResultSetNode simpleTable() throws ParseException, StandardException {
        ResultSetNode   resultSetNode;
    switch (jj_nt.kind) {
    case SELECT:
      resultSetNode = querySpecification();
                {if (true) return resultSetNode;}
      break;
View Full Code Here

/*
* <A NAME="insertColumnsAndSource">insertColumnsAndSource</A>
*/
  final public StatementNode insertColumnsAndSource(QueryTreeNode targetTable) throws ParseException, StandardException {
        Properties                      targetProperties = null;
        ResultSetNode   queryExpression;
        ResultColumnList        columnList = null;
    if (getToken(1).kind == LEFT_PAREN && ! subqueryFollows()) {
      jj_consume_token(LEFT_PAREN);
      columnList = insertColumnList();
      jj_consume_token(RIGHT_PAREN);
View Full Code Here

*/
  final public ResultSetNode rowValueConstructor(ResultSetNode leftRSN) throws ParseException, StandardException {
        ResultColumnList        resultColumns = (ResultColumnList) nodeFactory.getNode(
                                                                                                C_NodeTypes.RESULT_COLUMN_LIST,
                                                                                                getContextManager());
        ResultSetNode           newRSN;
    if (rowValueConstructorListFollows()) {
      jj_consume_token(LEFT_PAREN);
      rowValueConstructorList(resultColumns);
      jj_consume_token(RIGHT_PAREN);
                /* If leftRSN is null, simply return the newRSN, else generate and
     * return a UNION ALL above the 2 RSNs, after verifying that the size()
     * of both RSNs RCLs is the same.
     */
                newRSN = (ResultSetNode) nodeFactory.getNode(
                                                                C_NodeTypes.ROW_RESULT_SET_NODE,
                                                                resultColumns,
                                                                null,
                                                                getContextManager());
                if (leftRSN != null)
                {
                        if (leftRSN.getResultColumns().size() !=
                                newRSN.getResultColumns().size())
                        {
                                {if (true) throw StandardException.newException(SQLState.LANG_ROW_VALUE_CONSTRUCTOR_UNMATCHED_COLUMNS);}
                        }

                        newRSN = (ResultSetNode) nodeFactory.getNode(
                                                                        C_NodeTypes.UNION_NODE,
                                                                        leftRSN,
                                                                        newRSN,
                                                                        Boolean.TRUE,
                                                                        Boolean.TRUE,
                                                                        null,
                                                                        getContextManager());
                }
                {if (true) return newRSN;}
    } else {
      rowValueConstructorElement(resultColumns);
                /* If leftRSN is null, simply return the newRSN, else generate and
     * return a UNION ALL above the 2 RSNs, after verifying that the size()
     * of both RSNs RCLs is the same.
     */
                newRSN = (ResultSetNode) nodeFactory.getNode(
                                                                C_NodeTypes.ROW_RESULT_SET_NODE,
                                                                resultColumns,
                                                                null,
                                                                getContextManager());
                if (leftRSN != null)
                {
                        if (leftRSN.getResultColumns().size() !=
                                newRSN.getResultColumns().size())
                        {
                                {if (true) throw StandardException.newException(SQLState.LANG_ROW_VALUE_CONSTRUCTOR_UNMATCHED_COLUMNS);}
                        }

                        newRSN = (ResultSetNode) nodeFactory.getNode(
View Full Code Here

/*
* <A NAME="subquery">subquery</A>
*/
  final public SubqueryNode subquery(int subqueryType, ValueNode leftOperand) throws ParseException, StandardException {
        ResultSetNode   queryExpression;
        SubqueryNode    subqueryNode;
    queryExpression = queryExpression(null, NO_SET_OP);
                subqueryNode = (SubqueryNode) nodeFactory.getNode(
                                                                                C_NodeTypes.SUBQUERY_NODE,
                                                                                queryExpression,
View Full Code Here

TOP

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

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.