You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by du...@apache.org on 2023/05/18 03:21:08 UTC

[shardingsphere] branch master updated: Support mysql flush table statement (#25535) (#25750)

This is an automated email from the ASF dual-hosted git repository.

duanzhengqiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 8d451e06081 Support mysql flush table statement (#25535) (#25750)
8d451e06081 is described below

commit 8d451e060812059d3eb2f2e52bd364aa3255479d
Author: niu giao giao <zi...@163.com>
AuthorDate: Thu May 18 11:21:01 2023 +0800

    Support mysql flush table statement (#25535) (#25750)
---
 .../dialect/mysql/src/main/antlr4/imports/mysql/DALStatement.g4    | 7 +++++--
 test/it/parser/src/main/resources/case/dal/flush.xml               | 6 ++++++
 test/it/parser/src/main/resources/sql/supported/dal/flush.xml      | 3 +++
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/parser/sql/dialect/mysql/src/main/antlr4/imports/mysql/DALStatement.g4 b/parser/sql/dialect/mysql/src/main/antlr4/imports/mysql/DALStatement.g4
index 5d34293ef23..9a5669d0cf8 100644
--- a/parser/sql/dialect/mysql/src/main/antlr4/imports/mysql/DALStatement.g4
+++ b/parser/sql/dialect/mysql/src/main/antlr4/imports/mysql/DALStatement.g4
@@ -372,8 +372,11 @@ flushOption
     ;
 
 tablesOption
-    : TABLES |TABLES tableName (COMMA_ tableName)* | TABLES WITH READ LOCK | TABLES tableName (COMMA_ tableName)* WITH READ LOCK
-    | TABLES tableName (COMMA_ tableName)* FOR EXPORT
+    : (TABLES | TABLE)
+    | (TABLES | TABLE) tableName (COMMA_ tableName)*
+    | (TABLES | TABLE) WITH READ LOCK
+    | (TABLES | TABLE) tableName (COMMA_ tableName)* WITH READ LOCK
+    | (TABLES | TABLE) tableName (COMMA_ tableName)* FOR EXPORT
     ;
 
 kill
diff --git a/test/it/parser/src/main/resources/case/dal/flush.xml b/test/it/parser/src/main/resources/case/dal/flush.xml
index 0ae28cadb3c..0eceaaa0444 100644
--- a/test/it/parser/src/main/resources/case/dal/flush.xml
+++ b/test/it/parser/src/main/resources/case/dal/flush.xml
@@ -23,4 +23,10 @@
         <table name="t_order" start-index="13" stop-index="19" />
         <table name="t_order_item" start-index="21" stop-index="32" />
     </flush>
+    <flush sql-case-id="flush_table" flush-table="true" />
+    <flush sql-case-id="flush_table_with_table" flush-table="true">
+        <table name="t_order" start-index="12" stop-index="18" />
+        <table name="t_order_item" start-index="20" stop-index="31" />
+    </flush>
+    <flush sql-case-id="flush_table_with_read_lock" flush-table="true" />
 </sql-parser-test-cases>
diff --git a/test/it/parser/src/main/resources/sql/supported/dal/flush.xml b/test/it/parser/src/main/resources/sql/supported/dal/flush.xml
index 3a8a9233865..401e1b0ff3b 100644
--- a/test/it/parser/src/main/resources/sql/supported/dal/flush.xml
+++ b/test/it/parser/src/main/resources/sql/supported/dal/flush.xml
@@ -20,4 +20,7 @@
     <sql-case id="flush_privileges" value="FLUSH PRIVILEGES" db-types="MySQL" />
     <sql-case id="flush_tables" value="FLUSH TABLES" db-types="MySQL" />
     <sql-case id="flush_tables_with_tables" value="FLUSH TABLES t_order,t_order_item" db-types="MySQL" />
+    <sql-case id="flush_table" value="FLUSH TABLE" db-types="MySQL" />
+    <sql-case id="flush_table_with_table" value="FLUSH TABLE t_order,t_order_item" db-types="MySQL" />
+    <sql-case id="flush_table_with_read_lock" value="FLUSH TABLE WITH READ LOCK" db-types="MySQL" />
 </sql-cases>