Skip to content

Commit

Permalink
fix: split problem (#3097)
Browse files Browse the repository at this point in the history
  • Loading branch information
leechor authored Jan 30, 2024
1 parent 55d20ea commit 1943f0e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public static Configuration.OptionBuilder key(Status status) {
.note(Status.SYS_FLINK_SETTINGS_USERESTAPI_NOTE);
private final Configuration<String> sqlSeparator = key(Status.SYS_FLINK_SETTINGS_SQLSEPARATOR)
.stringType()
.defaultValue(";\\s*(?:\\n|--.*)")
.defaultValue(";\\n")
.note(Status.SYS_FLINK_SETTINGS_SQLSEPARATOR_NOTE);
private final Configuration<Integer> jobIdWait = key(Status.SYS_FLINK_SETTINGS_JOBIDWAIT)
.intType()
Expand Down
3 changes: 2 additions & 1 deletion dinky-common/src/main/java/org/dinky/utils/SqlUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ public static String[] getStatements(String sql, String sqlSeparator) {
return new String[0];
}

String[] splits = sql.replace("\r\n", "\n").split(sqlSeparator);
final String localSqlSeparator = ";\\s*(?:\\n|--.*)";
String[] splits = sql.replace("\r\n", "\n").split(localSqlSeparator);
String lastStatement = splits[splits.length - 1].trim();
if (lastStatement.endsWith(SEMICOLON)) {
splits[splits.length - 1] = lastStatement.substring(0, lastStatement.length() - 1);
Expand Down

0 comments on commit 1943f0e

Please sign in to comment.