-
Couldn't load subscription status.
- Fork 38.8k
Closed
Labels
in: dataIssues in data modules (jdbc, orm, oxm, tx)Issues in data modules (jdbc, orm, oxm, tx)in: testIssues in the test moduleIssues in the test moduletype: enhancementA general enhancementA general enhancement
Milestone
Description
Joram Agten opened SPR-9982 and commented
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.
Affects: 3.1.3
Issue Links:
- JdbcTestUtils should not interpret comments as a separate statement [SPR-9593] #14227 JdbcTestUtils should not interpret comments as a separate statement
- JdbcTestUtils readScript fails to see commented lines with tabs [SPR-10330] #14964 JdbcTestUtils readScript fails to see commented lines with tabs
- Support comments within SQL statements in ResourceDatabasePopulator [SPR-10075] #14708 Support comments within SQL statements in ResourceDatabasePopulator
- Support multi-line SQL comments in ResourceDatabasePopulator and JdbcTestUtils [SPR-9531] #14165 Support multi-line SQL comments in ResourceDatabasePopulator and JdbcTestUtils
- Improve comment handling in ResourceDatabasePopulator [SPR-9261] #13899 Improve comment handling in ResourceDatabasePopulator ("supersedes")
Metadata
Metadata
Assignees
Labels
in: dataIssues in data modules (jdbc, orm, oxm, tx)Issues in data modules (jdbc, orm, oxm, tx)in: testIssues in the test moduleIssues in the test moduletype: enhancementA general enhancementA general enhancement