From 66e488850be2169e94c9daf161fb682094132ac2 Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Mon, 17 May 2021 11:58:54 +0200 Subject: [PATCH] Ignore comments when searching for statement delimiter in ScriptUtils This commit picks up where 569ce840cf left off, by correctly invoking the new containsStatementSeparator(...) method from executeSqlScript(...) in ScriptUtils in spring-r2dbc. See gh-26911 --- .../springframework/r2dbc/connection/init/ScriptUtils.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/spring-r2dbc/src/main/java/org/springframework/r2dbc/connection/init/ScriptUtils.java b/spring-r2dbc/src/main/java/org/springframework/r2dbc/connection/init/ScriptUtils.java index 5682b70177..3e6e99c6c1 100644 --- a/spring-r2dbc/src/main/java/org/springframework/r2dbc/connection/init/ScriptUtils.java +++ b/spring-r2dbc/src/main/java/org/springframework/r2dbc/connection/init/ScriptUtils.java @@ -472,7 +472,7 @@ public abstract class ScriptUtils { * (typically {@code "/*"}) * @param blockCommentEndDelimiter the end block comment delimiter * (typically "*/") - * @since 5.2.16 + * @since 5.3.8 */ private static boolean containsStatementSeparator(@Nullable EncodedResource resource, String script, String separator, String[] commentPrefixes, String blockCommentStartDelimiter, @@ -677,7 +677,9 @@ public abstract class ScriptUtils { if (separatorToUse == null) { separatorToUse = DEFAULT_STATEMENT_SEPARATOR; } - if (!EOF_STATEMENT_SEPARATOR.equals(separatorToUse) && !containsSqlScriptDelimiters(statement, separatorToUse)) { + if (!EOF_STATEMENT_SEPARATOR.equals(separatorToUse) && + !containsStatementSeparator(resource, statement, separatorToUse, commentPrefixes, + blockCommentStartDelimiter, blockCommentEndDelimiter)) { separatorToUse = FALLBACK_STATEMENT_SEPARATOR; } splitSqlScript(resource, statement, separatorToUse, commentPrefixes, blockCommentStartDelimiter,