Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-9261

Improve comment handling in ResourceDatabasePopulator

    XMLWordPrintable

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Duplicate
    • 3.1.1
    • None
    • Core
    • None
    • true

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

              sbrannen Sam Brannen
              koschder Lukas Kuster
              Spring Issues Spring Issues
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                3 years, 38 weeks, 2 days ago