Details
Description
Status Quo
Executing an SQL script via JdbcTestUtils.executeSqlScript() with the following content fails.
INSERT INTO persons( person_id , name) VALUES( 1 -- person_id , 'Name' --name );
org.springframework.jdbc.BadSqlGrammarException: StatementCallback; bad SQL grammar [INSERT INTO persons( person_id , name)VALUES( 1 - person_id , 'Name' --name)]; nested exception is java.sql.SQLSyntaxErrorException: ORA-00917: missing comma
Proposed Solutions
- keep the carriage returns after each line when building statements (line 388 389)
- strip all characters (per line) after the DEFAULT_COMMENT_PREFIX (including the prefix)
I think solution 1 is preferred, since 2 might become db dependent.
Deliverables
Ensure that multi-line statements which contain comments can be executed.
Attachments
Issue Links
- is related to
-
SPR-10330 JdbcTestUtils readScript fails to see commented lines with tabs
-
- Resolved
-
-
SPR-10075 Support comments within SQL statements in ResourceDatabasePopulator
-
- Resolved
-
-
SPR-9531 Support multi-line SQL comments in ResourceDatabasePopulator and JdbcTestUtils
-
- Closed
-
- relates to
-
SPR-9593 JdbcTestUtils should not interpret comments as a separate statement
-
- Closed
-
- supersedes
-
SPR-9261 Improve comment handling in ResourceDatabasePopulator
-
- Closed
-