This is an automated email from the ASF dual-hosted git repository.
zhangliang 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 94b2a5f93a8 Merge CreateSchemaStatementContext and
UnknownSQLStatementContext (#35701)
94b2a5f93a8 is described below
commit 94b2a5f93a87a659e2964a659c8b8ef3fa4a1de1
Author: Liang Zhang <[email protected]>
AuthorDate: Fri Jun 13 20:23:29 2025 +0800
Merge CreateSchemaStatementContext and UnknownSQLStatementContext (#35701)
---
.../statement/SQLStatementContextFactory.java | 3 +-
.../type/ddl/CommentStatementContext.java | 46 ----------------------
.../type/ddl/CreateSchemaStatementContext.java | 37 -----------------
3 files changed, 1 insertion(+), 85 deletions(-)
diff --git
a/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/context/statement/SQLStatementContextFactory.java
b/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/context/statement/SQLStatementContextFactory.java
index 68d97b0c3ef..c8a40bab4af 100644
---
a/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/context/statement/SQLStatementContextFactory.java
+++
b/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/context/statement/SQLStatementContextFactory.java
@@ -32,7 +32,6 @@ import
org.apache.shardingsphere.infra.binder.context.statement.type.ddl.CloseSt
import
org.apache.shardingsphere.infra.binder.context.statement.type.ddl.CreateFunctionStatementContext;
import
org.apache.shardingsphere.infra.binder.context.statement.type.ddl.CreateIndexStatementContext;
import
org.apache.shardingsphere.infra.binder.context.statement.type.ddl.CreateProcedureStatementContext;
-import
org.apache.shardingsphere.infra.binder.context.statement.type.ddl.CreateSchemaStatementContext;
import
org.apache.shardingsphere.infra.binder.context.statement.type.ddl.CreateTableStatementContext;
import
org.apache.shardingsphere.infra.binder.context.statement.type.ddl.CreateViewStatementContext;
import
org.apache.shardingsphere.infra.binder.context.statement.type.ddl.CursorStatementContext;
@@ -172,7 +171,7 @@ public final class SQLStatementContextFactory {
private static SQLStatementContext getDDLStatementContext(final
ShardingSphereMetaData metaData, final DatabaseType databaseType,
final
DDLStatement sqlStatement, final List<Object> params, final String
currentDatabaseName) {
if (sqlStatement instanceof CreateSchemaStatement) {
- return new CreateSchemaStatementContext(databaseType,
(CreateSchemaStatement) sqlStatement);
+ return new UnknownSQLStatementContext(databaseType, sqlStatement);
}
if (sqlStatement instanceof CreateTableStatement) {
return new CreateTableStatementContext(databaseType,
(CreateTableStatement) sqlStatement);
diff --git
a/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/context/statement/type/ddl/CommentStatementContext.java
b/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/context/statement/type/ddl/CommentStatementContext.java
deleted file mode 100644
index 0a9acc44967..00000000000
---
a/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/context/statement/type/ddl/CommentStatementContext.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.infra.binder.context.statement.type.ddl;
-
-import lombok.Getter;
-import
org.apache.shardingsphere.infra.binder.context.segment.table.TablesContext;
-import
org.apache.shardingsphere.infra.binder.context.statement.CommonSQLStatementContext;
-import org.apache.shardingsphere.infra.binder.context.type.TableAvailable;
-import org.apache.shardingsphere.infra.database.core.type.DatabaseType;
-import
org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.CommentStatement;
-
-import java.util.Collections;
-
-/**
- * Comment statement context.
- */
-@Getter
-public final class CommentStatementContext extends CommonSQLStatementContext
implements TableAvailable {
-
- private final TablesContext tablesContext;
-
- public CommentStatementContext(final DatabaseType databaseType, final
CommentStatement sqlStatement) {
- super(databaseType, sqlStatement);
- tablesContext = new TablesContext(null == sqlStatement.getTable() ?
Collections.emptyList() : Collections.singletonList(sqlStatement.getTable()));
- }
-
- @Override
- public CommentStatement getSqlStatement() {
- return (CommentStatement) super.getSqlStatement();
- }
-}
diff --git
a/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/context/statement/type/ddl/CreateSchemaStatementContext.java
b/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/context/statement/type/ddl/CreateSchemaStatementContext.java
deleted file mode 100644
index 87836db5365..00000000000
---
a/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/context/statement/type/ddl/CreateSchemaStatementContext.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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.infra.binder.context.statement.type.ddl;
-
-import
org.apache.shardingsphere.infra.binder.context.statement.CommonSQLStatementContext;
-import org.apache.shardingsphere.infra.database.core.type.DatabaseType;
-import
org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.CreateSchemaStatement;
-
-/**
- * Create schema statement context.
- */
-public final class CreateSchemaStatementContext extends
CommonSQLStatementContext {
-
- public CreateSchemaStatementContext(final DatabaseType databaseType, final
CreateSchemaStatement sqlStatement) {
- super(databaseType, sqlStatement);
- }
-
- @Override
- public CreateSchemaStatement getSqlStatement() {
- return (CreateSchemaStatement) super.getSqlStatement();
- }
-}