Skip to content

GO comments do not split commands properly without whitespace #8

Open
@axu562

Description

@axu562

If a script contains comments directly followed by or preceded by a GO statement, the script will not split into commands properly and does not remove the GO. This can be remedied by introducing whitespace around the GO, but as this is valid sql syntax this whitespace should not be necessary.

Code to reproduce:

var sut = new SqlCommandSplitter();
var commands = sut.SplitScriptIntoCommands("/*comment*/GO--comment").ToArray();
var expectedResult = new string[] { "/*comment*/", "--comment"};
Debug.Assert(Enumerable.SequenceEqual(commands, expectedResult));

Expected behavior:
As this is valid sql syntax, the GO should be removed and the resulting commands should be parsed as in expectedResult.

Actual behavior:
Fails, as the SplitScriptIntoCommands function returns the entire string, including the GO, as one command.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Bugs

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions