Skip to content

Function batch.Split() splits on wrong separator #247

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

Open
flaviopicci opened this issue Apr 3, 2025 · 0 comments
Open

Function batch.Split() splits on wrong separator #247

flaviopicci opened this issue Apr 3, 2025 · 0 comments

Comments

@flaviopicci
Copy link

flaviopicci commented Apr 3, 2025

Describe the bug
Function batch.Split(sqlString, "GO") wrongly splits the sqlString on all go occourrecnces, even if it's part of a statement, like goto or columns identifiers, like gone.

To Reproduce
Call batch.Split(sqlString, "GO") with an sqlString that has goXXX as identifier on an newline.
E.g.:

sqlString = `
select 1
go
select
  gone_ts
from t
go`

statements := batch.Split(sqlString, "GO")
// statements = ["\nselect 1\n", "\nselect\n  ", "ne_ts\nfrom t\n"]

Expected behavior
I would expect statements from above to be

// statements = ["\nselect 1\n", "\nselect\n  gone_ts\nfrom t\n"]

Further technical details

go-mssqldb version: 1.8.0
SQL Server version: N/A
Operating system: N/A

flaviopicci pushed a commit to flaviopicci/go-mssqldb that referenced this issue Apr 3, 2025
flaviopicci pushed a commit to flaviopicci/go-mssqldb that referenced this issue Apr 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant