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

sunnianjun 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 1103aa6e2e8 Remove AbstractUnsupportedOperationStatement (#31399)
1103aa6e2e8 is described below

commit 1103aa6e2e8ea74ed877a6f87ce9db9ba454f8ea
Author: Liang Zhang <[email protected]>
AuthorDate: Sun May 26 15:44:33 2024 +0800

    Remove AbstractUnsupportedOperationStatement (#31399)
    
    * Remove AbstractUnsupportedOperationStatement
    
    * Remove AbstractUnsupportedOperationStatement
---
 .../jdbc/adapter/AbstractStatementAdapter.java     |  7 ++--
 .../AbstractUnsupportedOperationStatement.java     | 45 ----------------------
 .../circuit/statement/CircuitBreakerStatement.java | 18 ++++++++-
 3 files changed, 20 insertions(+), 50 deletions(-)

diff --git 
a/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/adapter/AbstractStatementAdapter.java
 
b/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/adapter/AbstractStatementAdapter.java
index 007ad0dcbe6..75646a43cde 100644
--- 
a/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/adapter/AbstractStatementAdapter.java
+++ 
b/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/adapter/AbstractStatementAdapter.java
@@ -23,7 +23,6 @@ import 
org.apache.shardingsphere.driver.executor.DriverExecutor;
 import 
org.apache.shardingsphere.driver.jdbc.adapter.executor.ForceExecuteTemplate;
 import 
org.apache.shardingsphere.driver.jdbc.core.connection.ShardingSphereConnection;
 import org.apache.shardingsphere.driver.jdbc.core.statement.StatementManager;
-import 
org.apache.shardingsphere.driver.jdbc.unsupported.AbstractUnsupportedOperationStatement;
 import 
org.apache.shardingsphere.infra.database.core.metadata.database.DialectDatabaseMetaData;
 import org.apache.shardingsphere.infra.database.core.type.DatabaseType;
 import org.apache.shardingsphere.infra.database.core.type.DatabaseTypeRegistry;
@@ -38,6 +37,7 @@ import 
org.apache.shardingsphere.transaction.rule.TransactionRule;
 
 import java.sql.Connection;
 import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
 import java.sql.SQLWarning;
 import java.sql.Statement;
 import java.util.Collection;
@@ -46,7 +46,7 @@ import java.util.Collection;
  * Adapter for {@code Statement}.
  */
 @Getter
-public abstract class AbstractStatementAdapter extends 
AbstractUnsupportedOperationStatement {
+public abstract class AbstractStatementAdapter extends WrapperAdapter 
implements Statement {
     
     @Getter(AccessLevel.NONE)
     private final ForceExecuteTemplate<Statement> forceExecuteTemplate = new 
ForceExecuteTemplate<>();
@@ -245,8 +245,9 @@ public abstract class AbstractStatementAdapter extends 
AbstractUnsupportedOperat
     public void setCursorName(final String name) throws SQLException {
         if (isTransparent()) {
             getRoutedStatements().iterator().next().setCursorName(name);
+        } else {
+            throw new SQLFeatureNotSupportedException("setCursorName");
         }
-        super.setCursorName(name);
     }
     
     private boolean isTransparent() {
diff --git 
a/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedOperationStatement.java
 
b/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedOperationStatement.java
deleted file mode 100644
index 9c759966002..00000000000
--- 
a/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedOperationStatement.java
+++ /dev/null
@@ -1,45 +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.driver.jdbc.unsupported;
-
-import org.apache.shardingsphere.driver.jdbc.adapter.WrapperAdapter;
-
-import java.sql.SQLException;
-import java.sql.SQLFeatureNotSupportedException;
-import java.sql.Statement;
-
-/**
- * Unsupported {@code Statement} methods.
- */
-public abstract class AbstractUnsupportedOperationStatement extends 
WrapperAdapter implements Statement {
-    
-    @Override
-    public void closeOnCompletion() throws SQLException {
-        throw new SQLFeatureNotSupportedException("closeOnCompletion");
-    }
-    
-    @Override
-    public boolean isCloseOnCompletion() throws SQLException {
-        throw new SQLFeatureNotSupportedException("isCloseOnCompletion");
-    }
-    
-    @Override
-    public void setCursorName(final String name) throws SQLException {
-        throw new SQLFeatureNotSupportedException("setCursorName");
-    }
-}
diff --git 
a/jdbc/src/main/java/org/apache/shardingsphere/driver/state/circuit/statement/CircuitBreakerStatement.java
 
b/jdbc/src/main/java/org/apache/shardingsphere/driver/state/circuit/statement/CircuitBreakerStatement.java
index 31dd09b0067..57ea193a6af 100644
--- 
a/jdbc/src/main/java/org/apache/shardingsphere/driver/state/circuit/statement/CircuitBreakerStatement.java
+++ 
b/jdbc/src/main/java/org/apache/shardingsphere/driver/state/circuit/statement/CircuitBreakerStatement.java
@@ -17,18 +17,19 @@
 
 package org.apache.shardingsphere.driver.state.circuit.statement;
 
-import 
org.apache.shardingsphere.driver.jdbc.unsupported.AbstractUnsupportedOperationStatement;
+import org.apache.shardingsphere.driver.jdbc.adapter.WrapperAdapter;
 import 
org.apache.shardingsphere.driver.state.circuit.connection.CircuitBreakerConnection;
 
 import java.sql.Connection;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.sql.SQLWarning;
+import java.sql.Statement;
 
 /**
  * Circuit breaker statement.
  */
-public final class CircuitBreakerStatement extends 
AbstractUnsupportedOperationStatement {
+public final class CircuitBreakerStatement extends WrapperAdapter implements 
Statement {
     
     @Override
     public void close() {
@@ -78,6 +79,10 @@ public final class CircuitBreakerStatement extends 
AbstractUnsupportedOperationS
     public void clearWarnings() {
     }
     
+    @Override
+    public void setCursorName(final String name) {
+    }
+    
     @Override
     public ResultSet getResultSet() {
         return null;
@@ -212,4 +217,13 @@ public final class CircuitBreakerStatement extends 
AbstractUnsupportedOperationS
     public boolean isPoolable() {
         return false;
     }
+    
+    @Override
+    public void closeOnCompletion() {
+    }
+    
+    @Override
+    public boolean isCloseOnCompletion() {
+        return false;
+    }
 }

Reply via email to