You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "hailin0 (via GitHub)" <gi...@apache.org> on 2024/06/17 07:36:12 UTC

Re: [PR] [connector-jdbc][bugfix] fix mysql create table comment special string bug [seatunnel]

hailin0 commented on code in PR #6998:
URL: https://github.com/apache/seatunnel/pull/6998#discussion_r1642326872


##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/catalog/mysql/MysqlCreateTableSqlBuilder.java:
##########
@@ -191,7 +191,10 @@ private String buildColumnIdentifySql(Column column, String catalogName) {
         }
 
         if (column.getComment() != null) {
-            columnSqls.add("COMMENT '" + column.getComment() + "'");
+            columnSqls.add(
+                    "COMMENT '"
+                            + column.getComment().replace("'", "''").replace("\\", "\\\\")

Review Comment:
   还有别的字符需要处理吗



-- 
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: commits-unsubscribe@seatunnel.apache.org

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