Commit Graph

80 Commits

Author SHA1 Message Date
9ffeff2857 types: convert to new charset before inserting to blob or json column (#31031)
close pingcap/tidb#30690
2021-12-30 21:35:50 +08:00
3d89ddc517 lexer: handle escape under no_backslash_SQL mode (#31111)
close pingcap/tidb#31119
2021-12-29 18:07:50 +08:00
4dec85cce3 parser: convert identifier to utf8mb4 charset (#31108)
close pingcap/tidb#31113
2021-12-29 16:07:50 +08:00
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
61d13b561c encoding: skip utf8 charset validation in some cases (#31061)
close pingcap/tidb#31014
2021-12-28 17:51:49 +08:00
ab35db14a6 *: refactor encoding and uniform usages (#30288) 2021-12-20 15:27:46 +08:00
e2e6e5561b encoding: refactor the character encoding (#29935) 2021-11-22 16:59:49 +08:00
5f340b88c9 parser: format error message during parsing when meet a big value. (#28791) 2021-11-18 00:51:47 +08:00
412dd4f763 parser: refactor Parse() interface to make it extensible (#28975) 2021-10-21 10:56:45 +08:00
9f8c053d06 parser: refactor encode and decode (#28917)
* refactor encoding

* add a simple test case for encoding

Co-authored-by: tangenta <tangenta@126.com>
Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>
2021-10-19 15:50:33 +08:00
ad8fbb4549 parser: remove souspicious switch break in lexer (#28885) 2021-10-19 14:42:43 +08:00
xhe
94e30df8e2 parser: fix compiling, add unit tests (#28700) 2021-10-11 23:15:25 +08:00
99525690f1 [parser] Implement interface for acquiring literal value (#1350) 2021-10-09 14:53:23 +08:00
bd299b990e [parser] charset: fix Encoding.Encode() and add some tests (#1344) 2021-10-09 14:53:23 +08:00
ba105bbd10 [parser] support parsing SQL with encodings other than utf8 (#1312) 2021-10-09 14:53:23 +08:00
a34970d9da [parser] goyacc: add a config option to skip text position recording (#1300) 2021-10-09 14:53:23 +08:00
3ed80be1c4 [parser] restore: support restoring SQL wrapping with TiDB special comments (#1287) 2021-10-09 14:53:23 +08:00
62174bb0ae [parser] fix lexer bug (#1228)
Co-authored-by: ti-srebot <66930949+ti-srebot@users.noreply.github.com>
2021-10-09 14:53:23 +08:00
ed312bd0dd [parser] lexer: fix lexer get wrong token (#1222) 2021-10-09 14:53:23 +08:00
b6c5ada1d5 [parser] *: add as of clause for SET and SELECT (#1206)
* *: add as of clause

Signed-off-by: nolouch <nolouch@gmail.com>

* resolve shift-reduce conflict

* *: fix and try to add test

Signed-off-by: nolouch <nolouch@gmail.com>

* *: add timestamp

Signed-off-by: nolouch <nolouch@gmail.com>

* make as of to token

Signed-off-by: nolouch <nolouch@gmail.com>

* address comments

Signed-off-by: nolouch <nolouch@gmail.com>

* add test

Signed-off-by: nolouch <nolouch@gmail.com>

* make of as Reserved(from mysql 8.0)

Signed-off-by: nolouch <nolouch@gmail.com>

* add set test case

Signed-off-by: nolouch <nolouch@gmail.com>

* address comment

Signed-off-by: nolouch <nolouch@gmail.com>

Co-authored-by: tangenta <tangenta@126.com>
2021-10-09 14:53:23 +08:00
634199be7f [parser] lexer: reset identifierDot to false in QuotedIdent (#1135) 2021-10-09 14:53:23 +08:00
5e0bbb8eb8 [parser] lexer: treat dot differently in different context (#1132)
* fix lexer

* fix lexer

* fix lexer

* fix lexer

* fix lexer

* update test

Co-authored-by: ti-srebot <66930949+ti-srebot@users.noreply.github.com>
2021-10-09 14:53:23 +08:00
d2352cfd0d [parser] fix create binding for update with hint (#1117) 2021-10-09 14:53:23 +08:00
90606e4b55 [parser] Fix syntax error caused by unexpected hint (#1004)
* fix 987

* fix CI

* fix CI
2021-10-09 14:53:23 +08:00
02e3e4fb03 [parser] fix / in normalize (#790) 2021-10-09 14:53:23 +08:00
6cd14a0c30 [parser] lexer: replace version comments with feature-ids mechanism (#777)
* lexer: replace version comments with feature-ids mechanism

* tests: retain the original version digit test

* fix scanVersionDigits

* add SpecialCommentsController to decide what comments can be parsed

* only ignore comments with unsupported feature-id

* remove debug log
2021-10-09 14:53:23 +08:00
5cfb690491 [parser] Rewrite special comment parser (#711)
* lexer: added a function to scan version digits

* lexer: removed special comment scanner

Instead, simply strip off '/*!' and the pairing '*/'.

Temporarily disabled handling of /*+ ... */

* lexer: support collecting the entire /*+ ... */ as a single token

This new token has type `hintComment`. The actual hint will be parsed
lazily.

* lexer,yy_parser: move lastErrorAsWarn() from Parser into Scanner

* goyacc: do not allow conflict, support changing parser type name

change the "DO NOT EDIT" line to fit the Go standard

* parser,hintparser: created a new parser just for parsing optimizer hints

deleted all optimizer hint rules from parser.go

refactor the Makefile to support building both parsers (also deleted some
outdated fixup of *parser.go)

* lexer: fix comment parser

* codecov: don't wait for integration test before showing the coverage

* lexer: fix comment parsing again

* hintparser: TiDB still expects `HASH_JOIN(@qb1 foo@qb2)` to be valid :(

* parser,hintparser: provide the true line/column offset in the warnings

cache the hintparser in the main parser to avoid repeated allocation

* lexer: delete unused sqlOffsetInComment()
2021-10-09 14:53:23 +08:00
385d05ce3e [parser] parser: support syntax for AUTO_RANDOM (#571) 2021-10-09 14:53:23 +08:00
d2debf2fdf [parser] parse until eof (#367) 2021-10-09 14:53:23 +08:00
9ff76dabcb [parser] Fix several lexer bugs involving special comments (#342)
* lexer: ensure /*! ... */ follow the same SQL mode as original parser
* lexer: forward stmtText() to specialComment parser if exists
* lexer: ensure invalid tokens in optimizer hint won't loop the parser
2021-10-09 14:53:23 +08:00
c938f62ea5 [parser] parser: add charset validation (TiDB #4436) (#220)
* Add charset validation in pattern `CharsetName`, and use it in syntax `CONVERT(expr USING transcoding_name)` and `CHAR(N USING charset_name)`.
* Modify `yyLexer` interface to return different types of error.
2021-10-09 14:53:23 +08:00
01abdb1fbd [parser] parser: fix lexer that treat 9eTSs as a float (#208) 2021-10-09 14:53:23 +08:00
fee9359019 [parser] support sql digest (#32) 2021-10-09 14:53:23 +08:00
24980bb2dd [parser] improve syntax error message (#175) 2021-10-09 14:53:23 +08:00
2876e287c8 [parser] better error message (#1) (#133) 2021-10-09 14:53:23 +08:00
433fd2d301 [parser] lexer: recognize "@@system var" and fix start offset of "@user var" (#112) 2021-10-09 14:53:23 +08:00
8862bb53b1 [parser] ignore hint when meet unknow token in hint (#80) 2021-10-09 14:53:23 +08:00
6e9eb8642d [parser] parser: support disable window function parser (#60) 2021-10-09 14:53:23 +08:00
8d82156a1c [parser] parser: support identifiers for window function (#18) 2021-10-09 14:53:23 +08:00
c270f55405 [parser] *: move github.com/pingcap/tidb/parser here (#1) 2021-10-09 14:53:23 +08:00
89dda9d9a8 *: move parser to a separate repository (#8036) 2018-10-25 11:12:10 +08:00
a18d27ea14 parser: fix single line comment end with newline (#7612) 2018-09-05 10:29:11 +08:00
fd3706148f lexer: support more syntaxes regarding 'SET Syntax' (#7020) 2018-07-10 18:20:33 +08:00
f21ac4af5f parser: allow comments end with multi asterisk (#6847) 2018-06-18 15:02:36 +08:00
e77fb50922 parser: fix a bug lexer.Reset() doesn't reset to the initial state (#6153) 2018-03-27 08:05:44 +08:00
233e91787f sessionctx: refine sql_mode no_backslash_escapes, to pass ci (#5108) 2017-11-15 08:38:21 -06:00
7fd147bc57 Revert "lexer: support sql_mode 'NO_BACKSLASH_ESCAPES' (#5073)" (#5104)
This reverts commit 294e348f42b2308be7ac38c218709e6a94eced13.
2017-11-14 09:48:59 -06:00
294e348f42 lexer: support sql_mode 'NO_BACKSLASH_ESCAPES' (#5073) 2017-11-12 23:35:49 -06:00
e1882357af parser: support sql_mode "PIPES_AS_CONCAT" (#5012) 2017-11-09 20:37:09 +08:00
6b6d424cb9 parser: support sql_mode high_not_precedence (#5011) 2017-11-08 23:01:23 +08:00