mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
修正输出格式
git-svn-id: http://code.alibabatech.com/svn/druid/trunk@163 b9813039-fb51-4c41-a8b9-e21c2acb5095
This commit is contained in:
@@ -120,7 +120,7 @@ public class MySqlOutputVisitor extends SQLASTOutputVisitor implements MySqlASTV
|
||||
print("SQL_CALC_FOUND_ROWS ");
|
||||
}
|
||||
|
||||
printAndAccept(select.getSelectList(), ", ");
|
||||
printSelectList(select.getSelectList());
|
||||
|
||||
if (select.getOutFile() != null) {
|
||||
println();
|
||||
|
||||
+1
-1
@@ -646,7 +646,7 @@ public class OracleOutputVisitor extends SQLASTOutputVisitor implements OracleAS
|
||||
print("*/ ");
|
||||
}
|
||||
|
||||
printAndAccept(select.getSelectList(), ", ");
|
||||
printSelectList(select.getSelectList());
|
||||
|
||||
println();
|
||||
print("FROM ");
|
||||
|
||||
@@ -137,11 +137,28 @@ public class SQLASTOutputVisitor extends SQLASTVisitorAdapter {
|
||||
}
|
||||
}
|
||||
|
||||
protected void printSelectList(List<SQLSelectItem> selectList) {
|
||||
incrementIndent();
|
||||
for (int i = 0, size = selectList.size(); i < size; ++i) {
|
||||
if (i != 0) {
|
||||
if (i % 5 == 0) {
|
||||
println();
|
||||
}
|
||||
|
||||
print(", ");
|
||||
}
|
||||
|
||||
selectList.get(i).accept(this);
|
||||
}
|
||||
decrementIndent();
|
||||
}
|
||||
|
||||
protected void printlnAndAccept(List<? extends SQLObject> nodes, String seperator) {
|
||||
for (int i = 0, size = nodes.size(); i < size; ++i) {
|
||||
if (i != 0) {
|
||||
println(seperator);
|
||||
}
|
||||
|
||||
((SQLObject) nodes.get(i)).accept(this);
|
||||
}
|
||||
}
|
||||
@@ -424,7 +441,7 @@ public class SQLASTOutputVisitor extends SQLASTVisitorAdapter {
|
||||
print("UNIQUE ");
|
||||
}
|
||||
|
||||
printAndAccept(select.getSelectList(), ", ");
|
||||
printSelectList(select.getSelectList());
|
||||
|
||||
if (select.getFrom() != null) {
|
||||
println();
|
||||
@@ -806,16 +823,16 @@ public class SQLASTOutputVisitor extends SQLASTVisitorAdapter {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean visit(SQLListExpr x) {
|
||||
print("(");
|
||||
printAndAccept(x.getItems(), ", ");
|
||||
print(")");
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean visit(SQLSubqueryTableSource x) {
|
||||
print("(");
|
||||
@@ -823,7 +840,7 @@ public class SQLASTOutputVisitor extends SQLASTVisitorAdapter {
|
||||
x.getSelect().accept(this);
|
||||
decrementIndent();
|
||||
print(")");
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user