Browse Source
Prior to this commit, the implementations of ScriptUtils.containsSqlScriptDelimiters() in spring-jdbc and spring-r2dbc did not ignore comments when searching for the statement delimiter within an SQL script. This resulted in subtle bugs if a comment contained a single single-quote or single double-quote, since the absence of the closing single-quote or double-quote led the algorithm to believe that it was still "within a text literal". Similar issues could arise if a comment contained the sought statement delimiter but the rest of the script did not contain the sought statement delimiter. In such cases, the algorithms in ScriptUtils could erroneously choose an incorrect statement delimiter -- for example, using the fallback statement delimiter instead of the delimiter specified by the user. This commit avoids such bugs by ignoring single-line comments and block comments when searching for the statement delimiter within an SQL script. Closes gh-26911pull/26951/head
6 changed files with 167 additions and 15 deletions
Loading…
Reference in new issue