You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by pa...@apache.org on 2021/01/20 06:49:48 UTC

[shardingsphere] branch master updated: [SQL Definition Collation][Oracle]Collate the SQL definition of DROP TABLE (#9084)

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

panjuan 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 cbcb71b  [SQL Definition Collation][Oracle]Collate the SQL definition of DROP TABLE (#9084)
cbcb71b is described below

commit cbcb71baf392719125125b03b2a60b0beca386dd
Author: Thanoshan MV <48...@users.noreply.github.com>
AuthorDate: Wed Jan 20 12:19:19 2021 +0530

    [SQL Definition Collation][Oracle]Collate the SQL definition of DROP TABLE (#9084)
    
    * add SQL definition of DROP TABLE
    
    * add SQL case and test case
    
    * modify DROP TABLE definition
    
    * modify definition and add SQL case
---
 .../src/main/antlr4/imports/oracle/DDLStatement.g4                  | 2 +-
 .../src/main/resources/case/ddl/drop-table.xml                      | 6 ++++++
 .../src/main/resources/sql/supported/ddl/drop.xml                   | 1 +
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DDLStatement.g4 b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DDLStatement.g4
index d52760d..bdc5619 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DDLStatement.g4
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DDLStatement.g4
@@ -37,7 +37,7 @@ alterIndex
     ;
 
 dropTable
-    : DROP TABLE tableName
+    : DROP TABLE tableName (CASCADE CONSTRAINTS)? (PURGE)?
     ;
  
 dropIndex
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/main/resources/case/ddl/drop-table.xml b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/main/resources/case/ddl/drop-table.xml
index 7acbd09..d27d94e 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/main/resources/case/ddl/drop-table.xml
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/main/resources/case/ddl/drop-table.xml
@@ -40,6 +40,12 @@
     <drop-table sql-case-id="drop_table_cascade_constraints_and_purge">
         <table name="t_log" start-index="11" stop-index="15" />
     </drop-table>
+
+    <drop-table sql-case-id="drop_table_purge_with_schema">
+        <table name="t_log" start-index="11" stop-index="27">
+            <owner name="sharding_db" start-index="11" stop-index="21" />
+        </table>
+    </drop-table>
     
     <drop-table sql-case-id="drop_table_with_space">
         <table name="t_order" start-index="23" stop-index="29" />
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/main/resources/sql/supported/ddl/drop.xml b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/main/resources/sql/supported/ddl/drop.xml
index 36adcd7..4d95b15 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/main/resources/sql/supported/ddl/drop.xml
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/main/resources/sql/supported/ddl/drop.xml
@@ -23,6 +23,7 @@
     <sql-case id="drop_table_restrict" value="DROP TABLE t_log RESTRICT" db-types="MySQL,PostgreSQL" />
     <sql-case id="drop_table_cascade" value="DROP TABLE t_log CASCADE" db-types="MySQL,PostgreSQL" />
     <sql-case id="drop_table_cascade_constraints_and_purge" value="DROP TABLE t_log CASCADE CONSTRAINTS PURGE" db-types="Oracle" />
+    <sql-case id="drop_table_purge_with_schema" value="DROP TABLE sharding_db.t_log PURGE" db-types="Oracle" />
     <sql-case id="drop_table_with_space" value="    DROP TABLE
         t_order    "/>
     <sql-case id="drop_table_with_back_quota" value="DROP TABLE `t_order`" left-delimiter="`" right-delimiter="`" db-types="MySQL" />