This is an automated email from the ASF dual-hosted git repository.
duanzhengqiang 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 8015eed3b7f Support ShardingSphereConnection.createClob (#31717)
8015eed3b7f is described below
commit 8015eed3b7fd3853f75b21837e3ceb193b031f02
Author: Liang Zhang <[email protected]>
AuthorDate: Sun Jun 16 16:14:59 2024 +0800
Support ShardingSphereConnection.createClob (#31717)
* Support ShardingSphereConnection.createClob
* Support ShardingSphereConnection.createClob
---
.../driver/jdbc/core/connection/ShardingSphereConnection.java | 6 ++++++
.../jdbc/unsupported/AbstractUnsupportedOperationConnection.java | 6 ------
.../driver/state/circuit/connection/CircuitBreakerConnection.java | 6 ++++++
.../driver/jdbc/unsupported/UnsupportedOperationConnectionTest.java | 5 -----
4 files changed, 12 insertions(+), 11 deletions(-)
diff --git
a/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/core/connection/ShardingSphereConnection.java
b/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/core/connection/ShardingSphereConnection.java
index 7b1683a923f..0c0d29fe9c4 100644
---
a/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/core/connection/ShardingSphereConnection.java
+++
b/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/core/connection/ShardingSphereConnection.java
@@ -39,6 +39,7 @@ import
org.apache.shardingsphere.transaction.rule.TransactionRule;
import java.sql.Array;
import java.sql.CallableStatement;
+import java.sql.Clob;
import java.sql.DatabaseMetaData;
import java.sql.PreparedStatement;
import java.sql.SQLException;
@@ -338,6 +339,11 @@ public final class ShardingSphereConnection extends
AbstractConnectionAdapter {
return databaseConnectionManager.isValid(timeout);
}
+ @Override
+ public Clob createClob() throws SQLException {
+ return databaseConnectionManager.getRandomConnection().createClob();
+ }
+
@Override
public Array createArrayOf(final String typeName, final Object[] elements)
throws SQLException {
return
databaseConnectionManager.getRandomConnection().createArrayOf(typeName,
elements);
diff --git
a/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedOperationConnection.java
b/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedOperationConnection.java
index 72d7dad22ae..f62e3b5c7d6 100644
---
a/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedOperationConnection.java
+++
b/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedOperationConnection.java
@@ -21,7 +21,6 @@ import
org.apache.shardingsphere.driver.jdbc.adapter.WrapperAdapter;
import
org.apache.shardingsphere.infra.exception.generic.UnsupportedSQLOperationException;
import java.sql.Blob;
-import java.sql.Clob;
import java.sql.Connection;
import java.sql.NClob;
import java.sql.SQLException;
@@ -67,11 +66,6 @@ public abstract class AbstractUnsupportedOperationConnection
extends WrapperAdap
throw new SQLFeatureNotSupportedException("setNetworkTimeout");
}
- @Override
- public final Clob createClob() throws SQLException {
- throw new SQLFeatureNotSupportedException("createClob");
- }
-
@Override
public final Blob createBlob() throws SQLException {
throw new SQLFeatureNotSupportedException("createBlob");
diff --git
a/jdbc/src/main/java/org/apache/shardingsphere/driver/state/circuit/connection/CircuitBreakerConnection.java
b/jdbc/src/main/java/org/apache/shardingsphere/driver/state/circuit/connection/CircuitBreakerConnection.java
index 06526247f68..e075e34da4d 100644
---
a/jdbc/src/main/java/org/apache/shardingsphere/driver/state/circuit/connection/CircuitBreakerConnection.java
+++
b/jdbc/src/main/java/org/apache/shardingsphere/driver/state/circuit/connection/CircuitBreakerConnection.java
@@ -24,6 +24,7 @@ import
org.apache.shardingsphere.driver.state.circuit.statement.CircuitBreakerSt
import java.sql.Array;
import java.sql.CallableStatement;
+import java.sql.Clob;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.PreparedStatement;
@@ -175,6 +176,11 @@ public final class CircuitBreakerConnection extends
AbstractUnsupportedOperation
return true;
}
+ @Override
+ public Clob createClob() {
+ return null;
+ }
+
@Override
public Array createArrayOf(final String typeName, final Object[] elements)
{
return null;
diff --git
a/jdbc/src/test/java/org/apache/shardingsphere/driver/jdbc/unsupported/UnsupportedOperationConnectionTest.java
b/jdbc/src/test/java/org/apache/shardingsphere/driver/jdbc/unsupported/UnsupportedOperationConnectionTest.java
index 9e7f802a33a..dd7543d384b 100644
---
a/jdbc/src/test/java/org/apache/shardingsphere/driver/jdbc/unsupported/UnsupportedOperationConnectionTest.java
+++
b/jdbc/src/test/java/org/apache/shardingsphere/driver/jdbc/unsupported/UnsupportedOperationConnectionTest.java
@@ -76,11 +76,6 @@ class UnsupportedOperationConnectionTest {
assertThrows(SQLFeatureNotSupportedException.class, () ->
shardingSphereConnection.setNetworkTimeout(null, 0));
}
- @Test
- void assertCreateClob() {
- assertThrows(SQLFeatureNotSupportedException.class,
shardingSphereConnection::createClob);
- }
-
@Test
void assertCreateBlob() {
assertThrows(SQLFeatureNotSupportedException.class,
shardingSphereConnection::createBlob);