Skip to content

Commit

Permalink
sqlparser: fix double single-quote escaping in string literals
Browse files Browse the repository at this point in the history
Signed-off-by: Mahdi Dibaiee <mdibaiee@pm.me>
  • Loading branch information
mdibaiee committed Jul 23, 2024
1 parent a5a1706 commit c5d8504
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions go/vt/sqlparser/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,8 @@ func (tkn *Tokenizer) Scan() (int, string) {
}
return int(ch), ""
case '\'':
return tkn.scanString(ch, STRING)
var t, s = tkn.scanString(ch, STRING)
return t, s
case '"':
return tkn.scanLiteralIdentifier()
default:
Expand Down Expand Up @@ -551,8 +552,9 @@ func (tkn *Tokenizer) scanString(delim uint16, typ int) (int, string) {
if tkn.peek(1) != delim {
tkn.skip(1)
return typ, tkn.buf[start : tkn.Pos-1]
} else {
tkn.skip(1)
}
fallthrough

case eofChar:
return LEX_ERROR, tkn.buf[start:tkn.Pos]
Expand Down

0 comments on commit c5d8504

Please sign in to comment.