diff --git a/libsql-jdbc/src/main/java/io/github/magnusp/libsql/jdbc/LibsqlConnection.java b/libsql-jdbc/src/main/java/io/github/magnusp/libsql/jdbc/LibsqlConnection.java index 19ba96b..9baeeff 100644 --- a/libsql-jdbc/src/main/java/io/github/magnusp/libsql/jdbc/LibsqlConnection.java +++ b/libsql-jdbc/src/main/java/io/github/magnusp/libsql/jdbc/LibsqlConnection.java @@ -809,10 +809,10 @@ public void setClientInfo(Properties properties) throws SQLClientInfoException { public Properties getClientInfo() throws SQLException { return new Properties(); } @Override - public Array createArrayOf(String typeName, Object[] elements) throws SQLException { throw new UnsupportedOperationException(); } + public Array createArrayOf(String typeName, Object[] elements) throws SQLException { throw new SQLFeatureNotSupportedException("createArrayOf is not supported"); } @Override - public Struct createStruct(String typeName, Object[] attributes) throws SQLException { throw new UnsupportedOperationException(); } + public Struct createStruct(String typeName, Object[] attributes) throws SQLException { throw new SQLFeatureNotSupportedException("createStruct is not supported"); } @Override public void setSchema(String schema) throws SQLException {} diff --git a/libsql-jdbc/src/test/java/io/github/magnusp/libsql/jdbc/LibsqlConnectionTest.java b/libsql-jdbc/src/test/java/io/github/magnusp/libsql/jdbc/LibsqlConnectionTest.java index 9942306..24864d7 100644 --- a/libsql-jdbc/src/test/java/io/github/magnusp/libsql/jdbc/LibsqlConnectionTest.java +++ b/libsql-jdbc/src/test/java/io/github/magnusp/libsql/jdbc/LibsqlConnectionTest.java @@ -23,6 +23,7 @@ import java.sql.BatchUpdateException; import java.sql.SQLException; +import java.sql.SQLFeatureNotSupportedException; import java.sql.SQLIntegrityConstraintViolationException; import java.sql.SQLTransientConnectionException; import java.util.ArrayList; @@ -54,6 +55,19 @@ void getMetaDataIsCachedPerConnection() throws SQLException { assertThat(other.getMetaData()).isNotSameAs(connection.getMetaData()); } + @Test + void createArrayOfAndCreateStructThrowFeatureNotSupported() throws SQLException { + LibsqlConnection connection = new LibsqlConnection( + CONFIG, new ScriptedClient((request, index) -> successResponse(request))); + + assertThatThrownBy(() -> connection.createArrayOf("INTEGER", new Object[0])) + .isExactlyInstanceOf(SQLFeatureNotSupportedException.class) + .hasMessage("createArrayOf is not supported"); + assertThatThrownBy(() -> connection.createStruct("point", new Object[0])) + .isExactlyInstanceOf(SQLFeatureNotSupportedException.class) + .hasMessage("createStruct is not supported"); + } + @Test void metadataReportsTheJdbcUrlUsedToConnect() throws SQLException { LibsqlConnection connection = new LibsqlConnection(