Commit Graph

79 Commits

Author SHA1 Message Date
a8fa29b56d parser: make text return utf8 encoding string (#31457)
close pingcap/tidb#31228
2022-01-12 19:47:42 +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
7700bd2fd5 parser: add "second syntax" for REVOKE (#28738) 2021-10-14 12:03:27 +08:00
xhe
94e30df8e2 parser: fix compiling, add unit tests (#28700) 2021-10-11 23:15:25 +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
8950ad0f44 [parser] *: support dynamic privileges and more extended privileges (#1144)
* *: support dynamic privileges and more extended privileges

* address comment

* address comment
2021-10-09 14:53:23 +08:00
5d600ee3b0 [parser] *: support multiple select options (#1122)
* done

Signed-off-by: wjhuang2016 <huangwenjun1997@gmail.com>

* done

Signed-off-by: wjhuang2016 <huangwenjun1997@gmail.com>

* clean

Signed-off-by: wjhuang2016 <huangwenjun1997@gmail.com>

* fix

Signed-off-by: wjhuang2016 <huangwenjun1997@gmail.com>

* fix

Signed-off-by: wjhuang2016 <huangwenjun1997@gmail.com>

* clean

Signed-off-by: wjhuang2016 <huangwenjun1997@gmail.com>

* address comment

Signed-off-by: wjhuang2016 <huangwenjun1997@gmail.com>
2021-10-09 14:53:23 +08:00
6f7f14c421 [parser] ddl: let create table field type double(N) raise sql syntax error (#1078)
* ddl: let `double(10)` raise sql syntax error

* ddl: add more test

* parser: add switch, let user can enable or disable strict double syntax check

* parser: add SetParserConfig API for simple update parser configuration

* parser: rename field
2021-10-09 14:53:23 +08:00
d22bd1e23d [parser] Update the errors dependence to the latest version (#1079) 2021-10-09 14:53:23 +08:00
c7f93089c6 [parser] goyacc: record the original text position in AST (#984) 2021-10-09 14:53:23 +08:00
e3daabacc0 [parser] *: redact arguments for Error (#1051) 2021-10-09 14:53:23 +08:00
5c19e29b5c [parser] parser : support table statement and value statement (#1026)
* implement Table stmt

* fmt

* add TableStmt into Statement rule, fix OFFSET rule

* support TableStmt in InsertStmt

* remove TableStmtLimit, use SelectStmtLimit instead

* support basic setoptr, need to fix a lot things

* support INTO OUTFILE

* support CREATE TABLE and CREATE VIEW

* support basic VALUES stmt

* fmt

* implement set operation for table

* add some comment

* fix the wrong implements of TABLE stmt

* fix the wrong implements of VALUES stmt

* fix SetOprNode interface

* rename the fields refer to SetOpr statement, fix some comments

* finish

* remove unused comment

* resolve conflicts

* refactor

* resolve conflicts

* fix small problems

* remove wrong use of RowStmtField
2021-10-09 14:53:23 +08:00
9885b111b7 [parser] yy_parser: use the default SQL mode when create a new parser (#1023)
Signed-off-by: wjhuang2016 <huangwenjun1997@gmail.com>
2021-10-09 14:53:23 +08:00
8dea072eee [parser] yy_parser: enable supportWindowFunc by default (#986)
Co-authored-by: crazycs <crazycs520@gmail.com>
2021-10-09 14:53:23 +08:00
a329df515d [parser] fix tiny bug about cast function (#995) 2021-10-09 14:53:23 +08:00
3110c880b1 [parser] parser: create integer type field with specified length should have warings (#939)
* .

Signed-off-by: AilinKid <314806019@qq.com>

* .

Signed-off-by: AilinKid <314806019@qq.com>

* .

Signed-off-by: AilinKid <314806019@qq.com>

* .

Signed-off-by: AilinKid <314806019@qq.com>

* .

Signed-off-by: AilinKid <314806019@qq.com>
2021-10-09 14:53:23 +08:00
f1d610f394 [parser] fix type conversion panic from NUM to int64 (#809)
* fix conversion panic from NUM to int64

* catch teardown error

* polish int64num description

Co-authored-by: kennytm <kennytm@gmail.com>
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
214dd44fab [parser] support register new terror (#734) 2021-10-09 14:53:23 +08:00
e633cd8221 [parser] Parser: Database and Table encryption (#599 #600) (#717)
* add junit test of database encrption

* *: Add warn when database encrypting

* *: add warn of database encryption

* Parser:Database encryption

* Parser: Database encryption ignores case

* *:add unit test of database encryption

* *: Fallback to master version

* parse:More universal implementation

* parser: support table Encryption

* parser:avoid several type conversion
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
9e2eb9d931 [parser] parser: fix panic when MEMORY_QUOTA overflows int64 (#694) 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
94eb38bc74 [parser] clean up error code and message for parser (#618) 2021-10-09 14:53:23 +08:00
06a9eb80fa [parser] parser: optimize performance (#562) 2021-10-09 14:53:23 +08:00
a580fe29ee [parser] parser: support cast as float (#416)
* parser: support_cast_as_float

* fix
2021-10-09 14:53:23 +08:00
63183ae869 [parser] parser: fix compatibility for LOCK ALGORITHM SET DEFAULT and CHECK clauses (#392) 2021-10-09 14:53:23 +08:00
91319f3063 [parser] parser: refine error messages that are inconsistent with MySQL (#273) 2021-10-09 14:53:23 +08:00
2a2f211cc5 [parser] parser: fix error message for illegal year type definition. (#268) 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
88e84f98ea [parser] *: fix type of MaxInt64 (#251) 2021-10-09 14:53:23 +08:00
24980bb2dd [parser] improve syntax error message (#175) 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
e5fb49c9b0 [parser] parser: add driver import check & example (#44) 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
bd08b0bc70 *: make parser package dependency as small as possible (#7989) 2018-10-24 13:19:10 +08:00
cb03f2bec1 move from juju/errors to pkg/errors (#7151) 2018-09-12 15:42:20 +08:00
62433663e5 util/types: change types path (#5007)
* util/types: change types path
2017-11-04 10:37:14 -05:00
a7aaa64c76 parser: parse error compatible (#4238) 2017-10-10 13:00:56 +08:00
665f62929d *: make "unconvert" happy (#4700) 2017-09-30 15:53:01 +08:00