Unverified Commit 1943f0eb authored by Licho's avatar Licho Committed by GitHub

fix: split problem (#3097)

parent 55d20eaa
...@@ -68,7 +68,7 @@ public class SystemConfiguration { ...@@ -68,7 +68,7 @@ public class SystemConfiguration {
.note(Status.SYS_FLINK_SETTINGS_USERESTAPI_NOTE); .note(Status.SYS_FLINK_SETTINGS_USERESTAPI_NOTE);
private final Configuration<String> sqlSeparator = key(Status.SYS_FLINK_SETTINGS_SQLSEPARATOR) private final Configuration<String> sqlSeparator = key(Status.SYS_FLINK_SETTINGS_SQLSEPARATOR)
.stringType() .stringType()
.defaultValue(";\\s*(?:\\n|--.*)") .defaultValue(";\\n")
.note(Status.SYS_FLINK_SETTINGS_SQLSEPARATOR_NOTE); .note(Status.SYS_FLINK_SETTINGS_SQLSEPARATOR_NOTE);
private final Configuration<Integer> jobIdWait = key(Status.SYS_FLINK_SETTINGS_JOBIDWAIT) private final Configuration<Integer> jobIdWait = key(Status.SYS_FLINK_SETTINGS_JOBIDWAIT)
.intType() .intType()
......
...@@ -45,7 +45,8 @@ public class SqlUtil { ...@@ -45,7 +45,8 @@ public class SqlUtil {
return new String[0]; 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(); String lastStatement = splits[splits.length - 1].trim();
if (lastStatement.endsWith(SEMICOLON)) { if (lastStatement.endsWith(SEMICOLON)) {
splits[splits.length - 1] = lastStatement.substring(0, lastStatement.length() - 1); splits[splits.length - 1] = lastStatement.substring(0, lastStatement.length() - 1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment