ScriptUtils#containsSqlScriptDelimiters() does not take into account escaped quotes when looking for delimiters in the script.
The delimiter in the following example won't be found, since the method gets out of step with the literals. The result being the fallback delimiter "\n" being used, breaking the script (since ScriptUtils will attempt to execute just the first line):
INSERT INTO some_table (id, val)
VALUES
(1,'this won\'t work');
Edit: This happens with a MySQL database. With HSQLDB I believe you can't escape quotes in this way, but rather with a second quote, which wouldn't exhibit the problem. If ScriptUtils is only meant to be used with HSQLDB then apologies, and please close this!
Edit: This happens with a MySQL database. With HSQLDB I believe you can't escape quotes in this way, but rather with a second quote, which wouldn't exhibit the problem. If ScriptUtils is only meant to be used with HSQLDB then apologies, and please close this!
ScriptUtils is not limited to use with embedded databases such as H2 or HSQLDB. In general we try to make ScriptUtils usable with most mainstream relational databases, whenever feasible.
geordiecoder opened SPR-17120 and commented
ScriptUtils#containsSqlScriptDelimiters()
does not take into account escaped quotes when looking for delimiters in the script.The delimiter in the following example won't be found, since the method gets out of step with the literals. The result being the fallback delimiter
"\n"
being used, breaking the script (sinceScriptUtils
will attempt to execute just the first line):Edit: This happens with a MySQL database. With HSQLDB I believe you can't escape quotes in this way, but rather with a second quote, which wouldn't exhibit the problem. If
ScriptUtils
is only meant to be used with HSQLDB then apologies, and please close this!Reference URL: #1919
Referenced from: commits bdac391, 24ed6de
The text was updated successfully, but these errors were encountered: