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 2019/09/24 02:20:15 UTC

[GitHub] [incubator-shardingsphere] yanyzy commented on a change in pull request #3093: Fix SCTL statement execute error with comments

yanyzy commented on a change in pull request #3093: Fix SCTL statement execute error with comments
URL: https://github.com/apache/incubator-shardingsphere/pull/3093#discussion_r327401965
 
 

 ##########
 File path: sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/text/TextProtocolBackendHandlerFactory.java
 ##########
 @@ -60,8 +66,9 @@
      * @return instance of text protocol backend handler
      */
     public static TextProtocolBackendHandler newInstance(final DatabaseType databaseType, final String sql, final BackendConnection backendConnection) {
-        if (sql.toUpperCase().startsWith(ShardingCTLBackendHandlerFactory.SCTL)) {
-            return ShardingCTLBackendHandlerFactory.newInstance(sql, backendConnection);
+        final String trimCommentSQL = trimSqlComment(sql);
+        if (trimCommentSQL.toUpperCase().startsWith(ShardingCTLBackendHandlerFactory.SCTL)) {
+            return ShardingCTLBackendHandlerFactory.newInstance(trimCommentSQL, backendConnection);
 
 Review comment:
   Yes, it looks clearer. but if sql is like 
   ```bash
   select x from table where z="sctl:"
   ```
   this situation is rare but also possible.
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services