Examples of SQLSelect


Examples of com.alibaba.druid.sql.ast.statement.SQLSelect

    if (lexer.token() == (Token.ON)) {
      throw new ParserException("TODO");
    }

    if (lexer.token() == (Token.SELECT)) {
      SQLSelect query = new MySqlSelectParser(this.exprParser).select();
      stmt.setQuery(query);
    }

    return stmt;
  }
View Full Code Here

Examples of com.alibaba.druid.sql.ast.statement.SQLSelect

   *
   */
  private void getSelectPlan(ParseContext context,
      SQLSelectStatement sqlSelectStatement,
      MetaEventOperation metaEventOperation) throws IOException {
    SQLSelect select = sqlSelectStatement.getSelect();
    SQLSelectQuery sqlSelectQuery = select.getQuery();
    if (sqlSelectQuery instanceof MySqlSelectQueryBlock) {
      MySqlSelectQueryBlock sqlSelectQueryBlock = (MySqlSelectQueryBlock) sqlSelectQuery;
      // SELECT
      // FROM
      // WHERE
View Full Code Here

Examples of com.alibaba.druid.sql.ast.statement.SQLSelect

      }
    }
    if (lexer.token() == (Token.LPAREN)) {
      lexer.nextToken();
      if (lexer.token() == (Token.SELECT)) {
        SQLSelect select = this.exprParser.createSelectParser().select();
        select.setParent(insertStatement);
        insertStatement.setQuery(select);
      } else {
        this.exprParser.exprList(insertStatement.getColumns());
      }
      accept(Token.RPAREN);
    }
    if (lexer.token() == Token.VALUES || identifierEquals("VALUE")) {
      lexer.nextToken();
      for (;;) {
        accept(Token.LPAREN);
        SQLInsertStatement.ValuesClause values = new SQLInsertStatement.ValuesClause();
        this.exprParser.exprList(values.getValues());
        insertStatement.getValuesList().add(values);
        accept(Token.RPAREN);
        if (lexer.token() == Token.COMMA) {
          lexer.nextToken();
          continue;
        } else {
          break;
        }
      }
    } else if (lexer.token() == Token.SET) {
      lexer.nextToken();
      SQLInsertStatement.ValuesClause values = new SQLInsertStatement.ValuesClause();
      insertStatement.getValuesList().add(values);
      for (;;) {
        SQLName name = this.exprParser.name();
        insertStatement.getColumns().add(name);
        if (lexer.token() == Token.EQ) {
          lexer.nextToken();
        } else {
          accept(Token.COLONEQ);
        }
        values.getValues().add(this.exprParser.expr());
        if (lexer.token() == Token.COMMA) {
          lexer.nextToken();
          continue;
        }
        break;
      }
    } else if (lexer.token() == (Token.SELECT)) {
      SQLSelect select = this.exprParser.createSelectParser().select();
      select.setParent(insertStatement);
      insertStatement.setQuery(select);
    } else if (lexer.token() == (Token.LPAREN)) {
      lexer.nextToken();
      SQLSelect select = this.exprParser.createSelectParser().select();
      select.setParent(insertStatement);
      insertStatement.setQuery(select);
      accept(Token.RPAREN);
    }
    if (lexer.token() == Token.ON) {
      lexer.nextToken();
View Full Code Here

Examples of com.alibaba.druid.sql.ast.statement.SQLSelect

          MetaEventOperation metaEventOperation = new FMetaEventOperation(
              reader);

          SQLSelectStatement sqlSelectStatement = (SQLSelectStatement) stmt;
          // this is SELECT clause
          SQLSelect select = sqlSelectStatement.getSelect();
          SQLSelectQuery sqlSelectQuery = select.getQuery();
          if (sqlSelectQuery instanceof SQLSelectQueryBlock) {
            SQLSelectQueryBlock sqlSelectQueryBlock = (SQLSelectQueryBlock) sqlSelectQuery;
            // Parse The WHERE clause
            SQLExpr where = sqlSelectQueryBlock.getWhere();
            LOG.debug("SELECT SQL:where " + where);
View Full Code Here

Examples of com.alibaba.druid.sql.ast.statement.SQLSelect

                lexer.nextToken();
                if (lexer.token() == Token.LPAREN) {
                    SQLAnyExpr anyExpr = new SQLAnyExpr();

                    accept(Token.LPAREN);
                    SQLSelect anySubQuery = createSelectParser().select();
                    anyExpr.setSubQuery(anySubQuery);
                    accept(Token.RPAREN);

                    anySubQuery.setParent(anyExpr);

                    sqlExpr = anyExpr;
                } else {
                    sqlExpr = new SQLIdentifierExpr("ANY");
                }
                break;
            case SOME:
                lexer.nextToken();
                SQLSomeExpr someExpr = new SQLSomeExpr();

                accept(Token.LPAREN);
                SQLSelect someSubQuery = createSelectParser().select();
                someExpr.setSubQuery(someSubQuery);
                accept(Token.RPAREN);

                someSubQuery.setParent(someExpr);

                sqlExpr = someExpr;
                break;
            case ALL:
                lexer.nextToken();
                SQLAllExpr allExpr = new SQLAllExpr();

                accept(Token.LPAREN);
                SQLSelect allSubQuery = createSelectParser().select();
                allExpr.setSubQuery(allSubQuery);
                accept(Token.RPAREN);

                allSubQuery.setParent(allExpr);

                sqlExpr = allExpr;
                break;
            default:
                throw new ParserException("ERROR. token : " + tok + " " + lexer.stringVal());
View Full Code Here

Examples of com.alibaba.druid.sql.ast.statement.SQLSelect

        if (!(stmt instanceof SQLSelectStatement)) {
            throw new SQLException("executeQueryError : " + sql);
        }

        SQLSelect select = ((SQLSelectStatement) stmt).getSelect();
        SQLSelectQuery query = select.getQuery();

        if (query instanceof SQLSelectQueryBlock) {
            return executeQuery(statement, (SQLSelectQueryBlock) query);
        }
View Full Code Here

Examples of com.alibaba.druid.sql.ast.statement.SQLSelect

            case ANY:
                lexer.nextToken();
                SQLAnyExpr anyExpr = new SQLAnyExpr();

                accept(Token.LPAREN);
                SQLSelect anySubQuery = createSelectParser().select();
                anyExpr.setSubQuery(anySubQuery);
                accept(Token.RPAREN);

                anySubQuery.setParent(anyExpr);

                sqlExpr = anyExpr;
                break;
            case SOME:
                lexer.nextToken();
                SQLSomeExpr someExpr = new SQLSomeExpr();

                accept(Token.LPAREN);
                SQLSelect someSubQuery = createSelectParser().select();
                someExpr.setSubQuery(someSubQuery);
                accept(Token.RPAREN);

                someSubQuery.setParent(someExpr);

                sqlExpr = someExpr;
                break;
            case KEY:
                lexer.nextToken();
                sqlExpr = new SQLIdentifierExpr("KEY");
                break;
            case DISTINCT:
                lexer.nextToken();
                sqlExpr = new SQLIdentifierExpr("DISTINCT");
                break;
            case ALL:
                lexer.nextToken();
                SQLAllExpr allExpr = new SQLAllExpr();

                accept(Token.LPAREN);
                SQLSelect allSubQuery = createSelectParser().select();
                allExpr.setSubQuery(allSubQuery);
                accept(Token.RPAREN);

                allSubQuery.setParent(allExpr);

                sqlExpr = allExpr;
                break;
            default:
                throw new ParserException("ERROR. token : " + tok);
View Full Code Here

Examples of com.alibaba.druid.sql.ast.statement.SQLSelect

        return false;
    }

    public boolean visit(SQLSelectStatement stmt) {
        SQLSelect select = stmt.getSelect();

        select.accept(this);

        return false;
    }
View Full Code Here

Examples of com.alibaba.druid.sql.ast.statement.SQLSelect

        if (lexer.token() == (Token.ON)) {
            throw new ParserException("TODO");
        }

        if (lexer.token() == (Token.SELECT)) {
            SQLSelect query = new MySqlSelectParser(this.lexer).select();
            createTable.setQuery(query);
        }

        return createTable;
    }
View Full Code Here

Examples of com.alibaba.druid.sql.ast.statement.SQLSelect

            print("CURSOR ");
            x.getName().accept(this);
            print(" IS");
            incrementIndent();
            println();
            SQLSelect select = ((SQLQueryExpr) x.getDefaultValue()).getSubQuery();
            select.accept(this);
            decrementIndent();

        } else {
            x.getName().accept(this);
            print(" ");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.