net.sf.jsqlparser.statement.delete.Delete.getTables()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(5.0k)|赞(0)|评价(0)|浏览(210)

本文整理了Java中net.sf.jsqlparser.statement.delete.Delete.getTables()方法的一些代码示例,展示了Delete.getTables()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Delete.getTables()方法的具体详情如下:
包路径:net.sf.jsqlparser.statement.delete.Delete
类名称:Delete
方法名:getTables

Delete.getTables介绍

暂无

代码示例

代码示例来源:origin: JSQLParser/JSqlParser

public void deParse(Delete delete) {
  buffer.append("DELETE");
  if (delete.getTables() != null && delete.getTables().size() > 0) {
    for (Table table : delete.getTables()) {
      buffer.append(" ").append(table.getFullyQualifiedName());
    }
  }
  buffer.append(" FROM ").append(delete.getTable().toString());
  if (delete.getJoins() != null) {
    for (Join join : delete.getJoins()) {
      if (join.isSimple()) {
        buffer.append(", ").append(join);
      } else {
        buffer.append(" ").append(join);
      }
    }
  }
  if (delete.getWhere() != null) {
    buffer.append(" WHERE ");
    delete.getWhere().accept(expressionVisitor);
  }
  if (delete.getOrderByElements() != null) {
    new OrderByDeParser(expressionVisitor, buffer).deParse(delete.getOrderByElements());
  }
  if (delete.getLimit() != null) {
    new LimitDeparser(buffer).deParse(delete.getLimit());
  }
}

代码示例来源:origin: codingapi/tx-lcn

if (delete.getTables().size() == 0) {
  delete.setTables(Collections.singletonList(delete.getTable()));
List<String> tables = new ArrayList<>(delete.getTables().size());
List<String> primaryKeys = new ArrayList<>(3);
List<String> columns = new ArrayList<>();
for (Table table : delete.getTables()) {
  TableStruct tableStruct = tableStructAnalyser.analyse(connection, table.getName());
  tableStruct.getColumns().forEach((k, v) -> {

代码示例来源:origin: com.github.jsqlparser/jsqlparser

public void deParse(Delete delete) {
  buffer.append("DELETE");
  if (delete.getTables() != null && delete.getTables().size() > 0) {
    for (Table table : delete.getTables()) {
      buffer.append(" ").append(table.getFullyQualifiedName());
    }
  }
  buffer.append(" FROM ").append(delete.getTable().toString());
  if (delete.getJoins() != null) {
    for (Join join : delete.getJoins()) {
      if (join.isSimple()) {
        buffer.append(", ").append(join);
      } else {
        buffer.append(" ").append(join);
      }
    }
  }
  if (delete.getWhere() != null) {
    buffer.append(" WHERE ");
    delete.getWhere().accept(expressionVisitor);
  }
  if (delete.getOrderByElements() != null) {
    new OrderByDeParser(expressionVisitor, buffer).deParse(delete.getOrderByElements());
  }
  if (delete.getLimit() != null) {
    new LimitDeparser(buffer).deParse(delete.getLimit());
  }
}

代码示例来源:origin: vincentrussell/sql-to-mongo-db-query-converter

public Builder setJSqlParser(CCJSqlParser jSqlParser) throws com.github.vincentrussell.query.mongodb.sql.converter.ParseException, ParseException {
  final Statement statement = jSqlParser.Statement();
  if (Select.class.isAssignableFrom(statement.getClass())) {
    sqlCommandType = SQLCommandType.SELECT;
    final PlainSelect plainSelect = (PlainSelect)(((Select)statement).getSelectBody());
    SqlUtils.isTrue(plainSelect != null, "could not parseNaturalLanguageDate SELECT statement from query");
    SqlUtils.isTrue(plainSelect.getFromItem()!=null,"could not find table to query.  Only one simple table name is supported.");
    whereClause = plainSelect.getWhere();
    isDistinct = (plainSelect.getDistinct() != null);
    isCountAll = SqlUtils.isCountAll(plainSelect.getSelectItems());
    SqlUtils.isTrue(plainSelect.getFromItem() != null, "could not find table to query.  Only one simple table name is supported.");
    table = plainSelect.getFromItem().toString();
    limit = SqlUtils.getLimit(plainSelect.getLimit());
    orderByElements1 = plainSelect.getOrderByElements();
    selectItems = plainSelect.getSelectItems();
    joins = plainSelect.getJoins();
    groupBys = SqlUtils.getGroupByColumnReferences(plainSelect);
    SqlUtils.isTrue(plainSelect.getFromItem() != null, "could not find table to query.  Only one simple table name is supported.");
  } else if (Delete.class.isAssignableFrom(statement.getClass())) {
    sqlCommandType = SQLCommandType.DELETE;
    Delete delete = (Delete)statement;
    SqlUtils.isTrue(delete.getTables().size() == 0, "there should only be on table specified for deletes");
    table = delete.getTable().toString();
    whereClause = delete.getWhere();
  }
  return this;
}

代码示例来源:origin: diennea/herddb

public String getTableSpace(Statement statement) throws ScriptException {
  String tableName = null;
  if (statement instanceof Insert) {
    Insert st = (Insert) statement;
    tableName = st.getTable().getFullyQualifiedName();
  } else if (statement instanceof Update) {
    Update st = (Update) statement;
    tableName = st.getTables().get(0).getFullyQualifiedName();
  } else if (statement instanceof Delete) {
    Delete st = (Delete) statement;
    tableName = st.getTables().get(0).getFullyQualifiedName();
  } else if (statement instanceof Truncate) {
    Truncate st = (Truncate) statement;
    tableName = st.getTable().getFullyQualifiedName();
  } else if (statement instanceof Drop) {
    Drop st = (Drop) statement;
    tableName = st.getName().getFullyQualifiedName();
  } else if (statement instanceof CreateTable) {
    CreateTable st = (CreateTable) statement;
    tableName = st.getTable().getFullyQualifiedName();
  } else if (statement instanceof Alter) {
    Alter st = (Alter) statement;
    tableName = st.getTable().getFullyQualifiedName();
  } else {
    return null;
  }
  return mapTableNameToSchema(tableName);
}

相关文章