Package com.alibaba.druid.sql.ast.statement

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


  public SQLExprTableSource getReferenceTable() {
    return referenceTable;
  }

  public void setReferenceTable(SQLName name) {
    this.referenceTable = new SQLExprTableSource(name);
  }
View Full Code Here


  public void addPrimaryKey(SQLExpr primaryKey) {
    primaryKeys.add(primaryKey);
  }

  public void setInTableName(SQLName name) {
    parentTableSource = new SQLExprTableSource(name);
  }
View Full Code Here

  public void setTableSource(SQLExprTableSource tableSource) {
    this.tableSource = tableSource;
  }

  public void setTableSource(SQLName name) {
    this.tableSource = new SQLExprTableSource(name);
  }
View Full Code Here

   *
   */
  private void getAlterTablePlan(ParseContext context,
      MySqlAlterTableStatement sqlAlterTableStatement,
      MetaEventOperation metaEventOperation) throws IOException {
    SQLExprTableSource tableSource = sqlAlterTableStatement.getTableSource();
    String tableName = parseFromClause(tableSource);
    // check if table exists and get Table info
    FTable oldTable = metaEventOperation.checkAndGetTable(tableName, true);

    FTable newTable = FTable.clone(oldTable);
View Full Code Here

     * primary key(user_id, photo_id) IN TABLE user,ENTITY GROUP KEY(user_id)
     * references User;";
     */

    // Table Info
    SQLExprTableSource tableSource = waspSqlCreateTableStatement
        .getTableSource();
    String tableName = parseFromClause(tableSource);
    // Check Table Name is legal.
    metaEventOperation.isLegalTableName(tableName);
    // Check if the table exists
View Full Code Here

   */
  public String parseFromClause(SQLTableSource from)
      throws UnsupportedException {
    // only support SQLExprTableSource now
    if (from instanceof SQLExprTableSource) {
      SQLExprTableSource fromExpr = (SQLExprTableSource) from;
      SQLExpr expr = fromExpr.getExpr(); // SQLIdentifierExpr
      return parseName(expr);
    } else if (from instanceof SQLJoinTableSource) {
      // TODO impl join clause
      throw new UnsupportedException("Join clause Unsupported");
    } else if (from instanceof SQLSubqueryTableSource) {
View Full Code Here

        SQLDropTableStatement stmt = new SQLDropTableStatement();

        for (;;) {
            SQLName name = this.exprParser.name();
            stmt.getTableSources().add(new SQLExprTableSource(name));
            if (lexer.token() == Token.COMMA) {
                lexer.nextToken();
                continue;
            }
            break;
View Full Code Here

                    lexer.nextToken();
                }

                SQLExpr name = this.createExprParser().name();

                queryBlock.setInto(new SQLExprTableSource(name));
            }
        }

        parseFrom(queryBlock);
View Full Code Here

            expr.setParent(selectItem);
        }

        if (x.getFrom() == null) {
            Entity firstEntity = visitor.getEngine().getFirstEntity(visitor.getContext());
            SQLExprTableSource from = new SQLExprTableSource(new SQLIdentifierExpr(firstEntity.getName()));
            from.putAttribute(MAPPING_ENTITY, firstEntity);
            x.setFrom(from);
            x.putAttribute(MAPPING_ENTITY, firstEntity);
        }

        for (SQLSelectItem item : x.getSelectList()) {
View Full Code Here

        modeLocal.set(Mode.Select);

        String originalTable = currentTableLocal.get();

        if (x.getFrom() instanceof SQLExprTableSource) {
            SQLExprTableSource tableSource = (SQLExprTableSource) x.getFrom();
            if (tableSource.getExpr() instanceof SQLIdentifierExpr) {
                String ident = ((SQLIdentifierExpr) tableSource.getExpr()).getName();
                currentTableLocal.set(ident);
                x.putAttribute("_old_local_", originalTable);
            }
        }
View Full Code Here

TOP

Related Classes of com.alibaba.druid.sql.ast.statement.SQLExprTableSource

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.