Skip to content

Commit e5e54aa

Browse files
authored
do not treat \ as escape character in strings (#96)
1 parent 0d31f8b commit e5e54aa

File tree

2 files changed

+1
-4
lines changed

2 files changed

+1
-4
lines changed

pkg/sqlcmd/batch.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,10 +242,6 @@ func (b *Batch) readString(r []rune, i, end int, quote rune, line uint) (int, bo
242242
} else {
243243
return i, false, syntaxError(line)
244244
}
245-
case quote == '\'' && c == '\\':
246-
i++
247-
prev = 0
248-
continue
249245
case quote == '\'' && c == '\'' && next == '\'':
250246
i++
251247
continue

pkg/sqlcmd/batch_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ func TestReadString(t *testing.T) {
117117
// double quoted string
118118
{`"str\""`, 0, `"str\"`, true},
119119
{` "str\"" `, 1, `"str\"`, true},
120+
{`'str\'`, 0, `'str\'`, true},
120121
{`''''`, 0, `''''`, true},
121122
{` '''' `, 1, `''''`, true},
122123
{`''''''`, 0, `''''''`, true},

0 commit comments

Comments
 (0)