You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2020/03/31 09:38:44 UTC

[GitHub] [incubator-shardingsphere] terrymanu commented on a change in pull request #5019: ues strategy pattern modify refresh ShardingMetaData.

terrymanu commented on a change in pull request #5019:  ues strategy pattern modify refresh ShardingMetaData.
URL: https://github.com/apache/incubator-shardingsphere/pull/5019#discussion_r400775491
 
 

 ##########
 File path: sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/jdbc/refreh/DropTableStatementMetaDataRefresh.java
 ##########
 @@ -0,0 +1,20 @@
+package org.apache.shardingsphere.shardingjdbc.jdbc.refreh;
+
+import org.apache.shardingsphere.shardingjdbc.jdbc.core.context.ShardingRuntimeContext;
+import org.apache.shardingsphere.sql.parser.binder.statement.SQLStatementContext;
+import org.apache.shardingsphere.sql.parser.sql.segment.generic.table.SimpleTableSegment;
+import org.apache.shardingsphere.sql.parser.sql.statement.ddl.DropTableStatement;
+
+/**
+ * The type Drop table statement meta data refresh.
+ */
+public final class DropTableStatementMetaDataRefresh implements SQLStatementMetaDataRefresh<DropTableStatement> {
+    
+    @Override
+    public void refreshMetaData(final ShardingRuntimeContext shardingRuntimeContext, final SQLStatementContext<DropTableStatement> sqlStatementContext) {
+        for (SimpleTableSegment each : sqlStatementContext.getSqlStatement().getTables()) {
+            shardingRuntimeContext.getMetaData().getSchema().remove(each.getTableName().getIdentifier().getValue());
+        }
+    }
+    
 
 Review comment:
   Please remove useless line

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services