Skip to content

Commit

Permalink
Remove AbstractUnsupportedOperationStatement (#31399)
Browse files Browse the repository at this point in the history
* Remove AbstractUnsupportedOperationStatement

* Remove AbstractUnsupportedOperationStatement
  • Loading branch information
terrymanu authored May 26, 2024
1 parent 8f026a7 commit 1103aa6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
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;
Expand All @@ -38,6 +37,7 @@

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
import java.sql.SQLWarning;
import java.sql.Statement;
import java.util.Collection;
Expand All @@ -46,7 +46,7 @@
* 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<>();
Expand Down Expand Up @@ -245,8 +245,9 @@ public boolean isCloseOnCompletion() {
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() {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -78,6 +79,10 @@ public SQLWarning getWarnings() {
public void clearWarnings() {
}

@Override
public void setCursorName(final String name) {
}

@Override
public ResultSet getResultSet() {
return null;
Expand Down Expand Up @@ -212,4 +217,13 @@ public void setPoolable(final boolean poolable) {
public boolean isPoolable() {
return false;
}

@Override
public void closeOnCompletion() {
}

@Override
public boolean isCloseOnCompletion() {
return false;
}
}

0 comments on commit 1103aa6

Please sign in to comment.