Package com.alibaba.druid.sql.ast.expr

Examples of com.alibaba.druid.sql.ast.expr.SQLCharExpr


        if (lexer.token() == Token.BY) {
          lexer.nextToken();
          if (identifierEquals("PASSWORD")) {
            lexer.nextToken();
          }
          SQLCharExpr password = (SQLCharExpr) this.exprParser.expr();
          userSpec.setPassword(password);
        } else if (lexer.token() == Token.WITH) {
          lexer.nextToken();
          SQLCharExpr text = (SQLCharExpr) this.exprParser.expr();
          userSpec.setAuthPlugin(text);
        }
      }
      stmt.getUsers().add(userSpec);
      if (lexer.token() == Token.COMMA) {
View Full Code Here


    return null;
  }

  public static String parseString(SQLExpr value) throws UnsupportedException {
    if (value instanceof SQLCharExpr) {
      SQLCharExpr charexpr = (SQLCharExpr) value;
      return ((SQLCharExpr) charexpr).getText();
    } else {
      throw new UnsupportedException(
          "Non SQLIdentifierExpr Unsupported, this is " + value);
    }
View Full Code Here

    // field name - data type - value

    // index1 - String - =test
    Condition index1Condition = new Condition("index1",
        Condition.ConditionType.EQUAL, new SQLCharExpr("test"));

    // index2 - int - =11
    Condition index2Condition = new Condition("index2",
        Condition.ConditionType.EQUAL, new SQLIntegerExpr(11));
View Full Code Here

                lexer.nextToken();
                return primaryRest(new MySqlBooleanExpr(false));
            case LITERAL_ALIAS:
                String aliasValue = lexer.stringVal();
                lexer.nextToken();
                return primaryRest(new SQLCharExpr(aliasValue));
            default:
                return super.primary();
        }

    }
View Full Code Here

            } else if (expr instanceof SQLCharExpr) {
                SQLMethodInvokeExpr concat = new SQLMethodInvokeExpr("CONCAT");
                concat.getParameters().add(expr);
                do {
                    String chars = lexer.stringVal();
                    concat.getParameters().add(new SQLCharExpr(chars));
                    lexer.nextToken();
                } while (lexer.token() == Token.LITERAL_CHARS);
                expr = concat;
            }
        } else if (lexer.token() == Token.IDENTIFIER) {
View Full Code Here

        MySqlCreateUserStatement stmt = new MySqlCreateUserStatement();

        for (;;) {
            MySqlCreateUserStatement.UserSpecification userSpec = new MySqlCreateUserStatement.UserSpecification();

            SQLCharExpr expr = (SQLCharExpr) exprParser.expr();
            String user = expr.toString();
            if (lexer.token() == Token.VARIANT) {
                lexer.nextToken();
                SQLCharExpr expr2 = (SQLCharExpr) exprParser.expr();
                user += '@';
                user += expr2.toString();
            }
            userSpec.setUser(new SQLIdentifierExpr(user));

            if (lexer.token() == Token.IDENTIFIED) {
                lexer.nextToken();
                if (lexer.token() == Token.BY) {
                    lexer.nextToken();

                    if (lexer.token() == Token.PASSWORD) {
                        lexer.nextToken();
                    }

                    SQLCharExpr password = (SQLCharExpr) this.exprParser.expr();
                    userSpec.setPassword(password);
                } else if (lexer.token() == Token.WITH) {
                    lexer.nextToken();

                    SQLCharExpr text = (SQLCharExpr) this.exprParser.expr();
                    userSpec.setAuthPlugin(text);
                }
            }

            stmt.getUsers().add(userSpec);
View Full Code Here

    public SQLStatement parseDropUser() throws ParserException {
        accept(Token.USER);

        MySqlDropUser stmt = new MySqlDropUser();
        for (;;) {
            SQLCharExpr expr = (SQLCharExpr) this.exprParser.expr();
            String user = expr.toString();
            if (lexer.token() == Token.VARIANT) {
                lexer.nextToken();
                SQLCharExpr expr2 = (SQLCharExpr) this.exprParser.expr();
                user += '@';
                user += expr2.toString();
            }
            stmt.getUsers().add(new SQLIdentifierExpr(user));
            if (lexer.token() == Token.COMMA) {
                lexer.nextToken();
                continue;
View Full Code Here

            case LITERAL_FLOAT:
                sqlExpr = new SQLNumberExpr(lexer.decimalValue());
                lexer.nextToken();
                break;
            case LITERAL_CHARS:
                sqlExpr = new SQLCharExpr(lexer.stringVal());
                lexer.nextToken();
                break;
            case LITERAL_NCHARS:
                sqlExpr = new SQLNCharExpr(lexer.stringVal());
                lexer.nextToken();
View Full Code Here

       
        OracleIntervalExpr interval = new OracleIntervalExpr();
        if (lexer.token() != Token.LITERAL_CHARS) {
            return new SQLIdentifierExpr("INTERVAL");
        }
        interval.setValue(new SQLCharExpr(lexer.stringVal()));
        lexer.nextToken();

       
        OracleIntervalType type = OracleIntervalType.valueOf(lexer.stringVal());
        interval.setType(type);
View Full Code Here

            case LITERAL_FLOAT:
                sqlExpr = new SQLNumberExpr(lexer.decimalValue());
                lexer.nextToken();
                break;
            case LITERAL_CHARS:
                sqlExpr = new SQLCharExpr(lexer.stringVal());
                lexer.nextToken();
                break;
            case LITERAL_NCHARS:
                sqlExpr = new SQLNCharExpr(lexer.stringVal());
                lexer.nextToken();
View Full Code Here

TOP

Related Classes of com.alibaba.druid.sql.ast.expr.SQLCharExpr

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.