diff --git a/batch/batch.go b/batch/batch.go index 5b793dcb..01e99f3d 100644 --- a/batch/batch.go +++ b/batch/batch.go @@ -46,6 +46,12 @@ func hasPrefixFold(s, sep string) bool { if len(s) < len(sep) { return false } + + // Forward lookup to see if the word continues. + if len(s) > len(sep) && unicode.IsLetter(rune(s[len(sep)])) { + return false + } + return strings.EqualFold(s[:len(sep)], sep) } diff --git a/batch/batch_test.go b/batch/batch_test.go index 51978283..00921770 100644 --- a/batch/batch_test.go +++ b/batch/batch_test.go @@ -67,6 +67,15 @@ select top 1 1`, select top 1 1`, }, }, + testItem{ + Sql: `PRINT 1 +GOTO Bookmark +GO +PRINT 2 +Bookmark: +GO`, + Expect: []string{"PRINT 1\nGOTO Bookmark\n", "\nPRINT 2\nBookmark:\n"}, + }, testItem{Sql: `"0'"`, Expect: []string{`"0'"`}}, testItem{Sql: "0'", Expect: []string{"0'"}}, testItem{Sql: "--", Expect: []string{"--"}},