djjd47130 / sql-executer

Execute Large SQL Scripts with GO Statements Using ADO
5 stars 2 forks source link

Cannot handle GO statements inside comment blocks #1

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a script with GO in a comment block (`/* GO */`)
2. Attempt to execute this script with component
3. You'll get syntax errors on both the prior and following block

The reason this does not work is simply because the parser cannot detect the 
beginning or end of comment blocks, and thus sees the `GO` statement ignoring 
the fact that it's inside a comment block.

This issue cannot be solved easily without performing a complete parse of all 
the SQL script, which would require much more extensive code and even libraries 
to do so. The goal of this tool is to be as light-weight as possible, so a 
complete parse will require a great deal of code to properly find comment 
blocks.

The work-around is to not attempt to execute scripts with this situation. Make 
sure scripts do not have `GO` statements inside of comment blocks.

Original issue reported on code.google.com by djjd47...@gmail.com on 20 Jul 2014 at 6:15

GoogleCodeExporter commented 9 years ago
Comment parsing added, to an extent. The most common comment block syntax is 
handled, but may still break in certain formats. Best to always keep start and 
end of comments on their own line. Inline comments have no need for parsing, as 
ADO already supports them.

Original comment by djjd47...@gmail.com on 20 Sep 2014 at 11:23

GoogleCodeExporter commented 9 years ago

Original comment by djjd47...@gmail.com on 21 Sep 2014 at 1:33