dongzl opened a new issue #13650:
URL: https://github.com/apache/shardingsphere/issues/13650
## Feature Request
**For English only**, other languages will not accept.
Please pay attention on issues you submitted, because we maybe need more
details.
If no response anymore and we cannot make decision by current information,
we will **close it**.
Please answer these questions before submitting your issue. Thanks!
Hi, shardingsphere community:
Now, some of MySQL DAL showXXX statement have the same filter segment, for
example:
```
SHOW PROCEDURE STATUS
[LIKE 'pattern' | WHERE expr]
```
```
SHOW FUNCTION STATUS
[LIKE 'pattern' | WHERE expr]
```
They have the same filter segment. But in the code , have the duplicate
code, for example:
```
/**
* MySQL show procedure status statement.
*/
@Setter
@ToString
public final class MySQLShowProcedureStatusStatement extends
AbstractSQLStatement implements DALStatement, MySQLStatement {
private ShowLikeSegment like;
private WhereSegment where;
/**
* Get like segment.
*
* @return like segment
*/
public Optional<ShowLikeSegment> getLike() {
return Optional.ofNullable(like);
}
/**
* Get where segment.
*
* @return where segment
*/
public Optional<WhereSegment> getWhere() {
return Optional.ofNullable(where);
}
}
```
```
@Setter
@ToString
public final class MySQLShowFunctionStatusStatement extends
AbstractSQLStatement implements DALStatement, MySQLStatement {
private ShowLikeSegment like;
private WhereSegment where;
/**
* Get like segment.
*
* @return like segment
*/
public Optional<ShowLikeSegment> getLike() {
return Optional.ofNullable(like);
}
/**
* Get where segment.
*
* @return where segment
*/
public Optional<WhereSegment> getWhere() {
return Optional.ofNullable(where);
}
}
```
I want to define a `ShowFilterSegment` class, and compose the
`ShowLikeSegment` and `WhereSegment` into `ShowFilterSegment`,like this:
```
public class ShowFilterSegment implements SQLSegment {
private final int startIndex;
private final int stopIndex;
private ShowLikeSegment like;
private WhereSegment where;
}
```
```
@Setter
@ToString
public final class MySQLShowFunctionStatusStatement extends
AbstractSQLStatement implements DALStatement, MySQLStatement {
private ShowFilterSegment filter;
/**
* Get filter segment.
*
* @return filter segment
*/
public Optional<ShowFilterSegment> getFilter() {
return Optional.ofNullable(filter);
}
}
```
Do you think this is a good idea? please give me some advices.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]