jingshanglu opened a new issue #7791:
URL: https://github.com/apache/shardingsphere/issues/7791
## Background
Now, the Statement definition of mysql is not perfect yet. We need to refine
the Statement definition and construct reasonable statements through visitor.
For example, some statements are empty
```
//
shardingsphere/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/dml/MySQLCallStatement.java
package org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dml;
/**
* MySQL call statement.
*/
public final class MySQLCallStatement extends CallStatement implements
MySQLStatement {
}
//
shardingsphere/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/impl/MySQLDMLVisitor.java
package org.apache.shardingsphere.sql.parser.mysql.visitor.impl
/**
* DML visitor for MySQL.
*/
public final class MySQLDMLVisitor extends MySQLVisitor implements
DMLVisitor {
@Override
public ASTNode visitCall(final CallContext ctx) {
return new MySQLCallStatement();
}
@Override
public ASTNode visitDoStatement(final DoStatementContext ctx) {
return new MySQLDoStatement();
}
}
```
## Tasks
1. Refine statement definition.
2. Implementation corresponding method in Visitor to builds a reasonable
Statement.
## Solutions
1. Think about a reasonable Statement definition
2. Complete the specify Statement Class
3. Implementation corresponding method in
Visitor(eg:shardingsphere/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/impl/MySQLDMLVisitor.java)
4. Add unit test for it.
## Note
We can discuss the reasonableness of the Statement definition and then
implement it.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]