Package com.alibaba.druid.sql.parser

Examples of com.alibaba.druid.sql.parser.Token


      stmt.setIfNotExiists(true);
    }

    stmt.setName(this.exprParser.name());

    Token start = null;
    if (lexer.token() == (Token.LPAREN)) {
      start = Token.LPAREN;
    } else if (lexer.token() == (Token.LBRACE)) {
      start = Token.LBRACE;
    }
View Full Code Here


    String sql = "SELECT * FROM T WHERE F1 = ? ORDER BY F2";
    Lexer lexer = new Lexer(sql);
    System.out.println("--------------------------------------------");
    for (;;) {
      lexer.nextToken();
      Token tok = lexer.token();

      if (tok == Token.IDENTIFIER) {
        System.out.println(tok.name() + "\t\t" + lexer.stringVal());
      } else {
        System.out.println(tok.name() + "\t\t\t" + tok.name);
      }

      if (tok == Token.EOF) {
        break;
      }
View Full Code Here

        return super.notRationalRest(expr);
    }

    public SQLExpr primary() throws ParserException {
        final Token tok = lexer.token();
       
        if (identifierEquals("outfile")) {
            lexer.nextToken();
            SQLExpr file = primary();
            SQLExpr expr = new MySqlOutFileExpr(file);
View Full Code Here

        return false;
    }

    public SQLExpr primary() throws ParserException {
        final Token tok = lexer.token();

        SQLExpr sqlExpr = null;
        switch (tok) {
            case SYSDATE:
                lexer.nextToken();
View Full Code Here

        }

        this.ch = buf[bp];

        stringVal = symbolTable.addSymbol(buf, np, sp, hash);
        Token tok = keywods.getKeyword(stringVal);
        if (tok != null) {
            token = tok;
        } else {
            token = Token.VARIANT;
        }
View Full Code Here

            }

            this.ch = buf[bp];

            stringVal = symbolTable.addSymbol(buf, np, sp, hash);
            Token tok = keywods.getKeyword(stringVal);
            if (tok != null) {
                token = tok;
            } else {
                token = Token.IDENTIFIER;
            }
        } else {

            final boolean firstFlag = isFirstIdentifierChar(first);
            if (!firstFlag) {
                throw new SQLParseException("illegal identifier");
            }

            int hash = first;

            np = bp;
            sp = 1;
            char ch;
            for (;;) {
                ch = buf[++bp];

                if (!isIdentifierChar(ch)) {
                    break;
                }

                hash = 31 * hash + ch;

                sp++;
                continue;
            }

            this.ch = buf[bp];

            stringVal = symbolTable.addSymbol(buf, np, sp, hash);
            Token tok = keywods.getKeyword(stringVal);
            if (tok != null) {
                token = tok;
            } else {
                token = Token.IDENTIFIER;
            }
View Full Code Here

        }

        this.ch = buf[bp];

        stringVal = symbolTable.addSymbol(buf, np, sp, hash);
        Token tok = keywods.getKeyword(stringVal);
        if (tok != null) {
            token = tok;
        } else {
            token = Token.IDENTIFIER;
        }
View Full Code Here

        return false;
    }

    public SQLExpr primary() throws ParserException {
        final Token tok = lexer.token();

        SQLExpr sqlExpr = null;
        switch (tok) {
            case COLON:
                lexer.nextToken();
View Full Code Here

        return super.notRationalRest(expr);
    }

    public SQLExpr primary() throws ParserException {
        final Token tok = lexer.token();

        switch (tok) {
            case TRUE:
                lexer.nextToken();
                return primaryRest(new MySqlBooleanExpr(true));
View Full Code Here

                parser.getLexer().setAllowComment(false); // deny comment
            }

            parser.parseStatementList(statementList);

            final Token lastToken = parser.getLexer().token();
            if (lastToken != Token.EOF) {
                violations.add(new IllegalSQLObjectViolation(ErrorCode.SYNTAX_ERROR, "not terminal sql, token "
                                                                                     + lastToken, sql));
            }
        } catch (NotAllowCommentException e) {
View Full Code Here

TOP

Related Classes of com.alibaba.druid.sql.parser.Token

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.