From 6f243d60416912fa773b16bf9eeb0b051e4da03f Mon Sep 17 00:00:00 2001 From: David Shiflet Date: Thu, 26 May 2022 12:54:32 -0400 Subject: [PATCH] do not treat \ as escape character in strings --- pkg/sqlcmd/batch.go | 4 ---- pkg/sqlcmd/batch_test.go | 1 + 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/pkg/sqlcmd/batch.go b/pkg/sqlcmd/batch.go index 545ee44e..7d564d49 100644 --- a/pkg/sqlcmd/batch.go +++ b/pkg/sqlcmd/batch.go @@ -242,10 +242,6 @@ func (b *Batch) readString(r []rune, i, end int, quote rune, line uint) (int, bo } else { return i, false, syntaxError(line) } - case quote == '\'' && c == '\\': - i++ - prev = 0 - continue case quote == '\'' && c == '\'' && next == '\'': i++ continue diff --git a/pkg/sqlcmd/batch_test.go b/pkg/sqlcmd/batch_test.go index 948c2a93..85a6796a 100644 --- a/pkg/sqlcmd/batch_test.go +++ b/pkg/sqlcmd/batch_test.go @@ -117,6 +117,7 @@ func TestReadString(t *testing.T) { // double quoted string {`"str\""`, 0, `"str\"`, true}, {` "str\"" `, 1, `"str\"`, true}, + {`'str\'`, 0, `'str\'`, true}, {`''''`, 0, `''''`, true}, {` '''' `, 1, `''''`, true}, {`''''''`, 0, `''''''`, true},