提交 635b84f2 编写于 作者: S SteNicholas 提交者: Juan Pan(Trista)

mysql statement function (#3753)

上级 6e83e5f0
......@@ -52,4 +52,6 @@
<sql-case id="select_with_left_function" value="SELECT CONCAT(LEFT(status, 7), 'test') FROM t_order_item WHERE user_id = 10" db-types="MySQL" />
<sql-case id="select_for_update" value="SELECT * FROM t_order WHERE user_id = ? FOR UPDATE" lock-clause="true"/>
<sql-case id="select_database" value="SELECT DATABASE()" db-types="MySQL" />
<sql-case id="select_with_mod_function" value="SELECT * FROM t_order WHERE MOD(order_id, 1) = 1" db-types="MySQL" />
<sql-case id="select_with_date_function" value="SELECT * FROM t_order WHERE DATE_FORMAT(current_date, '%Y-%m-%d') = '2019-12-18' ORDER BY order_id" db-types="MySQL" />
</sql-cases>
......@@ -438,8 +438,10 @@ regularFunction_
;
regularFunctionName_
: identifier_ | IF | CURRENT_TIMESTAMP | LOCALTIME | LOCALTIMESTAMP | NOW | REPLACE | INTERVAL | SUBSTRING | LEFT | RIGHT
| LOWER | UNIX_TIMESTAMP | UPPER | DATABASE | STR_TO_DATE | AES_DECRYPT | AES_ENCRYPT | FROM_BASE64 | TO_BASE64
: identifier_ | IF | CURRENT_TIMESTAMP | UNIX_TIMESTAMP | LOCALTIME | LOCALTIMESTAMP | NOW | REPLACE | INTERVAL | SUBSTRING | MOD
| DATABASE | LEFT | RIGHT | LOWER | UPPER | DATE | DATEDIFF | DATE_FORMAT | DAY | DAYNAME | DAYOFMONTH | DAYOFWEEK | DAYOFYEAR
| STR_TO_DATE | TIME | TIMEDIFF | TIMESTAMP | TIMESTAMPADD | TIMESTAMPDIFF | TIME_FORMAT | TIME_TO_SEC | AES_DECRYPT | AES_ENCRYPT
| FROM_BASE64 | TO_BASE64
;
matchExpression_
......
......@@ -1516,10 +1516,54 @@ UPPER
: U P P E R
;
DATEDIFF
: D A T E D I F F
;
DATE_FORMAT
: D A T E UL_ F O R M A T
;
DAYNAME
: D A Y N A M E
;
DAYOFMONTH
: D A Y O F M O N T H
;
DAYOFWEEK
: D A Y O F W E E K
;
DAYOFYEAR
: D A Y O F Y E A R
;
STR_TO_DATE
: S T R UL_ T O UL_ D A T E
;
TIMEDIFF
: T I M E D I F F
;
TIMESTAMPADD
: T I M E S T A M P A D D
;
TIMESTAMPDIFF
: T I M E S T A M P D I F F
;
TIME_FORMAT
: T I M E UL_ F O R M A T
;
TIME_TO_SEC
: T I M E UL_ T O UL_ S E C
;
AES_DECRYPT
: A E S UL_ D E C R Y P T
;
......
......@@ -1169,4 +1169,30 @@
</expression-items>
</select-items>
</parser-result>
<parser-result sql-case-id="select_with_mod_function">
<tables>
<table name="t_order"/>
</tables>
<tokens>
<table-token start-index="14" table-name="t_order" length="7" />
</tokens>
<select-items start-index="7" stop-index="7">
<shorthand-select-items>
<shorthand-select-item start-index="7" stop-index="7" text="*" />
</shorthand-select-items>
</select-items>
</parser-result>
<parser-result sql-case-id="select_with_date_function">
<tables>
<table name="t_order"/>
</tables>
<tokens>
<table-token start-index="14" table-name="t_order" length="7" />
</tokens>
<select-items start-index="7" stop-index="7">
<shorthand-select-items>
<shorthand-select-item start-index="7" stop-index="7" text="*" />
</shorthand-select-items>
</select-items>
</parser-result>
</parser-result-sets>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册