-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Closed
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)status: duplicateA duplicate of another issueA duplicate of another issuetype: enhancementA general enhancementA general enhancement
Description
Lukas Kuster opened SPR-9261 and commented
The ResourceDatabasePopulator currently strips comments from an SQL file, but only if they start at the beginning of the line. If they are indented, or if they are placed on the same line after an SQL statement, they are left in the script and can be wrapped in with the following SQL statement, depending on the statement separator used.
E.g. in the following script, the comments at lines 2 and 3 would both be wrapped in with the insert statement on line 4, causing it to not be executed properly.
-- leading comment
insert into T_TEST (NAME) values ('Keith'); -- comment at EOL
-- indented comment
insert into T_TEST (NAME) values ('Dave');With the attached patch the ResourceDatabasePopulator removes all comments from an SQL file. A unit test illustrating the behaviour is included.
Affects: 3.1.1
Attachments:
- ResourceDatabasePopulator.patch (4.36 kB)
Issue Links:
- Spring JDBC: provide a simple utility API for loading parameterizable SQL strings from externalized Resources [SPR-9228] #13866 Spring JDBC: provide a simple utility API for loading parameterizable SQL strings from externalized Resources
- JdbcTestUtils readScript fails to see commented lines with tabs [SPR-10330] #14964 JdbcTestUtils readScript fails to see commented lines with tabs ("is superseded by")
- JdbcTestUtils should not interpret comments as a separate statement [SPR-9593] #14227 JdbcTestUtils should not interpret comments as a separate statement ("is superseded by")
- Support comments within SQL statements in JdbcTestUtils [SPR-9982] #14616 Support comments within SQL statements in JdbcTestUtils ("is superseded by")
Metadata
Metadata
Assignees
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)status: duplicateA duplicate of another issueA duplicate of another issuetype: enhancementA general enhancementA general enhancement