You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2021/11/16 14:25:17 UTC

[GitHub] [shardingsphere] dongzl opened a new issue #13650: Refactor the MySQL DAL showXXX statement‘s showLike & showWhereClause segment.

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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] strongduanmu commented on issue #13650: Refactor the MySQL DAL showXXX statement‘s showLike & showWhereClause segment.

Posted by GitBox <gi...@apache.org>.
strongduanmu commented on issue #13650:
URL: https://github.com/apache/shardingsphere/issues/13650#issuecomment-971072892


   @dongzl I think this solution is ok, it can effectively reduce duplication of code.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] dongzl commented on issue #13650: Refactor the MySQL DAL showXXX statement‘s showLike & showWhereClause segment.

Posted by GitBox <gi...@apache.org>.
dongzl commented on issue #13650:
URL: https://github.com/apache/shardingsphere/issues/13650#issuecomment-971361836


   > @dongzl I think this solution is ok, it can effectively reduce duplication of code.
   
   @strongduanmu , Thank you for your replay, I will list the statement and refactor them.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] dongzl closed issue #13650: Refactor the MySQL DAL showXXX statement‘s showLike & showWhereClause segment.

Posted by GitBox <gi...@apache.org>.
dongzl closed issue #13650:
URL: https://github.com/apache/shardingsphere/issues/13650


   


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org