public boolean visit(SQLCreateTableStatement x) { MySqlCreateTableStatement mysqlCreateTableStatement = null; if (x instanceof MySqlCreateTableStatement) { mysqlCreateTableStatement = (MySqlCreateTableStatement) x; } if (SQLCreateTableStatement.Type.GLOBAL_TEMPORARY.equals(x.getType())) { print("CREATE TEMPORARY TABLE "); } else { print("CREATE TABLE "); } if (mysqlCreateTableStatement != null && mysqlCreateTableStatement.isIfNotExiists()) { print("IF NOT EXISTS "); } x.getName().accept(this); print(" ("); incrementIndent(); println(); for (int i = 0, size = x.getTableElementList().size(); i < size; ++i) { if (i != 0) { print(", "); println(); } x.getTableElementList().get(i).accept(this); } decrementIndent(); println(); print(")"); if (mysqlCreateTableStatement != null) { for (Map.Entry<String, String> option : mysqlCreateTableStatement.getTableOptions().entrySet()) { print(" "); print(option.getKey()); print(" = "); print(option.getValue()); } } if (mysqlCreateTableStatement != null && mysqlCreateTableStatement.getQuery() != null) { print(" "); incrementIndent(); println(); mysqlCreateTableStatement.getQuery().accept(this); decrementIndent(); } return false; }
public boolean visit(SQLCreateTableStatement x) { for (SQLTableElement e : x.getTableElementList()) { e.setParent(x); } String tableName = x.getName().toString(); TableStat stat = getTableStat(tableName); stat.incrementCreateCount(); setCurrentTable(x, tableName); accept(x.getTableElementList()); restoreCurrentTable(x); return false; }