Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GO comments do not split commands properly without whitespace #8

Open
axu562 opened this issue Jan 8, 2021 · 0 comments
Open

GO comments do not split commands properly without whitespace #8

axu562 opened this issue Jan 8, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@axu562
Copy link

axu562 commented Jan 8, 2021

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.

@axu562 axu562 added the bug Something isn't working label Jan 8, 2021
@droyad droyad transferred this issue from DbUp/DbUp Jan 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Bugs
Development

No branches or pull requests

1 participant