Commit Graph

56 Commits

Author SHA1 Message Date
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
fc209cb1df *: rewrite hex and bit literals (#4415) 2017-09-07 16:28:24 +08:00
88616f0433 parser, session: fix wrong comment in selection field (#3767) 2017-07-17 13:55:26 +08:00
8f79c2031b parser: change intLit to decLit when the value out of range (#2954) 2017-03-29 23:16:48 +08:00
849ec6c63e parser: support ANSI_QUOTES sql mode (#2754)
In ANSI_QUOTES sql mode, "xxx" is parsed to  identifier,
similar to `xxx` in normal sql mode

* fix typo
2017-03-01 13:45:19 +08:00
b2f8a6fceb parser: parse kill statement (#2734) 2017-02-27 13:58:02 +08:00
2594e4f799 parser: parse use 10 instead 0 (#2404) 2017-01-06 11:29:55 +08:00
9cca7b0b02 types: move Bit, Enum, Set, Hex to types package (#2085)
Consistent with Time and MyDecimal.
2016-11-24 12:28:55 +08:00
b19cc75a94 mysql, types: move MyDecimal and Time from 'mysql' to 'types' package. (#2082)
So we don't need to handle sql mode in 'mysql' package, avoid potential dependency cycle.
2016-11-24 10:50:31 +08:00
91050ff1f8 parser: parse decimal literal instead of float literal (#2044)
Improves MySQL compatibility.
2016-11-21 19:29:25 +08:00
94b5d1001f parser: handle MySQL-specific-code comment syntax in parser (#2018)
* parser: handle MySQL-specific-code comment syntax in parser

fix issue 2017
2016-11-17 10:47:21 +08:00
c0c9729300 parser: fix bug hexadecimal parsed as string (#1871)
x'13181C76734725455A' should be parsed as a hexLit, but it's parsed as a string
2016-10-25 14:24:59 +08:00
a33240d8a8 parser: set flag in parse function. (#1799)
Every `ast.Statement` needs to set flag before use, set the flag in parse function,
so we don't need to set it somewhere else and won't forget to do it.
2016-10-09 11:36:56 +08:00
3eb6f4f513 parser: remove the old lexer, clean up (#1597) 2016-08-18 14:29:45 +08:00
0a0abbb2e7 parser: use the new lexer as default (#1566) 2016-08-15 10:06:52 +08:00
3545493808 parser: cache variable in parser to avoid allocation (#1565) 2016-08-08 23:17:44 +08:00
a5db620286 parser: rewrite lex (#1514)
introduce a handwriten lexer, which should be better in performance and support UTF8.
it's still not used as default one, a switch is provided by specifying -newlexer=true in tidb-server.
2016-08-06 16:29:21 +08:00
398eec015d parser: move lexer's int/float/hex method to function (#1529)
the old lexer and the new lexer can both use those code
2016-08-01 18:44:54 +08:00
b42dae814a parser: move charset/collation/list fields to parser from lexer (#1491) 2016-07-27 11:20:31 +08:00
128af2e92a parser: store sql string in parser and move offset related method (#1493) 2016-07-27 10:50:06 +08:00
db4cdcfaec parser: reduce memory allocation (#1408) 2016-07-07 16:42:30 +08:00
0450ba0b47 *: unify "See url" format (#1391)
* *: unify "See url" format
2016-07-05 11:21:10 +08:00
5fd70ed31e parser: Handle MySQL-specific code
Fix: https://github.com/pingcap/tidb/issues/971
2016-03-15 15:53:39 +08:00
207c7673b9 *: update error code. 2016-01-16 13:21:06 +08:00