Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve comment handling in ResourceDatabasePopulator [SPR-9261] #13899

Closed
spring-projects-issues opened this issue Mar 22, 2012 · 1 comment
Closed
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: duplicate A duplicate of another issue type: enhancement A general enhancement

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Mar 22, 2012

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:

Issue Links:

  • #13866 Spring JDBC: provide a simple utility API for loading parameterizable SQL strings from externalized Resources
  • #14964 JdbcTestUtils readScript fails to see commented lines with tabs ("is superseded by")
  • #14227 JdbcTestUtils should not interpret comments as a separate statement ("is superseded by")
  • #14616 Support comments within SQL statements in JdbcTestUtils ("is superseded by")
@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Sep 22, 2015

Sam Brannen commented

This issue has been superseded by #14227, #14616, and #14964.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: duplicate A duplicate of another issue type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants