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

zhaojinchao 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 1554acdfd32 Remove useless DatabaseRequiredBackendHandler (#29782)
1554acdfd32 is described below

commit 1554acdfd32b24cc6ac62a3e4e850bcea9243e65
Author: Liang Zhang <[email protected]>
AuthorDate: Fri Jan 19 22:45:24 2024 +0800

    Remove useless DatabaseRequiredBackendHandler (#29782)
---
 .../handler/DatabaseRequiredBackendHandler.java    | 60 ----------------------
 1 file changed, 60 deletions(-)

diff --git 
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/DatabaseRequiredBackendHandler.java
 
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/DatabaseRequiredBackendHandler.java
deleted file mode 100644
index 9113eaa028e..00000000000
--- 
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/DatabaseRequiredBackendHandler.java
+++ /dev/null
@@ -1,60 +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.proxy.backend.handler;
-
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-import 
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
-import 
org.apache.shardingsphere.infra.exception.dialect.exception.syntax.database.NoDatabaseSelectedException;
-import 
org.apache.shardingsphere.infra.exception.dialect.exception.syntax.database.UnknownDatabaseException;
-import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
-import 
org.apache.shardingsphere.proxy.backend.handler.distsql.DistSQLBackendHandler;
-import org.apache.shardingsphere.proxy.backend.response.header.ResponseHeader;
-import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
-import org.apache.shardingsphere.proxy.backend.util.DatabaseNameUtils;
-import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
-
-import java.sql.SQLException;
-
-/**
- * Database required backend handler.
- *
- * @param <T> type of SQL statement
- */
-@RequiredArgsConstructor
-@Getter
-public abstract class DatabaseRequiredBackendHandler<T extends SQLStatement> 
implements DistSQLBackendHandler {
-    
-    private final T sqlStatement;
-    
-    private final ConnectionSession connectionSession;
-    
-    @Override
-    public final ResponseHeader execute() throws SQLException {
-        String databaseName = DatabaseNameUtils.getDatabaseName(sqlStatement, 
connectionSession);
-        checkDatabaseName(databaseName);
-        return execute(databaseName, sqlStatement);
-    }
-    
-    protected abstract ResponseHeader execute(String databaseName, T 
sqlStatement);
-    
-    private void checkDatabaseName(final String databaseName) {
-        ShardingSpherePreconditions.checkNotNull(databaseName, 
NoDatabaseSelectedException::new);
-        
ShardingSpherePreconditions.checkState(ProxyContext.getInstance().databaseExists(databaseName),
 () -> new UnknownDatabaseException(databaseName));
-    }
-}

Reply via email to