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 78f7ebc  support if exist clause for drop table statement (#9415)
78f7ebc is described below

commit 78f7ebc8ffc5fe088e41b9d3ecbfdbb93792504c
Author: Zhengqiang Duan <[email protected]>
AuthorDate: Sat Feb 13 12:27:17 2021 +0800

    support if exist clause for drop table statement (#9415)
---
 .../type/single/SingleTableRoutingEngine.java      |  8 ++
 .../impl/ShardingDropTableStatementValidator.java  |  5 +-
 .../impl/MySQLDDLStatementSQLVisitor.java          |  1 +
 .../impl/PostgreSQLDDLStatementSQLVisitor.java     |  1 +
 .../impl/SQLServerDDLStatementSQLVisitor.java      |  1 +
 .../handler/ddl/DropTableStatementHandler.java     | 55 +++++++++++++
 .../mysql/ddl/MySQLDropTableStatement.java         |  6 ++
 .../ddl/PostgreSQLDropTableStatement.java          |  6 ++
 .../sqlserver/ddl/SQLServerDropTableStatement.java |  6 ++
 .../handler/ddl/DropTableStatementHandlerTest.java | 93 ++++++++++++++++++++++
 10 files changed, 181 insertions(+), 1 deletion(-)

diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/type/single/SingleTableRoutingEngine.java
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/type/single/SingleTableRoutingEngine.java
index 2bdc47a..1c6d8b5 100644
--- 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/type/single/SingleTableRoutingEngine.java
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/type/single/SingleTableRoutingEngine.java
@@ -27,6 +27,8 @@ import 
org.apache.shardingsphere.sharding.route.engine.type.ShardingRouteEngine;
 import org.apache.shardingsphere.sharding.rule.ShardingRule;
 import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
 import 
org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.CreateTableStatement;
+import 
org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.DropTableStatement;
+import 
org.apache.shardingsphere.sql.parser.sql.dialect.handler.ddl.DropTableStatementHandler;
 
 import java.util.Collection;
 import java.util.Collections;
@@ -71,6 +73,8 @@ public final class SingleTableRoutingEngine implements 
ShardingRouteEngine {
         for (String each : logicTables) {
             if (shardingRule.getSingleTableRules().containsKey(each)) {
                 fillRouteUnits(each, 
shardingRule.getSingleTableRules().get(each).getDataSourceName(), result);
+            } else if (containsDropTableIfExistClause()) {
+                return 
Collections.singletonList(getRandomRouteUnit(shardingRule));
             } else {
                 throw new ShardingSphereException("`%s` single table does not 
exist.", each);
             }
@@ -85,4 +89,8 @@ public final class SingleTableRoutingEngine implements 
ShardingRouteEngine {
         }
         routeMappers.get(dataSourceMapper).add(new RouteMapper(table, table));
     }
+    
+    private boolean containsDropTableIfExistClause() {
+        return sqlStatement instanceof DropTableStatement && 
DropTableStatementHandler.containsIfExistClause((DropTableStatement) 
sqlStatement);
+    }
 }
diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingDropTableStatementValidator.java
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingDropTableStatementValidator.java
index bd3c145..5e5ef25 100644
--- 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingDropTableStatementValidator.java
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingDropTableStatementValidator.java
@@ -26,6 +26,7 @@ import 
org.apache.shardingsphere.infra.route.context.RouteMapper;
 import 
org.apache.shardingsphere.sharding.route.engine.validator.ddl.ShardingDDLStatementValidator;
 import org.apache.shardingsphere.sharding.rule.ShardingRule;
 import 
org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.DropTableStatement;
+import 
org.apache.shardingsphere.sql.parser.sql.dialect.handler.ddl.DropTableStatementHandler;
 
 import java.util.Collection;
 import java.util.LinkedList;
@@ -44,7 +45,9 @@ public final class ShardingDropTableStatementValidator 
extends ShardingDDLStatem
     public void preValidate(final ShardingRule shardingRule, final 
SQLStatementContext<DropTableStatement> sqlStatementContext,
                             final List<Object> parameters, final 
ShardingSphereSchema schema) {
         this.shardingRule = shardingRule;
-        validateTableExist(schema, 
sqlStatementContext.getTablesContext().getTables());
+        if 
(!DropTableStatementHandler.containsIfExistClause(sqlStatementContext.getSqlStatement()))
 {
+            validateTableExist(schema, 
sqlStatementContext.getTablesContext().getTables());
+        }
     }
     
     @Override
diff --git 
a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLDDLStatementSQLVisitor.java
 
b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLDDLStatementSQLVisitor.java
index d5b4fcd..da93251 100644
--- 
a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLDDLStatementSQLVisitor.java
+++ 
b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLDDLStatementSQLVisitor.java
@@ -410,6 +410,7 @@ public final class MySQLDDLStatementSQLVisitor extends 
MySQLStatementSQLVisitor
     public ASTNode visitDropTable(final DropTableContext ctx) {
         MySQLDropTableStatement result = new MySQLDropTableStatement();
         result.getTables().addAll(((CollectionValue<SimpleTableSegment>) 
visit(ctx.tableList())).getValue());
+        result.setContainsIfExistClause(null != ctx.existClause());
         return result;
     }
     
diff --git 
a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/statement/impl/PostgreSQLDDLStatementSQLVisitor.java
 
b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/statement/impl/PostgreSQLDDLStatementSQLVisitor.java
index fab96ba..e77ff7f 100644
--- 
a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/statement/impl/PostgreSQLDDLStatementSQLVisitor.java
+++ 
b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/statement/impl/PostgreSQLDDLStatementSQLVisitor.java
@@ -253,6 +253,7 @@ public final class PostgreSQLDDLStatementSQLVisitor extends 
PostgreSQLStatementS
     public ASTNode visitDropTable(final DropTableContext ctx) {
         PostgreSQLDropTableStatement result = new 
PostgreSQLDropTableStatement();
         result.getTables().addAll(((CollectionValue<SimpleTableSegment>) 
visit(ctx.tableNames())).getValue());
+        result.setContainsIfExistClause(null != ctx.tableExistClause());
         return result;
     }
     
diff --git 
a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/java/org/apache/shardingsphere/sql/parser/sqlserver/visitor/statement/impl/SQLServerDDLStatementSQLVisitor.java
 
b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/java/org/apache/shardingsphere/sql/parser/sqlserver/visitor/statement/impl/SQLServerDDLStatementSQLVisitor.java
index d3547d5..79034b0 100644
--- 
a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/java/org/apache/shardingsphere/sql/parser/sqlserver/visitor/statement/impl/SQLServerDDLStatementSQLVisitor.java
+++ 
b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/java/org/apache/shardingsphere/sql/parser/sqlserver/visitor/statement/impl/SQLServerDDLStatementSQLVisitor.java
@@ -239,6 +239,7 @@ public final class SQLServerDDLStatementSQLVisitor extends 
SQLServerStatementSQL
     public ASTNode visitDropTable(final DropTableContext ctx) {
         SQLServerDropTableStatement result = new SQLServerDropTableStatement();
         result.getTables().addAll(((CollectionValue<SimpleTableSegment>) 
visit(ctx.tableNames())).getValue());
+        result.setContainsIfExistClause(null != ctx.ifExist());
         return result;
     }
     
diff --git 
a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/handler/ddl/DropTableStatementHandler.java
 
b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/handler/ddl/DropTableStatementHandler.java
new file mode 100644
index 0000000..cd752c3
--- /dev/null
+++ 
b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/handler/ddl/DropTableStatementHandler.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.sql.parser.sql.dialect.handler.ddl;
+
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import 
org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.DropTableStatement;
+import 
org.apache.shardingsphere.sql.parser.sql.dialect.handler.SQLStatementHandler;
+import 
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.MySQLStatement;
+import 
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.ddl.MySQLDropTableStatement;
+import 
org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.PostgreSQLStatement;
+import 
org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.ddl.PostgreSQLDropTableStatement;
+import 
org.apache.shardingsphere.sql.parser.sql.dialect.statement.sqlserver.SQLServerStatement;
+import 
org.apache.shardingsphere.sql.parser.sql.dialect.statement.sqlserver.ddl.SQLServerDropTableStatement;
+
+/**
+ * Drop table statement handler for different dialect SQL statements.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class DropTableStatementHandler implements SQLStatementHandler {
+    
+    /**
+     * Judge whether contains if exist clause.
+     *
+     * @param dropTableStatement drop table statement
+     * @return contains if exist clause or not
+     */
+    public static boolean containsIfExistClause(final DropTableStatement 
dropTableStatement) {
+        if (dropTableStatement instanceof MySQLStatement) {
+            return ((MySQLDropTableStatement) 
dropTableStatement).isContainsIfExistClause();
+        }
+        if (dropTableStatement instanceof PostgreSQLStatement) {
+            return ((PostgreSQLDropTableStatement) 
dropTableStatement).isContainsIfExistClause();
+        }
+        if (dropTableStatement instanceof SQLServerStatement) {
+            return ((SQLServerDropTableStatement) 
dropTableStatement).isContainsIfExistClause();
+        }
+        return false;
+    }
+}
diff --git 
a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/ddl/MySQLDropTableStatement.java
 
b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/ddl/MySQLDropTableStatement.java
index 82fa953..b2f3f60 100644
--- 
a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/ddl/MySQLDropTableStatement.java
+++ 
b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/ddl/MySQLDropTableStatement.java
@@ -17,6 +17,8 @@
 
 package org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.ddl;
 
+import lombok.Getter;
+import lombok.Setter;
 import lombok.ToString;
 import 
org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.DropTableStatement;
 import 
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.MySQLStatement;
@@ -24,6 +26,10 @@ import 
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.MySQLSta
 /**
  * MySQL drop table statement.
  */
+@Getter
+@Setter
 @ToString
 public final class MySQLDropTableStatement extends DropTableStatement 
implements MySQLStatement {
+    
+    private boolean containsIfExistClause;
 }
diff --git 
a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/postgresql/ddl/PostgreSQLDropTableStatement.java
 
b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/postgresql/ddl/PostgreSQLDropTableStatement.java
index eb1ff5b..0e0e3eb 100644
--- 
a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/postgresql/ddl/PostgreSQLDropTableStatement.java
+++ 
b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/postgresql/ddl/PostgreSQLDropTableStatement.java
@@ -17,6 +17,8 @@
 
 package 
org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.ddl;
 
+import lombok.Getter;
+import lombok.Setter;
 import lombok.ToString;
 import 
org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.DropTableStatement;
 import 
org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.PostgreSQLStatement;
@@ -24,6 +26,10 @@ import 
org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.Pos
 /**
  * PostgreSQL drop table statement.
  */
+@Getter
+@Setter
 @ToString
 public final class PostgreSQLDropTableStatement extends DropTableStatement 
implements PostgreSQLStatement {
+    
+    private boolean containsIfExistClause;
 }
diff --git 
a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/sqlserver/ddl/SQLServerDropTableStatement.java
 
b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/sqlserver/ddl/SQLServerDropTableStatement.java
index e9ff11c..fae2031 100644
--- 
a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/sqlserver/ddl/SQLServerDropTableStatement.java
+++ 
b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/sqlserver/ddl/SQLServerDropTableStatement.java
@@ -17,6 +17,8 @@
 
 package 
org.apache.shardingsphere.sql.parser.sql.dialect.statement.sqlserver.ddl;
 
+import lombok.Getter;
+import lombok.Setter;
 import lombok.ToString;
 import 
org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.DropTableStatement;
 import 
org.apache.shardingsphere.sql.parser.sql.dialect.statement.sqlserver.SQLServerStatement;
@@ -24,6 +26,10 @@ import 
org.apache.shardingsphere.sql.parser.sql.dialect.statement.sqlserver.SQLS
 /**
  * SQLServer drop table statement.
  */
+@Getter
+@Setter
 @ToString
 public final class SQLServerDropTableStatement extends DropTableStatement 
implements SQLServerStatement {
+    
+    private boolean containsIfExistClause;
 }
diff --git 
a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/test/java/org/apache/shardingsphere/sql/parser/sql/dialect/handler/ddl/DropTableStatementHandlerTest.java
 
b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/test/java/org/apache/shardingsphere/sql/parser/sql/dialect/handler/ddl/DropTableStatementHandlerTest.java
new file mode 100644
index 0000000..3442df8
--- /dev/null
+++ 
b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/test/java/org/apache/shardingsphere/sql/parser/sql/dialect/handler/ddl/DropTableStatementHandlerTest.java
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.sql.parser.sql.dialect.handler.ddl;
+
+import 
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.ddl.MySQLDropTableStatement;
+import 
org.apache.shardingsphere.sql.parser.sql.dialect.statement.oracle.ddl.OracleDropTableStatement;
+import 
org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.ddl.PostgreSQLDropTableStatement;
+import 
org.apache.shardingsphere.sql.parser.sql.dialect.statement.sql92.ddl.SQL92DropTableStatement;
+import 
org.apache.shardingsphere.sql.parser.sql.dialect.statement.sqlserver.ddl.SQLServerDropTableStatement;
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+public final class DropTableStatementHandlerTest {
+    
+    @Test
+    public void assertContainsIfExistClauseForMySQL() {
+        MySQLDropTableStatement dropTableStatement = new 
MySQLDropTableStatement();
+        dropTableStatement.setContainsIfExistClause(true);
+        boolean containsIfExistClause = 
DropTableStatementHandler.containsIfExistClause(dropTableStatement);
+        assertTrue(containsIfExistClause);
+    }
+    
+    @Test
+    public void assertContainsIfExistClauseForPostgreSQL() {
+        PostgreSQLDropTableStatement dropTableStatement = new 
PostgreSQLDropTableStatement();
+        dropTableStatement.setContainsIfExistClause(true);
+        boolean containsIfExistClause = 
DropTableStatementHandler.containsIfExistClause(dropTableStatement);
+        assertTrue(containsIfExistClause);
+    }
+    
+    @Test
+    public void assertContainsIfExistClauseForSQLServer() {
+        SQLServerDropTableStatement dropTableStatement = new 
SQLServerDropTableStatement();
+        dropTableStatement.setContainsIfExistClause(true);
+        boolean containsIfExistClause = 
DropTableStatementHandler.containsIfExistClause(dropTableStatement);
+        assertTrue(containsIfExistClause);
+    }
+    
+    @Test
+    public void assertNotContainsIfExistClauseForMySQL() {
+        MySQLDropTableStatement dropTableStatement = new 
MySQLDropTableStatement();
+        dropTableStatement.setContainsIfExistClause(false);
+        boolean containsIfExistClause = 
DropTableStatementHandler.containsIfExistClause(dropTableStatement);
+        assertFalse(containsIfExistClause);
+    }
+    
+    @Test
+    public void assertNotContainsIfExistClauseForOracle() {
+        OracleDropTableStatement dropTableStatement = new 
OracleDropTableStatement();
+        boolean containsIfExistClause = 
DropTableStatementHandler.containsIfExistClause(dropTableStatement);
+        assertFalse(containsIfExistClause);
+    }
+    
+    @Test
+    public void assertNotContainsIfExistClauseForPostgreSQL() {
+        PostgreSQLDropTableStatement dropTableStatement = new 
PostgreSQLDropTableStatement();
+        dropTableStatement.setContainsIfExistClause(false);
+        boolean containsIfExistClause = 
DropTableStatementHandler.containsIfExistClause(dropTableStatement);
+        assertFalse(containsIfExistClause);
+    }
+    
+    @Test
+    public void assertNotContainsIfExistClauseForSQL92() {
+        SQL92DropTableStatement dropTableStatement = new 
SQL92DropTableStatement();
+        boolean containsIfExistClause = 
DropTableStatementHandler.containsIfExistClause(dropTableStatement);
+        assertFalse(containsIfExistClause);
+    }
+    
+    @Test
+    public void assertNotContainsIfExistClauseForSQLServer() {
+        SQLServerDropTableStatement dropTableStatement = new 
SQLServerDropTableStatement();
+        dropTableStatement.setContainsIfExistClause(false);
+        boolean containsIfExistClause = 
DropTableStatementHandler.containsIfExistClause(dropTableStatement);
+        assertFalse(containsIfExistClause);
+    }
+}

Reply via email to