Skip to content

Commit

Permalink
sqlparser/scanString: fix double single quotes showing up twice
Browse files Browse the repository at this point in the history
Signed-off-by: Mahdi Dibaiee <[email protected]>
  • Loading branch information
mdibaiee committed Jul 23, 2024
1 parent c5d8504 commit 3578998
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions go/vt/sqlparser/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -545,13 +545,15 @@ exit:
// will fall back to scanStringSlow
func (tkn *Tokenizer) scanString(delim uint16, typ int) (int, string) {
start := tkn.Pos
var buf strings.Builder

for {
switch tkn.cur() {
ch := tkn.cur()
switch ch {
case delim:
if tkn.peek(1) != delim {
tkn.skip(1)
return typ, tkn.buf[start : tkn.Pos-1]
return typ, buf.String()
} else {
tkn.skip(1)
}
Expand All @@ -560,6 +562,7 @@ func (tkn *Tokenizer) scanString(delim uint16, typ int) (int, string) {
return LEX_ERROR, tkn.buf[start:tkn.Pos]
}

buf.WriteByte(byte(ch))
tkn.skip(1)
}
}
Expand Down

0 comments on commit 3578998

Please sign in to comment.