mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
+11
@@ -22,9 +22,12 @@ public class MySqlDescribeStatement extends MySqlStatementImpl {
|
||||
|
||||
private SQLName object;
|
||||
|
||||
private SQLName colName;
|
||||
|
||||
public void accept0(MySqlASTVisitor visitor) {
|
||||
if (visitor.visit(this)) {
|
||||
acceptChild(visitor, object);
|
||||
acceptChild(visitor, colName);
|
||||
}
|
||||
visitor.endVisit(this);
|
||||
}
|
||||
@@ -37,4 +40,12 @@ public class MySqlDescribeStatement extends MySqlStatementImpl {
|
||||
this.object = object;
|
||||
}
|
||||
|
||||
public SQLName getColName() {
|
||||
return colName;
|
||||
}
|
||||
|
||||
public void setColName(SQLName colName) {
|
||||
this.colName = colName;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -711,7 +711,9 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
|
||||
MySqlDescribeStatement stmt = new MySqlDescribeStatement();
|
||||
stmt.setObject(this.exprParser.name());
|
||||
|
||||
if (lexer.token() == Token.IDENTIFIER) {
|
||||
stmt.setColName(this.exprParser.name());
|
||||
}
|
||||
return stmt;
|
||||
}
|
||||
|
||||
|
||||
@@ -1696,6 +1696,10 @@ public class MySqlOutputVisitor extends SQLASTOutputVisitor implements MySqlASTV
|
||||
public boolean visit(MySqlDescribeStatement x) {
|
||||
print("DESC ");
|
||||
x.getObject().accept(this);
|
||||
print(" ");
|
||||
if (x.getColName() != null) {
|
||||
x.getColName().accept(this);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
+5
-1
@@ -546,7 +546,11 @@ public class MySqlSchemaStatVisitor extends SchemaStatVisitor implements MySqlAS
|
||||
|
||||
@Override
|
||||
public boolean visit(MySqlDescribeStatement x) {
|
||||
getTableStat(x.getObject().toString());
|
||||
String table = x.getObject().toString();
|
||||
getTableStat(table);
|
||||
if (x.getColName() != null) {
|
||||
addColumn(table, x.getColName().toString());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user