tristaZero commented on a change in pull request #11874:
URL: https://github.com/apache/shardingsphere/pull/11874#discussion_r690964181



##########
File path: 
shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/util/SQLUtil.java
##########
@@ -256,4 +260,21 @@ public static ExpressionSegment 
createLiteralExpression(final ASTNode astNode, f
     public static String trimSemicolon(final String sql) {
         return sql.endsWith(SQL_END) ? sql.substring(0, sql.length() - 1) : 
sql;
     }
+    
+    /**
+     * Trim the comment of sql.
+     *
+     * @param sql SQL to be trim
+     * @return remove comment from SQL
+     */
+    public static String trimComment(final String sql) {
+        String result = sql;
+        if (sql.startsWith(COMMENT_PREFIX)) {
+            result = result.substring(sql.indexOf(COMMENT_SUFFIX) + 2);
+        }
+        if (sql.endsWith(SQL_END)) {
+            result = result.substring(0, result.length() - 1);
+        }
+        return result.trim();

Review comment:
       Why do we need to remove the comment from the SQL?




-- 
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]


Reply via email to