Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Horton.exe was using this code to split up .sql files into statements to be processed: public static string[] ParseSqlScript(string script) { var regex = new Regex("^GO", RegexOptions.IgnoreCase | RegexOptions.Multiline); return regex.Split(script); } Therefore, a line beginning with "GO" would split up batches to be executed. This is fine, except when we have a large sql file that contains line breaks. Say, something like this: INSERT INTO [MyTable] ([Description]) VALUES ('Blah blah blah Goods connected directly with Blah blah blah'); Did you spot it? One of the lines begins with "Goods connected directly..." which matches the regex "^GO". So that insert statement will be split in two and cause an error because of mismatched quote marks. The solution is to fix the regex in horton.exe by using a negative lookahead for a non-whitespace character: var regex = new Regex("^GO(?!\\S)", RegexOptions.IgnoreCase | RegexOptions.Multiline);
- Loading branch information
02c7a95
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
However, I did just realize this would still cause a failure:
INSERT INTO [MyTable] ([Description]) VALUES ('Blah blah blah
Go to the store
Blah blah blah');