improved mysql parser.

This commit is contained in:
wenshao
2018-02-24 17:41:47 +08:00
parent 30be97f0b0
commit 9d893f72f4
4 changed files with 69 additions and 13 deletions
@@ -3811,11 +3811,13 @@ public class SQLASTOutputVisitor extends SQLASTVisitorAdapter implements Paramet
@Override
public boolean visit(SQLUnique x) {
if (x.getName() != null) {
SQLName name = x.getName();
if (name != null) {
print0(ucase ? "CONSTRAINT " : "constraint ");
x.getName().accept(this);
name.accept(this);
print(' ');
}
print0(ucase ? "UNIQUE (" : "unique (");
printAndAccept(x.getColumns(), ", ");
print(')');
@@ -3824,9 +3826,10 @@ public class SQLASTOutputVisitor extends SQLASTVisitorAdapter implements Paramet
@Override
public boolean visit(SQLPrimaryKeyImpl x) {
if (x.getName() != null) {
SQLName name = x.getName();
if (name != null) {
print0(ucase ? "CONSTRAINT " : "constraint ");
x.getName().accept(this);
name.accept(this);
print(' ');
}
@@ -3839,7 +3842,7 @@ public class SQLASTOutputVisitor extends SQLASTVisitorAdapter implements Paramet
print('(');
printAndAccept(x.getColumns(), ", ");
print(')');
return false;
}
@@ -3854,11 +3857,13 @@ public class SQLASTOutputVisitor extends SQLASTVisitorAdapter implements Paramet
@Override
public boolean visit(SQLColumnReference x) {
if (x.getName() != null) {
SQLName name = x.getName();
if (name != null) {
print0(ucase ? "CONSTRAINT " : "constraint ");
x.getName().accept(this);
name.accept(this);
print(' ');
}
print0(ucase ? "REFERENCES " : "references ");
x.getTable().accept(this);
print0(" (");