Repository: commons-dbcp Updated Branches: refs/heads/master 358509bd7 -> c5dc98d98
[DBCP-506] Support JDBC 4.2: new CallableStatement methods. Project: http://git-wip-us.apache.org/repos/asf/commons-dbcp/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-dbcp/commit/c5dc98d9 Tree: http://git-wip-us.apache.org/repos/asf/commons-dbcp/tree/c5dc98d9 Diff: http://git-wip-us.apache.org/repos/asf/commons-dbcp/diff/c5dc98d9 Branch: refs/heads/master Commit: c5dc98d98d8b1d06585b9e23e04418532a6cb3d8 Parents: 358509b Author: Gary Gregory <garydgreg...@gmail.com> Authored: Sun Jun 17 10:07:17 2018 -0600 Committer: Gary Gregory <garydgreg...@gmail.com> Committed: Sun Jun 17 10:07:17 2018 -0600 ---------------------------------------------------------------------- .../dbcp2/DelegatingCallableStatement.java | 110 +++++++++++++++++++ .../commons/dbcp2/TesterCallableStatement.java | 42 +++++++ 2 files changed, 152 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-dbcp/blob/c5dc98d9/src/main/java/org/apache/commons/dbcp2/DelegatingCallableStatement.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/dbcp2/DelegatingCallableStatement.java b/src/main/java/org/apache/commons/dbcp2/DelegatingCallableStatement.java index 762c724..2e36c2b 100644 --- a/src/main/java/org/apache/commons/dbcp2/DelegatingCallableStatement.java +++ b/src/main/java/org/apache/commons/dbcp2/DelegatingCallableStatement.java @@ -30,6 +30,7 @@ import java.sql.NClob; import java.sql.Ref; import java.sql.RowId; import java.sql.SQLException; +import java.sql.SQLType; import java.sql.SQLXML; import java.sql.Time; import java.sql.Timestamp; @@ -772,6 +773,47 @@ public class DelegatingCallableStatement extends DelegatingPreparedStatement imp } } + /** + * @since 2.5.0 + */ + @Override + public void registerOutParameter(final int parameterIndex, final SQLType sqlType) throws SQLException { + checkOpen(); + try { + getDelegateCallableStatement().registerOutParameter(parameterIndex, sqlType); + } catch (final SQLException e) { + handleException(e); + } + } + + /** + * @since 2.5.0 + */ + @Override + public void registerOutParameter(final int parameterIndex, final SQLType sqlType, final int scale) + throws SQLException { + checkOpen(); + try { + getDelegateCallableStatement().registerOutParameter(parameterIndex, sqlType, scale); + } catch (final SQLException e) { + handleException(e); + } + } + + /** + * @since 2.5.0 + */ + @Override + public void registerOutParameter(final int parameterIndex, final SQLType sqlType, final String typeName) + throws SQLException { + checkOpen(); + try { + getDelegateCallableStatement().registerOutParameter(parameterIndex, sqlType, typeName); + } catch (final SQLException e) { + handleException(e); + } + } + @Override public void registerOutParameter(final String parameterName, final int sqlType) throws SQLException { checkOpen(); @@ -804,6 +846,47 @@ public class DelegatingCallableStatement extends DelegatingPreparedStatement imp } } + /** + * @since 2.5.0 + */ + @Override + public void registerOutParameter(final String parameterName, final SQLType sqlType) throws SQLException { + checkOpen(); + try { + getDelegateCallableStatement().registerOutParameter(parameterName, sqlType); + } catch (final SQLException e) { + handleException(e); + } + } + + /** + * @since 2.5.0 + */ + @Override + public void registerOutParameter(final String parameterName, final SQLType sqlType, final int scale) + throws SQLException { + checkOpen(); + try { + getDelegateCallableStatement().registerOutParameter(parameterName, sqlType, scale); + } catch (final SQLException e) { + handleException(e); + } + } + + /** + * @since 2.5.0 + */ + @Override + public void registerOutParameter(final String parameterName, final SQLType sqlType, final String typeName) + throws SQLException { + checkOpen(); + try { + getDelegateCallableStatement().registerOutParameter(parameterName, sqlType, typeName); + } catch (final SQLException e) { + handleException(e); + } + } + @Override public void setAsciiStream(final String parameterName, final InputStream inputStream) throws SQLException { checkOpen(); @@ -1167,6 +1250,33 @@ public class DelegatingCallableStatement extends DelegatingPreparedStatement imp } } + /** + * @since 2.5.0 + */ + @Override + public void setObject(final String parameterName, final Object x, final SQLType targetSqlType) throws SQLException { + checkOpen(); + try { + getDelegateCallableStatement().setObject(parameterName, x, targetSqlType); + } catch (final SQLException e) { + handleException(e); + } + } + + /** + * @since 2.5.0 + */ + @Override + public void setObject(final String parameterName, final Object x, final SQLType targetSqlType, + final int scaleOrLength) throws SQLException { + checkOpen(); + try { + getDelegateCallableStatement().setObject(parameterName, x, targetSqlType, scaleOrLength); + } catch (final SQLException e) { + handleException(e); + } + } + @Override public void setRowId(final String parameterName, final RowId value) throws SQLException { checkOpen(); http://git-wip-us.apache.org/repos/asf/commons-dbcp/blob/c5dc98d9/src/test/java/org/apache/commons/dbcp2/TesterCallableStatement.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/dbcp2/TesterCallableStatement.java b/src/test/java/org/apache/commons/dbcp2/TesterCallableStatement.java index 31ad314..d90edd4 100644 --- a/src/test/java/org/apache/commons/dbcp2/TesterCallableStatement.java +++ b/src/test/java/org/apache/commons/dbcp2/TesterCallableStatement.java @@ -29,6 +29,7 @@ import java.sql.Connection; import java.sql.Date; import java.sql.Ref; import java.sql.SQLException; +import java.sql.SQLType; import java.sql.Time; import java.sql.Timestamp; import java.util.Calendar; @@ -381,6 +382,21 @@ public class TesterCallableStatement extends TesterPreparedStatement implements } @Override + public void registerOutParameter(int parameterIndex, SQLType sqlType) throws SQLException { + // Do nothing + } + + @Override + public void registerOutParameter(int parameterIndex, SQLType sqlType, int scale) throws SQLException { + // Do nothing + } + + @Override + public void registerOutParameter(int parameterIndex, SQLType sqlType, String typeName) throws SQLException { + // Do nothing + } + + @Override public void registerOutParameter(final String parameterName, final int sqlType) throws SQLException { } @@ -393,6 +409,21 @@ public class TesterCallableStatement extends TesterPreparedStatement implements } @Override + public void registerOutParameter(String parameterName, SQLType sqlType) throws SQLException { + // Do nothing + } + + @Override + public void registerOutParameter(String parameterName, SQLType sqlType, int scale) throws SQLException { + // Do nothing + } + + @Override + public void registerOutParameter(String parameterName, SQLType sqlType, String typeName) throws SQLException { + // Do nothing + } + + @Override public void setAsciiStream(final String parameterName, final InputStream inputStream) throws SQLException { } @@ -537,6 +568,17 @@ public class TesterCallableStatement extends TesterPreparedStatement implements } @Override + public void setObject(String parameterName, Object x, SQLType targetSqlType) throws SQLException { + // Do nothing + } + + @Override + public void setObject(String parameterName, Object x, SQLType targetSqlType, int scaleOrLength) + throws SQLException { + // Do nothing + } + + @Override public void setRowId(final String parameterName, final RowId value) throws SQLException { }