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 1658d47b4a0 Change lock syntax (#25535) (#25916)
1658d47b4a0 is described below
commit 1658d47b4a0266c64a99d83d8b2cac6434c52a3f
Author: niu niu <[email protected]>
AuthorDate: Mon May 29 12:45:32 2023 +0800
Change lock syntax (#25535) (#25916)
---
.../mysql/src/main/antlr4/imports/mysql/TCLStatement.g4 | 2 +-
test/it/parser/src/main/resources/case/tcl/lock.xml | 10 ++++++++++
test/it/parser/src/main/resources/sql/supported/tcl/lock.xml | 2 ++
3 files changed, 13 insertions(+), 1 deletion(-)
diff --git
a/parser/sql/dialect/mysql/src/main/antlr4/imports/mysql/TCLStatement.g4
b/parser/sql/dialect/mysql/src/main/antlr4/imports/mysql/TCLStatement.g4
index 091cda5e71d..79475d1b5c8 100644
--- a/parser/sql/dialect/mysql/src/main/antlr4/imports/mysql/TCLStatement.g4
+++ b/parser/sql/dialect/mysql/src/main/antlr4/imports/mysql/TCLStatement.g4
@@ -52,7 +52,7 @@ begin
;
lock
- : LOCK (INSTANCE FOR BACKUP | (TABLES tableLock (COMMA_ tableLock)*))
+ : LOCK (INSTANCE FOR BACKUP | ((TABLES | TABLE) tableLock (COMMA_
tableLock)*))
;
unlock
diff --git a/test/it/parser/src/main/resources/case/tcl/lock.xml
b/test/it/parser/src/main/resources/case/tcl/lock.xml
index e376c85745b..3ed6cb7ee17 100644
--- a/test/it/parser/src/main/resources/case/tcl/lock.xml
+++ b/test/it/parser/src/main/resources/case/tcl/lock.xml
@@ -17,6 +17,16 @@
-->
<sql-parser-test-cases>
+ <lock sql-case-id="lock_single_table_with_table_owner_read">
+ <table name="general_log" start-index="11" stop-index="27">
+ <owner name="mysql" start-index="11" stop-index="15" />
+ </table>
+ </lock>
+ <lock sql-case-id="lock_single_table_with_alias_table_write">
+ <table name="general_log" start-index="11" stop-index="27">
+ <owner name="mysql" start-index="11" stop-index="15" />
+ </table>
+ </lock>
<lock sql-case-id="lock_table_with_table_owner_read">
<table name="general_log" start-index="12" stop-index="28">
<owner name="mysql" start-index="12" stop-index="16" />
diff --git a/test/it/parser/src/main/resources/sql/supported/tcl/lock.xml
b/test/it/parser/src/main/resources/sql/supported/tcl/lock.xml
index 07afe684cfa..6134419cd4b 100644
--- a/test/it/parser/src/main/resources/sql/supported/tcl/lock.xml
+++ b/test/it/parser/src/main/resources/sql/supported/tcl/lock.xml
@@ -17,6 +17,8 @@
-->
<sql-cases>
+ <sql-case id="lock_single_table_with_table_owner_read" value="lock table
mysql.general_log READ" db-types="MySQL" />
+ <sql-case id="lock_single_table_with_alias_table_write" value="lock table
mysql.general_log WRITE" db-types="MySQL" />
<sql-case id="lock_table_with_table_owner_read" value="lock tables
mysql.general_log READ" db-types="MySQL" />
<sql-case id="lock_table_with_alias_table_write" value="lock tables
mysql.general_log WRITE" db-types="MySQL" />
<sql-case id="lock_table_with_read" value="lock tables t1 READ"
db-types="MySQL" />