net.sf.jsqlparser.schema.Table.toString()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(6.3k)|赞(0)|评价(0)|浏览(212)

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

Table.toString介绍

暂无

代码示例

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

  1. @Override
  2. public String toString() {
  3. String sql = "DROP " + type + " "
  4. + (ifExists ? "IF EXISTS " : "") + name.toString();
  5. if (parameters != null && !parameters.isEmpty()) {
  6. sql += " " + PlainSelect.getStringList(parameters);
  7. }
  8. return sql;
  9. }
  10. }

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

  1. b.append(" ");
  2. for (Table t : tables) {
  3. b.append(t.toString());

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

  1. b.append(" USING ");
  2. if (usingTable != null) {
  3. b.append(usingTable.toString());
  4. } else if (usingSelect != null) {
  5. b.append("(").append(usingSelect.toString()).append(")");

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

  1. sql.append(" INTO ");
  2. for (Iterator<Table> iter = intoTables.iterator(); iter.hasNext();) {
  3. sql.append(iter.next().toString());
  4. if (iter.hasNext()) {
  5. sql.append(", ");

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

  1. public void deParse(Delete delete) {
  2. buffer.append("DELETE");
  3. if (delete.getTables() != null && delete.getTables().size() > 0) {
  4. for (Table table : delete.getTables()) {
  5. buffer.append(" ").append(table.getFullyQualifiedName());
  6. }
  7. }
  8. buffer.append(" FROM ").append(delete.getTable().toString());
  9. if (delete.getJoins() != null) {
  10. for (Join join : delete.getJoins()) {
  11. if (join.isSimple()) {
  12. buffer.append(", ").append(join);
  13. } else {
  14. buffer.append(" ").append(join);
  15. }
  16. }
  17. }
  18. if (delete.getWhere() != null) {
  19. buffer.append(" WHERE ");
  20. delete.getWhere().accept(expressionVisitor);
  21. }
  22. if (delete.getOrderByElements() != null) {
  23. new OrderByDeParser(expressionVisitor, buffer).deParse(delete.getOrderByElements());
  24. }
  25. if (delete.getLimit() != null) {
  26. new LimitDeparser(buffer).deParse(delete.getLimit());
  27. }
  28. }

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

  1. buffer.append(insert.getTable().toString());

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

  1. @Override
  2. public String toString() {
  3. String sql = "DROP " + type + " "
  4. + (ifExists ? "IF EXISTS " : "") + name.toString();
  5. if (parameters != null && !parameters.isEmpty()) {
  6. sql += " " + PlainSelect.getStringList(parameters);
  7. }
  8. return sql;
  9. }
  10. }

代码示例来源:origin: wxbty/meepo

  1. public static List<String> name_update_table(String sql) throws JSQLParserException {
  2. net.sf.jsqlparser.statement.Statement statement = CCJSqlParserUtil.parse(sql);
  3. Update updateStatement = (Update) statement;
  4. List<Table> update_table = updateStatement.getTables();
  5. List<String> str_table = new ArrayList<>();
  6. if (update_table != null) {
  7. for (int i = 0; i < update_table.size(); i++) {
  8. str_table.add(update_table.get(i).toString());
  9. }
  10. }
  11. return str_table;
  12. }

代码示例来源:origin: wxbty/meepo

  1. public static List<String> name_delete_table(String sql) throws JSQLParserException {
  2. net.sf.jsqlparser.statement.Statement statement = CCJSqlParserUtil.parse(sql);
  3. Delete updateStatement = (Delete) statement;
  4. Table update_table = updateStatement.getTable();
  5. List<String> str_table = new ArrayList<>();
  6. if (update_table != null) {
  7. str_table.add(update_table.toString());
  8. }
  9. return str_table;
  10. }

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

  1. b.append(" ");
  2. for (Table t : tables) {
  3. b.append(t.toString());

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

  1. b.append(" USING ");
  2. if (usingTable != null) {
  3. b.append(usingTable.toString());
  4. } else if (usingSelect != null) {
  5. b.append("(").append(usingSelect.toString()).append(")");

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

  1. sql.append(" INTO ");
  2. for (Iterator<Table> iter = intoTables.iterator(); iter.hasNext();) {
  3. sql.append(iter.next().toString());
  4. if (iter.hasNext()) {
  5. sql.append(", ");

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

  1. public void deParse(Delete delete) {
  2. buffer.append("DELETE");
  3. if (delete.getTables() != null && delete.getTables().size() > 0) {
  4. for (Table table : delete.getTables()) {
  5. buffer.append(" ").append(table.getFullyQualifiedName());
  6. }
  7. }
  8. buffer.append(" FROM ").append(delete.getTable().toString());
  9. if (delete.getJoins() != null) {
  10. for (Join join : delete.getJoins()) {
  11. if (join.isSimple()) {
  12. buffer.append(", ").append(join);
  13. } else {
  14. buffer.append(" ").append(join);
  15. }
  16. }
  17. }
  18. if (delete.getWhere() != null) {
  19. buffer.append(" WHERE ");
  20. delete.getWhere().accept(expressionVisitor);
  21. }
  22. if (delete.getOrderByElements() != null) {
  23. new OrderByDeParser(expressionVisitor, buffer).deParse(delete.getOrderByElements());
  24. }
  25. if (delete.getLimit() != null) {
  26. new LimitDeparser(buffer).deParse(delete.getLimit());
  27. }
  28. }

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

  1. buffer.append(insert.getTable().toString());

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

  1. public Builder setJSqlParser(CCJSqlParser jSqlParser) throws com.github.vincentrussell.query.mongodb.sql.converter.ParseException, ParseException {
  2. final Statement statement = jSqlParser.Statement();
  3. if (Select.class.isAssignableFrom(statement.getClass())) {
  4. sqlCommandType = SQLCommandType.SELECT;
  5. final PlainSelect plainSelect = (PlainSelect)(((Select)statement).getSelectBody());
  6. SqlUtils.isTrue(plainSelect != null, "could not parseNaturalLanguageDate SELECT statement from query");
  7. SqlUtils.isTrue(plainSelect.getFromItem()!=null,"could not find table to query. Only one simple table name is supported.");
  8. whereClause = plainSelect.getWhere();
  9. isDistinct = (plainSelect.getDistinct() != null);
  10. isCountAll = SqlUtils.isCountAll(plainSelect.getSelectItems());
  11. SqlUtils.isTrue(plainSelect.getFromItem() != null, "could not find table to query. Only one simple table name is supported.");
  12. table = plainSelect.getFromItem().toString();
  13. limit = SqlUtils.getLimit(plainSelect.getLimit());
  14. orderByElements1 = plainSelect.getOrderByElements();
  15. selectItems = plainSelect.getSelectItems();
  16. joins = plainSelect.getJoins();
  17. groupBys = SqlUtils.getGroupByColumnReferences(plainSelect);
  18. SqlUtils.isTrue(plainSelect.getFromItem() != null, "could not find table to query. Only one simple table name is supported.");
  19. } else if (Delete.class.isAssignableFrom(statement.getClass())) {
  20. sqlCommandType = SQLCommandType.DELETE;
  21. Delete delete = (Delete)statement;
  22. SqlUtils.isTrue(delete.getTables().size() == 0, "there should only be on table specified for deletes");
  23. table = delete.getTable().toString();
  24. whereClause = delete.getWhere();
  25. }
  26. return this;
  27. }

相关文章