improved sql parser.

This commit is contained in:
wenshao
2017-03-13 23:07:26 +08:00
parent 190faee6d2
commit 781f4de2b4
12 changed files with 250 additions and 6 deletions
@@ -996,6 +996,13 @@ public class SchemaStatVisitor extends SQLASTVisitorAdapter {
}
}
if (column != null) {
SQLObject parent = x.getParent();
if (parent instanceof SQLPrimaryKey) {
column.setPrimaryKey(true);
} else if (parent instanceof SQLUnique) {
column.setUnique(true);
}
setColumn(x, column);
}
return false;
@@ -1440,6 +1447,14 @@ public class SchemaStatVisitor extends SQLASTVisitorAdapter {
column.setDataType(x.getDataType().getName());
}
for (SQLColumnConstraint item : x.getConstraints()) {
if (item instanceof SQLPrimaryKey) {
column.setPrimaryKey(true);
} else if (item instanceof SQLUnique) {
column.setUnique(true);
}
}
return false;
}