Commit Graph

15 Commits

Author SHA1 Message Date
7647c2b9b0 parser: parse gbk encoding SQL token by token instead of the whole SQL (#31039)
close pingcap/tidb#30765
2021-12-28 22:07:49 +08:00
b4df7ca4dc test: make all the tests run in serial (#30692) 2021-12-14 18:06:36 +08:00
9a780a2138 parser: migrate test-infra to testify (#29087) 2021-10-27 19:28:49 +08:00
xhe
94e30df8e2 parser: fix compiling, add unit tests (#28700) 2021-10-11 23:15:25 +08:00
6b60fb9717 [parser] *: Add Digest struct to get bytes of digest (#1231) 2021-10-09 14:53:23 +08:00
7515d165a3 [parser] parser: regard NULL as literal when normalizing query (#1166)
* parser: regard NULL as literal when normalizing queries

Currently, Normalize() converts "SELECT NULL" to "select null", while NULL is
regarded as a literal in MySQL, as described in the documentation.
https://dev.mysql.com/doc/refman/8.0/en/literals.html
It seems natural that Normalize() would convert "SELECT NULL" to "select ?"
from the consistency viewpoint.

* Handle case of 'select `null`'

* Fix quotation

Co-authored-by: Arenatlx <ailinsilence4@gmail.com>
Co-authored-by: kennytm <kennytm@gmail.com>
2021-10-09 14:53:23 +08:00
b3efddbbec [parser] digest: add missed backquote when getting digest (#1176)
* fix test

* add test
2021-10-09 14:53:23 +08:00
9c4959a061 [parser] lexer: quote identifier when get sql digest (#1151)
* fix

* fix

* Update digester.go

Co-authored-by: kennytm <kennytm@gmail.com>

Co-authored-by: kennytm <kennytm@gmail.com>
2021-10-09 14:53:23 +08:00
5d55a9dd61 [parser] digester: keep the singleAtIdentifier in normalize (#1128) 2021-10-09 14:53:23 +08:00
8d06dff8f2 [parser] digester: consider paramMarker as literal when normalizing SQL (#1040)
* digester: consider paramMarker when normalizing SQL

* add tests

* delete unnecessary changes

Co-authored-by: Kenan Yao <cauchy1992@gmail.com>
2021-10-09 14:53:23 +08:00
02e3e4fb03 [parser] fix / in normalize (#790) 2021-10-09 14:53:23 +08:00
a7ac29bd99 [parser] parser: introduce DigestNormalized and deprecate DigestHash (#656) 2021-10-09 14:53:23 +08:00
824bc91f46 [parser] digester: avoid infinite loop when an invalid token is seen (#313) 2021-10-09 14:53:23 +08:00
f6cb990bb0 [parser] normalize and generate digest at same time (#215) 2021-10-09 14:53:23 +08:00
fee9359019 [parser] support sql digest (#32) 2021-10-09 14:53:23 +08:00