<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=iwright" rel="nofollow">Ian Wright</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-9531?redirect=false" rel="nofollow">SPR-9531</a></strong> and commented</p>
<h4 dir="auto">Overview</h4>
<p dir="auto">When executing SQL scripts using <code class="notranslate">ResourceDatabasePopulator</code> or <code class="notranslate">JdbcTestUtils</code> errors may occur if there are block comments in the file. In general multi-line comments using the <code class="notranslate">/* ... */</code> syntax are not explicitly supported.</p>
<h4 dir="auto">Notes</h4>
<p dir="auto">Proper support for standard SQL comments (i.e., any text beginning with two hyphens and extending to the end of the line) was introduced in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398154744" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/14616" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/14616/hovercard" href="https://github.com/spring-projects/spring-framework/issues/14616">#14616</a> and <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398155431" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/14708" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/14708/hovercard" href="https://github.com/spring-projects/spring-framework/issues/14708">#14708</a>. However, neither <code class="notranslate">ResourceDatabasePopulator</code> nor <code class="notranslate">JdbcTestUtils</code> contains <em>explicit</em> support for multi-line SQL comments.</p>
<h4 dir="auto">Deliverables</h4>
<ol class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Extract common functionality related to script parsing from <code class="notranslate">ResourceDatabasePopulator</code> and <code class="notranslate">JdbcTestUtils</code> into a new <code class="notranslate">public</code> component or utility in the <code class="notranslate">org.springframework.jdbc.datasource.init</code> package in the <code class="notranslate">spring-jdbc</code> module.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Support multi-line SQL comments in the component extracted in the previous deliverable.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Make the start and end delimiters for block comments configurable.</li>
</ol>
<hr>
<p dir="auto"><strong>Affects:</strong> 3.1.1</p>
<p dir="auto"><strong>Issue Links:</strong></p>
<ul dir="auto">
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398167565" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/16310" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/16310/hovercard" href="https://github.com/spring-projects/spring-framework/issues/16310">#16310</a> Support EOF as statement separator in SQL scripts (<em><strong>"is depended on by"</strong></em>)</li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398166591" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/16184" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/16184/hovercard" href="https://github.com/spring-projects/spring-framework/issues/16184">#16184</a> SQL Scripts with newline separators no longer work</li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398154744" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/14616" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/14616/hovercard" href="https://github.com/spring-projects/spring-framework/issues/14616">#14616</a> Support comments within SQL statements in JdbcTestUtils</li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398155431" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/14708" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/14708/hovercard" href="https://github.com/spring-projects/spring-framework/issues/14708">#14708</a> Support comments within SQL statements in ResourceDatabasePopulator</li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398214643" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/20450" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/20450/hovercard" href="https://github.com/spring-projects/spring-framework/issues/20450">#20450</a> H2 aliases are not supported in SQL ScriptUtils</li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398166221" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/16144" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/16144/hovercard" href="https://github.com/spring-projects/spring-framework/issues/16144">#16144</a> Support custom comment prefix in JdbcTestUtils.executeSqlScript()</li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398166622" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/16188" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/16188/hovercard" href="https://github.com/spring-projects/spring-framework/issues/16188">#16188</a> Introduce SQL script exception hierarchy</li>
</ul>
<p dir="auto"><strong>Referenced from:</strong> commits <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/spring-projects/spring-framework/commit/01b2f67f11207c5007164518a83fcfb546b36837/hovercard" href="https://github.com/spring-projects/spring-framework/commit/01b2f67f11207c5007164518a83fcfb546b36837"><tt>01b2f67</tt></a>, <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/spring-projects/spring-framework/commit/7853e74e786efda8aea70a5a0e79385a0c5d5cc9/hovercard" href="https://github.com/spring-projects/spring-framework/commit/7853e74e786efda8aea70a5a0e79385a0c5d5cc9"><tt>7853e74</tt></a>, <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/spring-projects/spring-framework/commit/9230b38aea41316d78dc2f1bb206ce7a92b9ca56/hovercard" href="https://github.com/spring-projects/spring-framework/commit/9230b38aea41316d78dc2f1bb206ce7a92b9ca56"><tt>9230b38</tt></a>, <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/spring-projects/spring-framework/commit/cc0ae3a881dde5910ecc340fa20c2365dd7474fa/hovercard" href="https://github.com/spring-projects/spring-framework/commit/cc0ae3a881dde5910ecc340fa20c2365dd7474fa"><tt>cc0ae3a</tt></a>, <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/spring-projects/spring-framework/commit/fbd25467c47fcda1e4d500e1cc3ede3d8ca7f61e/hovercard" href="https://github.com/spring-projects/spring-framework/commit/fbd25467c47fcda1e4d500e1cc3ede3d8ca7f61e"><tt>fbd2546</tt></a>, <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/spring-projects/spring-framework/commit/bb67cd4657ee288d9a0a80c8e81f24308a6b1c0a/hovercard" href="https://github.com/spring-projects/spring-framework/commit/bb67cd4657ee288d9a0a80c8e81f24308a6b1c0a"><tt>bb67cd4</tt></a>, <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/spring-projects/spring-framework/commit/2bfd6ddcf4de600942a7564a43a338febd4267f2/hovercard" href="https://github.com/spring-projects/spring-framework/commit/2bfd6ddcf4de600942a7564a43a338febd4267f2"><tt>2bfd6dd</tt></a>, <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/spring-projects/spring-framework/commit/e5c17560db71996157f52baada68c8a294c95d10/hovercard" href="https://github.com/spring-projects/spring-framework/commit/e5c17560db71996157f52baada68c8a294c95d10"><tt>e5c1756</tt></a></p>
<p dir="auto">2 votes, 10 watchers</p>
<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=sbrannen" rel="nofollow">Sam Brannen</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-10075?redirect=false" rel="nofollow">SPR-10075</a></strong> and commented</p>
<h4 dir="auto">Status Quo</h4>
<p dir="auto">The deficiency addressed by this issue is the same as that described in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398154744" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/14616" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/14616/hovercard" href="https://github.com/spring-projects/spring-framework/issues/14616">#14616</a> but for <code class="notranslate">ResourceDatabasePopulator</code>.</p>
<h4 dir="auto">Deliverables</h4>
<p dir="auto">Refactor <code class="notranslate">ResourceDatabasePopulator.splitSqlScript(String, String, String, List)</code> so that:</p>
<ol class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Standard SQL comments (i.e., any text beginning with two hyphens and extending to the end of the line) are properly omitted from the statement before executing it.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Multiple adjacent whitespace characters within a statement but outside a literal are collapsed into a single space.</li>
</ol>
<hr>
<p dir="auto"><strong>Affects:</strong> 3.1.3</p>
<p dir="auto"><strong>Issue Links:</strong></p>
<ul dir="auto">
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398154744" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/14616" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/14616/hovercard" href="https://github.com/spring-projects/spring-framework/issues/14616">#14616</a> Support comments within SQL statements in JdbcTestUtils</li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398151372" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/14165" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/14165/hovercard" href="https://github.com/spring-projects/spring-framework/issues/14165">#14165</a> Support multi-line SQL comments in ResourceDatabasePopulator and JdbcTestUtils</li>
</ul>
<p dir="auto"><strong>Referenced from:</strong> commits <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/spring-projects/spring-framework/commit/8a422f48c658b8574ed36a9232e8de53c576ea48/hovercard" href="https://github.com/spring-projects/spring-framework/commit/8a422f48c658b8574ed36a9232e8de53c576ea48"><tt>8a422f4</tt></a>, <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/spring-projects/spring-framework/commit/aa16caa2ac54b72b28c4149bd9dc992f1e09ee8b/hovercard" href="https://github.com/spring-projects/spring-framework/commit/aa16caa2ac54b72b28c4149bd9dc992f1e09ee8b"><tt>aa16caa</tt></a></p>