mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improved sql parser.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user