-
Notifications
You must be signed in to change notification settings - Fork 5
Description
Is there an existing issue for this?
- I have searched the existing issues
Library Version
6.0.0
What happened?
As referenced in #22, some of the tests on SqlCommandSplitter are inconsistent with the behaviour of SSMS and will split batches in places that they should not.
Test should_correctly_recognize_go_statements with input data GO\nGO--Dummy comment expects one batch to be
returned: GO--Dummy comment. Instead, no batches should be expected.
Test should_correctly_recognize_go_statements with input data GO--Dummy comment expects one batch to be returned: GO--Dummy comment (as above). Instead, no batches should be expected.
Test should_split_statements_on_go_and_handle_comments (input data below) splits on the line GO; - ending a batch separator line with a semicolon is explicitly disallowed ("Do not use a semicolon as a statement terminator after GO."). This should expect three batches (although the last one is invalid SQL).
Test should_split_statements_on_go_and_handle_comments has invalid SQL in the last batch. It's not strictly a batch-splitting problem, but it should probably be tidied up. I suspect the intended batch should start INSERT INTO TABLE [Foo] ([Text]) (with a closing ] on the column name).
/*
multi line comment 1.
GO
--
Other comment text
Go
*/
INSERT INTO A (GO) VALUES (1);
GO
--Single line Comment no end comment dashes GO
INSERT INTO A (X) VALUES ('GO');
GO;
--Single line Comment WITH END comment dashes GO --
INSERT INTO A (go) VALUES ('Go');
GO
INSERT INTO TABLE [Foo] ([Text)
VALUES (N'Some text. /*Strangely Emphasised Text*/ More text')