bug fixed for sql parser

This commit is contained in:
温少
2012-03-07 05:32:18 +08:00
57 changed files with 2518 additions and 243 deletions
@@ -567,7 +567,13 @@ public class SQLASTOutputVisitor extends SQLASTVisitorAdapter {
print(' ');
item.accept(this);
}
if (x.getEnable() != null) {
if (x.getEnable().booleanValue()) {
print(" ENABLE");
}
}
return false;
}
@@ -674,13 +680,17 @@ public class SQLASTOutputVisitor extends SQLASTVisitorAdapter {
if (size > 0) {
print(" (");
incrementIndent();
println();
for (int i = 0; i < size; ++i) {
if (i != 0) {
print(", ");
println();
}
x.getTableElementList().get(i).accept(this);
}
decrementIndent();
println();
print(")");
}
@@ -362,7 +362,7 @@ public class SchemaStatVisitor extends SQLASTVisitorAdapter {
@Override
public boolean visit(SQLTruncateStatement x) {
setMode(x, Mode.Insert);
setMode(x, Mode.Delete);
setAliasMap();
@@ -374,7 +374,7 @@ public class SchemaStatVisitor extends SQLASTVisitorAdapter {
x.putAttribute("_old_local_", originalTable);
TableStat stat = getTableStat(ident);
stat.incrementInsertCount();
stat.incrementDeleteCount();
Map<String, String> aliasMap = getAliasMap();
if (aliasMap != null) {
@@ -805,8 +805,11 @@ public class SchemaStatVisitor extends SQLASTVisitorAdapter {
TableStat stat = getTableStat(tableName);
stat.incrementCreateCount();
setCurrentTable(x, tableName);
accept(x.getTableElementList());
restoreCurrentTable(x);
return false;
}