Modified: tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/DelegatingDatabaseMetaData.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/DelegatingDatabaseMetaData.java?rev=1837746&r1=1837745&r2=1837746&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/DelegatingDatabaseMetaData.java (original) +++ tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/DelegatingDatabaseMetaData.java Thu Aug 9 16:50:30 2018 @@ -56,48 +56,6 @@ public class DelegatingDatabaseMetaData this.databaseMetaData = databaseMetaData; } - /** - * Gets the underlying database meta data. - * - * @return The underlying database meta data. - */ - public DatabaseMetaData getDelegate() { - return databaseMetaData; - } - - /** - * If my underlying {@link ResultSet} is not a {@code DelegatingResultSet}, returns it, otherwise recursively - * invokes this method on my delegate. - * <p> - * Hence this method will return the first delegate that is not a {@code DelegatingResultSet}, or {@code null} when - * no non-{@code DelegatingResultSet} delegate can be found by traversing this chain. - * </p> - * <p> - * This method is useful when you may have nested {@code DelegatingResultSet}s, and you want to make sure to obtain - * a "genuine" {@link ResultSet}. - * </p> - * - * @return the innermost database meta data. - */ - public DatabaseMetaData getInnermostDelegate() { - DatabaseMetaData m = databaseMetaData; - while (m != null && m instanceof DelegatingDatabaseMetaData) { - m = ((DelegatingDatabaseMetaData) m).getDelegate(); - if (this == m) { - return null; - } - } - return m; - } - - protected void handleException(final SQLException e) throws SQLException { - if (connection != null) { - connection.handleException(e); - } else { - throw e; - } - } - @Override public boolean allProceduresAreCallable() throws SQLException { try { @@ -119,6 +77,16 @@ public class DelegatingDatabaseMetaData } @Override + public boolean autoCommitFailureClosesAllResultSets() throws SQLException { + try { + return databaseMetaData.autoCommitFailureClosesAllResultSets(); + } catch (final SQLException e) { + handleException(e); + return false; + } + } + + @Override public boolean dataDefinitionCausesTransactionCommit() throws SQLException { try { return databaseMetaData.dataDefinitionCausesTransactionCommit(); @@ -159,6 +127,17 @@ public class DelegatingDatabaseMetaData } @Override + public boolean generatedKeyAlwaysReturned() throws SQLException { + connection.checkOpen(); + try { + return databaseMetaData.generatedKeyAlwaysReturned(); + } catch (final SQLException e) { + handleException(e); + return false; + } + } + + @Override public ResultSet getAttributes(final String catalog, final String schemaPattern, final String typeNamePattern, final String attributeNamePattern) throws SQLException { connection.checkOpen(); @@ -185,6 +164,17 @@ public class DelegatingDatabaseMetaData } @Override + public ResultSet getCatalogs() throws SQLException { + connection.checkOpen(); + try { + return DelegatingResultSet.wrapResultSet(connection, databaseMetaData.getCatalogs()); + } catch (final SQLException e) { + handleException(e); + throw new AssertionError(); + } + } + + @Override public String getCatalogSeparator() throws SQLException { try { return databaseMetaData.getCatalogSeparator(); @@ -205,10 +195,10 @@ public class DelegatingDatabaseMetaData } @Override - public ResultSet getCatalogs() throws SQLException { + public ResultSet getClientInfoProperties() throws SQLException { connection.checkOpen(); try { - return DelegatingResultSet.wrapResultSet(connection, databaseMetaData.getCatalogs()); + return DelegatingResultSet.wrapResultSet(connection, databaseMetaData.getClientInfoProperties()); } catch (final SQLException e) { handleException(e); throw new AssertionError(); @@ -309,6 +299,15 @@ public class DelegatingDatabaseMetaData } } + /** + * Gets the underlying database meta data. + * + * @return The underlying database meta data. + */ + public DatabaseMetaData getDelegate() { + return databaseMetaData; + } + @Override public int getDriverMajorVersion() { return databaseMetaData.getDriverMajorVersion(); @@ -363,6 +362,32 @@ public class DelegatingDatabaseMetaData } @Override + public ResultSet getFunctionColumns(final String catalog, final String schemaPattern, + final String functionNamePattern, final String columnNamePattern) throws SQLException { + connection.checkOpen(); + try { + return DelegatingResultSet.wrapResultSet(connection, databaseMetaData.getFunctionColumns(catalog, + schemaPattern, functionNamePattern, columnNamePattern)); + } catch (final SQLException e) { + handleException(e); + throw new AssertionError(); + } + } + + @Override + public ResultSet getFunctions(final String catalog, final String schemaPattern, final String functionNamePattern) + throws SQLException { + connection.checkOpen(); + try { + return DelegatingResultSet.wrapResultSet(connection, + databaseMetaData.getFunctions(catalog, schemaPattern, functionNamePattern)); + } catch (final SQLException e) { + handleException(e); + throw new AssertionError(); + } + } + + @Override public String getIdentifierQuoteString() throws SQLException { try { return databaseMetaData.getIdentifierQuoteString(); @@ -398,6 +423,31 @@ public class DelegatingDatabaseMetaData } } + /** + * If my underlying {@link ResultSet} is not a {@code DelegatingResultSet}, returns it, otherwise recursively + * invokes this method on my delegate. + * <p> + * Hence this method will return the first delegate that is not a {@code DelegatingResultSet}, or {@code null} when + * no non-{@code DelegatingResultSet} delegate can be found by traversing this chain. + * </p> + * <p> + * This method is useful when you may have nested {@code DelegatingResultSet}s, and you want to make sure to obtain + * a "genuine" {@link ResultSet}. + * </p> + * + * @return the innermost database meta data. + */ + public DatabaseMetaData getInnermostDelegate() { + DatabaseMetaData m = databaseMetaData; + while (m != null && m instanceof DelegatingDatabaseMetaData) { + m = ((DelegatingDatabaseMetaData) m).getDelegate(); + if (this == m) { + return null; + } + } + return m; + } + @Override public int getJDBCMajorVersion() throws SQLException { try { @@ -538,6 +588,19 @@ public class DelegatingDatabaseMetaData } } + /** + * @since 2.5.0 + */ + @Override + public long getMaxLogicalLobSize() throws SQLException { + try { + return databaseMetaData.getMaxLogicalLobSize(); + } catch (final SQLException e) { + handleException(e); + return 0; + } + } + @Override public int getMaxProcedureNameLength() throws SQLException { try { @@ -654,6 +717,19 @@ public class DelegatingDatabaseMetaData } @Override + public ResultSet getProcedures(final String catalog, final String schemaPattern, final String procedureNamePattern) + throws SQLException { + connection.checkOpen(); + try { + return DelegatingResultSet.wrapResultSet(connection, + databaseMetaData.getProcedures(catalog, schemaPattern, procedureNamePattern)); + } catch (final SQLException e) { + handleException(e); + throw new AssertionError(); + } + } + + @Override public String getProcedureTerm() throws SQLException { try { return databaseMetaData.getProcedureTerm(); @@ -664,12 +740,12 @@ public class DelegatingDatabaseMetaData } @Override - public ResultSet getProcedures(final String catalog, final String schemaPattern, final String procedureNamePattern) - throws SQLException { + public ResultSet getPseudoColumns(final String catalog, final String schemaPattern, final String tableNamePattern, + final String columnNamePattern) throws SQLException { connection.checkOpen(); try { return DelegatingResultSet.wrapResultSet(connection, - databaseMetaData.getProcedures(catalog, schemaPattern, procedureNamePattern)); + databaseMetaData.getPseudoColumns(catalog, schemaPattern, tableNamePattern, columnNamePattern)); } catch (final SQLException e) { handleException(e); throw new AssertionError(); @@ -687,9 +763,9 @@ public class DelegatingDatabaseMetaData } @Override - public String getSQLKeywords() throws SQLException { + public RowIdLifetime getRowIdLifetime() throws SQLException { try { - return databaseMetaData.getSQLKeywords(); + return databaseMetaData.getRowIdLifetime(); } catch (final SQLException e) { handleException(e); throw new AssertionError(); @@ -697,19 +773,21 @@ public class DelegatingDatabaseMetaData } @Override - public int getSQLStateType() throws SQLException { + public ResultSet getSchemas() throws SQLException { + connection.checkOpen(); try { - return databaseMetaData.getSQLStateType(); + return DelegatingResultSet.wrapResultSet(connection, databaseMetaData.getSchemas()); } catch (final SQLException e) { handleException(e); - return 0; + throw new AssertionError(); } } @Override - public String getSchemaTerm() throws SQLException { + public ResultSet getSchemas(final String catalog, final String schemaPattern) throws SQLException { + connection.checkOpen(); try { - return databaseMetaData.getSchemaTerm(); + return DelegatingResultSet.wrapResultSet(connection, databaseMetaData.getSchemas(catalog, schemaPattern)); } catch (final SQLException e) { handleException(e); throw new AssertionError(); @@ -717,10 +795,9 @@ public class DelegatingDatabaseMetaData } @Override - public ResultSet getSchemas() throws SQLException { - connection.checkOpen(); + public String getSchemaTerm() throws SQLException { try { - return DelegatingResultSet.wrapResultSet(connection, databaseMetaData.getSchemas()); + return databaseMetaData.getSchemaTerm(); } catch (final SQLException e) { handleException(e); throw new AssertionError(); @@ -738,6 +815,26 @@ public class DelegatingDatabaseMetaData } @Override + public String getSQLKeywords() throws SQLException { + try { + return databaseMetaData.getSQLKeywords(); + } catch (final SQLException e) { + handleException(e); + throw new AssertionError(); + } + } + + @Override + public int getSQLStateType() throws SQLException { + try { + return databaseMetaData.getSQLStateType(); + } catch (final SQLException e) { + handleException(e); + return 0; + } + } + + @Override public String getStringFunctions() throws SQLException { try { return databaseMetaData.getStringFunctions(); @@ -797,10 +894,12 @@ public class DelegatingDatabaseMetaData } @Override - public ResultSet getTableTypes() throws SQLException { + public ResultSet getTables(final String catalog, final String schemaPattern, final String tableNamePattern, + final String[] types) throws SQLException { connection.checkOpen(); try { - return DelegatingResultSet.wrapResultSet(connection, databaseMetaData.getTableTypes()); + return DelegatingResultSet.wrapResultSet(connection, + databaseMetaData.getTables(catalog, schemaPattern, tableNamePattern, types)); } catch (final SQLException e) { handleException(e); throw new AssertionError(); @@ -808,12 +907,10 @@ public class DelegatingDatabaseMetaData } @Override - public ResultSet getTables(final String catalog, final String schemaPattern, final String tableNamePattern, - final String[] types) throws SQLException { + public ResultSet getTableTypes() throws SQLException { connection.checkOpen(); try { - return DelegatingResultSet.wrapResultSet(connection, - databaseMetaData.getTables(catalog, schemaPattern, tableNamePattern, types)); + return DelegatingResultSet.wrapResultSet(connection, databaseMetaData.getTableTypes()); } catch (final SQLException e) { handleException(e); throw new AssertionError(); @@ -887,6 +984,14 @@ public class DelegatingDatabaseMetaData } } + protected void handleException(final SQLException e) throws SQLException { + if (connection != null) { + connection.handleException(e); + } else { + throw e; + } + } + @Override public boolean insertsAreDetected(final int type) throws SQLException { try { @@ -918,6 +1023,17 @@ public class DelegatingDatabaseMetaData } @Override + public boolean isWrapperFor(final Class<?> iface) throws SQLException { + if (iface.isAssignableFrom(getClass())) { + return true; + } else if (iface.isAssignableFrom(databaseMetaData.getClass())) { + return true; + } else { + return databaseMetaData.isWrapperFor(iface); + } + } + + @Override public boolean locatorsUpdateCopy() throws SQLException { try { return databaseMetaData.locatorsUpdateCopy(); @@ -1098,9 +1214,9 @@ public class DelegatingDatabaseMetaData } @Override - public boolean supportsANSI92EntryLevelSQL() throws SQLException { + public boolean supportsAlterTableWithAddColumn() throws SQLException { try { - return databaseMetaData.supportsANSI92EntryLevelSQL(); + return databaseMetaData.supportsAlterTableWithAddColumn(); } catch (final SQLException e) { handleException(e); return false; @@ -1108,9 +1224,9 @@ public class DelegatingDatabaseMetaData } @Override - public boolean supportsANSI92FullSQL() throws SQLException { + public boolean supportsAlterTableWithDropColumn() throws SQLException { try { - return databaseMetaData.supportsANSI92FullSQL(); + return databaseMetaData.supportsAlterTableWithDropColumn(); } catch (final SQLException e) { handleException(e); return false; @@ -1118,9 +1234,9 @@ public class DelegatingDatabaseMetaData } @Override - public boolean supportsANSI92IntermediateSQL() throws SQLException { + public boolean supportsANSI92EntryLevelSQL() throws SQLException { try { - return databaseMetaData.supportsANSI92IntermediateSQL(); + return databaseMetaData.supportsANSI92EntryLevelSQL(); } catch (final SQLException e) { handleException(e); return false; @@ -1128,9 +1244,9 @@ public class DelegatingDatabaseMetaData } @Override - public boolean supportsAlterTableWithAddColumn() throws SQLException { + public boolean supportsANSI92FullSQL() throws SQLException { try { - return databaseMetaData.supportsAlterTableWithAddColumn(); + return databaseMetaData.supportsANSI92FullSQL(); } catch (final SQLException e) { handleException(e); return false; @@ -1138,9 +1254,9 @@ public class DelegatingDatabaseMetaData } @Override - public boolean supportsAlterTableWithDropColumn() throws SQLException { + public boolean supportsANSI92IntermediateSQL() throws SQLException { try { - return databaseMetaData.supportsAlterTableWithDropColumn(); + return databaseMetaData.supportsANSI92IntermediateSQL(); } catch (final SQLException e) { handleException(e); return false; @@ -1547,6 +1663,19 @@ public class DelegatingDatabaseMetaData } } + /** + * @since 2.5.0 + */ + @Override + public boolean supportsRefCursors() throws SQLException { + try { + return databaseMetaData.supportsRefCursors(); + } catch (final SQLException e) { + handleException(e); + return false; + } + } + @Override public boolean supportsResultSetConcurrency(final int type, final int concurrency) throws SQLException { try { @@ -1658,6 +1787,16 @@ public class DelegatingDatabaseMetaData } @Override + public boolean supportsStoredFunctionsUsingCallSyntax() throws SQLException { + try { + return databaseMetaData.supportsStoredFunctionsUsingCallSyntax(); + } catch (final SQLException e) { + handleException(e); + return false; + } + } + + @Override public boolean supportsStoredProcedures() throws SQLException { try { return databaseMetaData.supportsStoredProcedures(); @@ -1667,6 +1806,8 @@ public class DelegatingDatabaseMetaData } } + /* JDBC_4_ANT_KEY_BEGIN */ + @Override public boolean supportsSubqueriesInComparisons() throws SQLException { try { @@ -1757,48 +1898,7 @@ public class DelegatingDatabaseMetaData } } - @Override - public boolean updatesAreDetected(final int type) throws SQLException { - try { - return databaseMetaData.updatesAreDetected(type); - } catch (final SQLException e) { - handleException(e); - return false; - } - } - - @Override - public boolean usesLocalFilePerTable() throws SQLException { - try { - return databaseMetaData.usesLocalFilePerTable(); - } catch (final SQLException e) { - handleException(e); - return false; - } - } - - @Override - public boolean usesLocalFiles() throws SQLException { - try { - return databaseMetaData.usesLocalFiles(); - } catch (final SQLException e) { - handleException(e); - return false; - } - } - - /* JDBC_4_ANT_KEY_BEGIN */ - - @Override - public boolean isWrapperFor(final Class<?> iface) throws SQLException { - if (iface.isAssignableFrom(getClass())) { - return true; - } else if (iface.isAssignableFrom(databaseMetaData.getClass())) { - return true; - } else { - return databaseMetaData.isWrapperFor(iface); - } - } + /* JDBC_4_ANT_KEY_END */ @Override public <T> T unwrap(final Class<T> iface) throws SQLException { @@ -1812,30 +1912,9 @@ public class DelegatingDatabaseMetaData } @Override - public RowIdLifetime getRowIdLifetime() throws SQLException { - try { - return databaseMetaData.getRowIdLifetime(); - } catch (final SQLException e) { - handleException(e); - throw new AssertionError(); - } - } - - @Override - public ResultSet getSchemas(final String catalog, final String schemaPattern) throws SQLException { - connection.checkOpen(); - try { - return DelegatingResultSet.wrapResultSet(connection, databaseMetaData.getSchemas(catalog, schemaPattern)); - } catch (final SQLException e) { - handleException(e); - throw new AssertionError(); - } - } - - @Override - public boolean autoCommitFailureClosesAllResultSets() throws SQLException { + public boolean updatesAreDetected(final int type) throws SQLException { try { - return databaseMetaData.autoCommitFailureClosesAllResultSets(); + return databaseMetaData.updatesAreDetected(type); } catch (final SQLException e) { handleException(e); return false; @@ -1843,9 +1922,9 @@ public class DelegatingDatabaseMetaData } @Override - public boolean supportsStoredFunctionsUsingCallSyntax() throws SQLException { + public boolean usesLocalFilePerTable() throws SQLException { try { - return databaseMetaData.supportsStoredFunctionsUsingCallSyntax(); + return databaseMetaData.usesLocalFilePerTable(); } catch (final SQLException e) { handleException(e); return false; @@ -1853,62 +1932,9 @@ public class DelegatingDatabaseMetaData } @Override - public ResultSet getClientInfoProperties() throws SQLException { - connection.checkOpen(); - try { - return DelegatingResultSet.wrapResultSet(connection, databaseMetaData.getClientInfoProperties()); - } catch (final SQLException e) { - handleException(e); - throw new AssertionError(); - } - } - - @Override - public ResultSet getFunctions(final String catalog, final String schemaPattern, final String functionNamePattern) - throws SQLException { - connection.checkOpen(); - try { - return DelegatingResultSet.wrapResultSet(connection, - databaseMetaData.getFunctions(catalog, schemaPattern, functionNamePattern)); - } catch (final SQLException e) { - handleException(e); - throw new AssertionError(); - } - } - - @Override - public ResultSet getFunctionColumns(final String catalog, final String schemaPattern, - final String functionNamePattern, final String columnNamePattern) throws SQLException { - connection.checkOpen(); - try { - return DelegatingResultSet.wrapResultSet(connection, databaseMetaData.getFunctionColumns(catalog, - schemaPattern, functionNamePattern, columnNamePattern)); - } catch (final SQLException e) { - handleException(e); - throw new AssertionError(); - } - } - - /* JDBC_4_ANT_KEY_END */ - - @Override - public ResultSet getPseudoColumns(final String catalog, final String schemaPattern, final String tableNamePattern, - final String columnNamePattern) throws SQLException { - connection.checkOpen(); - try { - return DelegatingResultSet.wrapResultSet(connection, - databaseMetaData.getPseudoColumns(catalog, schemaPattern, tableNamePattern, columnNamePattern)); - } catch (final SQLException e) { - handleException(e); - throw new AssertionError(); - } - } - - @Override - public boolean generatedKeyAlwaysReturned() throws SQLException { - connection.checkOpen(); + public boolean usesLocalFiles() throws SQLException { try { - return databaseMetaData.generatedKeyAlwaysReturned(); + return databaseMetaData.usesLocalFiles(); } catch (final SQLException e) { handleException(e); return false;
Modified: tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/DelegatingPreparedStatement.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/DelegatingPreparedStatement.java?rev=1837746&r1=1837745&r2=1837746&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/DelegatingPreparedStatement.java (original) +++ tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/DelegatingPreparedStatement.java Thu Aug 9 16:50:30 2018 @@ -31,6 +31,7 @@ import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.RowId; import java.sql.SQLException; +import java.sql.SQLType; import java.sql.SQLXML; import java.sql.Statement; import java.sql.Time; @@ -64,6 +65,54 @@ public class DelegatingPreparedStatement } @Override + public void addBatch() throws SQLException { + checkOpen(); + try { + getDelegatePreparedStatement().addBatch(); + } catch (final SQLException e) { + handleException(e); + } + } + + @Override + public void clearParameters() throws SQLException { + checkOpen(); + try { + getDelegatePreparedStatement().clearParameters(); + } catch (final SQLException e) { + handleException(e); + } + } + + @Override + public boolean execute() throws SQLException { + checkOpen(); + if (getConnectionInternal() != null) { + getConnectionInternal().setLastUsed(); + } + try { + return getDelegatePreparedStatement().execute(); + } catch (final SQLException e) { + handleException(e); + return false; + } + } + + /** + * @since 2.5.0 + */ + @Override + public long executeLargeUpdate() throws SQLException { + checkOpen(); + try { + return getDelegatePreparedStatement().executeLargeUpdate(); + } catch (final SQLException e) { + handleException(e); + return 0; + } + } + + @Override public ResultSet executeQuery() throws SQLException { checkOpen(); if (getConnectionInternal() != null) { @@ -96,559 +145,551 @@ public class DelegatingPreparedStatement } @Override - public void setNull(final int parameterIndex, final int sqlType) throws SQLException { + public ResultSetMetaData getMetaData() throws SQLException { checkOpen(); try { - getDelegatePreparedStatement().setNull(parameterIndex, sqlType); + return getDelegatePreparedStatement().getMetaData(); } catch (final SQLException e) { handleException(e); + throw new AssertionError(); } } @Override - public void setBoolean(final int parameterIndex, final boolean x) throws SQLException { + public java.sql.ParameterMetaData getParameterMetaData() throws SQLException { checkOpen(); try { - getDelegatePreparedStatement().setBoolean(parameterIndex, x); + return getDelegatePreparedStatement().getParameterMetaData(); } catch (final SQLException e) { handleException(e); + throw new AssertionError(); } } @Override - public void setByte(final int parameterIndex, final byte x) throws SQLException { + public void setArray(final int i, final Array x) throws SQLException { checkOpen(); try { - getDelegatePreparedStatement().setByte(parameterIndex, x); + getDelegatePreparedStatement().setArray(i, x); } catch (final SQLException e) { handleException(e); } } @Override - public void setShort(final int parameterIndex, final short x) throws SQLException { + public void setAsciiStream(final int parameterIndex, final InputStream inputStream) throws SQLException { checkOpen(); try { - getDelegatePreparedStatement().setShort(parameterIndex, x); + getDelegatePreparedStatement().setAsciiStream(parameterIndex, inputStream); } catch (final SQLException e) { handleException(e); } } @Override - public void setInt(final int parameterIndex, final int x) throws SQLException { + public void setAsciiStream(final int parameterIndex, final InputStream x, final int length) throws SQLException { checkOpen(); try { - getDelegatePreparedStatement().setInt(parameterIndex, x); + getDelegatePreparedStatement().setAsciiStream(parameterIndex, x, length); } catch (final SQLException e) { handleException(e); } } @Override - public void setLong(final int parameterIndex, final long x) throws SQLException { + public void setAsciiStream(final int parameterIndex, final InputStream inputStream, final long length) + throws SQLException { checkOpen(); try { - getDelegatePreparedStatement().setLong(parameterIndex, x); + getDelegatePreparedStatement().setAsciiStream(parameterIndex, inputStream, length); } catch (final SQLException e) { handleException(e); } } @Override - public void setFloat(final int parameterIndex, final float x) throws SQLException { + public void setBigDecimal(final int parameterIndex, final BigDecimal x) throws SQLException { checkOpen(); try { - getDelegatePreparedStatement().setFloat(parameterIndex, x); + getDelegatePreparedStatement().setBigDecimal(parameterIndex, x); } catch (final SQLException e) { handleException(e); } } @Override - public void setDouble(final int parameterIndex, final double x) throws SQLException { + public void setBinaryStream(final int parameterIndex, final InputStream inputStream) throws SQLException { checkOpen(); try { - getDelegatePreparedStatement().setDouble(parameterIndex, x); + getDelegatePreparedStatement().setBinaryStream(parameterIndex, inputStream); } catch (final SQLException e) { handleException(e); } } @Override - public void setBigDecimal(final int parameterIndex, final BigDecimal x) throws SQLException { + public void setBinaryStream(final int parameterIndex, final InputStream x, final int length) throws SQLException { checkOpen(); try { - getDelegatePreparedStatement().setBigDecimal(parameterIndex, x); + getDelegatePreparedStatement().setBinaryStream(parameterIndex, x, length); } catch (final SQLException e) { handleException(e); } } @Override - public void setString(final int parameterIndex, final String x) throws SQLException { + public void setBinaryStream(final int parameterIndex, final InputStream inputStream, final long length) + throws SQLException { checkOpen(); try { - getDelegatePreparedStatement().setString(parameterIndex, x); + getDelegatePreparedStatement().setBinaryStream(parameterIndex, inputStream, length); } catch (final SQLException e) { handleException(e); } } @Override - public void setBytes(final int parameterIndex, final byte[] x) throws SQLException { + public void setBlob(final int i, final Blob x) throws SQLException { checkOpen(); try { - getDelegatePreparedStatement().setBytes(parameterIndex, x); + getDelegatePreparedStatement().setBlob(i, x); } catch (final SQLException e) { handleException(e); } } @Override - public void setDate(final int parameterIndex, final Date x) throws SQLException { + public void setBlob(final int parameterIndex, final InputStream inputStream) throws SQLException { checkOpen(); try { - getDelegatePreparedStatement().setDate(parameterIndex, x); + getDelegatePreparedStatement().setBlob(parameterIndex, inputStream); } catch (final SQLException e) { handleException(e); } } @Override - public void setTime(final int parameterIndex, final Time x) throws SQLException { + public void setBlob(final int parameterIndex, final InputStream inputStream, final long length) + throws SQLException { checkOpen(); try { - getDelegatePreparedStatement().setTime(parameterIndex, x); + getDelegatePreparedStatement().setBlob(parameterIndex, inputStream, length); } catch (final SQLException e) { handleException(e); } } @Override - public void setTimestamp(final int parameterIndex, final Timestamp x) throws SQLException { + public void setBoolean(final int parameterIndex, final boolean x) throws SQLException { checkOpen(); try { - getDelegatePreparedStatement().setTimestamp(parameterIndex, x); + getDelegatePreparedStatement().setBoolean(parameterIndex, x); } catch (final SQLException e) { handleException(e); } } @Override - public void setAsciiStream(final int parameterIndex, final InputStream x, final int length) throws SQLException { + public void setByte(final int parameterIndex, final byte x) throws SQLException { checkOpen(); try { - getDelegatePreparedStatement().setAsciiStream(parameterIndex, x, length); + getDelegatePreparedStatement().setByte(parameterIndex, x); } catch (final SQLException e) { handleException(e); } } - /** @deprecated Use setAsciiStream(), setCharacterStream() or setNCharacterStream() */ - @Deprecated @Override - public void setUnicodeStream(final int parameterIndex, final InputStream x, final int length) throws SQLException { + public void setBytes(final int parameterIndex, final byte[] x) throws SQLException { checkOpen(); try { - getDelegatePreparedStatement().setUnicodeStream(parameterIndex, x, length); + getDelegatePreparedStatement().setBytes(parameterIndex, x); } catch (final SQLException e) { handleException(e); } } @Override - public void setBinaryStream(final int parameterIndex, final InputStream x, final int length) throws SQLException { + public void setCharacterStream(final int parameterIndex, final Reader reader) throws SQLException { checkOpen(); try { - getDelegatePreparedStatement().setBinaryStream(parameterIndex, x, length); + getDelegatePreparedStatement().setCharacterStream(parameterIndex, reader); } catch (final SQLException e) { handleException(e); } } @Override - public void clearParameters() throws SQLException { + public void setCharacterStream(final int parameterIndex, final Reader reader, final int length) + throws SQLException { checkOpen(); try { - getDelegatePreparedStatement().clearParameters(); + getDelegatePreparedStatement().setCharacterStream(parameterIndex, reader, length); } catch (final SQLException e) { handleException(e); } } @Override - public void setObject(final int parameterIndex, final Object x, final int targetSqlType, final int scale) + public void setCharacterStream(final int parameterIndex, final Reader reader, final long length) throws SQLException { checkOpen(); try { - getDelegatePreparedStatement().setObject(parameterIndex, x, targetSqlType, scale); + getDelegatePreparedStatement().setCharacterStream(parameterIndex, reader, length); } catch (final SQLException e) { handleException(e); } } @Override - public void setObject(final int parameterIndex, final Object x, final int targetSqlType) throws SQLException { + public void setClob(final int i, final Clob x) throws SQLException { checkOpen(); try { - getDelegatePreparedStatement().setObject(parameterIndex, x, targetSqlType); + getDelegatePreparedStatement().setClob(i, x); } catch (final SQLException e) { handleException(e); } } @Override - public void setObject(final int parameterIndex, final Object x) throws SQLException { + public void setClob(final int parameterIndex, final Reader reader) throws SQLException { checkOpen(); try { - getDelegatePreparedStatement().setObject(parameterIndex, x); + getDelegatePreparedStatement().setClob(parameterIndex, reader); } catch (final SQLException e) { handleException(e); } } @Override - public boolean execute() throws SQLException { + public void setClob(final int parameterIndex, final Reader reader, final long length) throws SQLException { checkOpen(); - if (getConnectionInternal() != null) { - getConnectionInternal().setLastUsed(); - } try { - return getDelegatePreparedStatement().execute(); + getDelegatePreparedStatement().setClob(parameterIndex, reader, length); } catch (final SQLException e) { handleException(e); - return false; } } @Override - public void addBatch() throws SQLException { + public void setDate(final int parameterIndex, final Date x) throws SQLException { checkOpen(); try { - getDelegatePreparedStatement().addBatch(); + getDelegatePreparedStatement().setDate(parameterIndex, x); } catch (final SQLException e) { handleException(e); } } @Override - public void setCharacterStream(final int parameterIndex, final Reader reader, final int length) - throws SQLException { + public void setDate(final int parameterIndex, final Date x, final Calendar cal) throws SQLException { checkOpen(); try { - getDelegatePreparedStatement().setCharacterStream(parameterIndex, reader, length); + getDelegatePreparedStatement().setDate(parameterIndex, x, cal); } catch (final SQLException e) { handleException(e); } } @Override - public void setRef(final int i, final Ref x) throws SQLException { + public void setDouble(final int parameterIndex, final double x) throws SQLException { checkOpen(); try { - getDelegatePreparedStatement().setRef(i, x); + getDelegatePreparedStatement().setDouble(parameterIndex, x); } catch (final SQLException e) { handleException(e); } } @Override - public void setBlob(final int i, final Blob x) throws SQLException { + public void setFloat(final int parameterIndex, final float x) throws SQLException { checkOpen(); try { - getDelegatePreparedStatement().setBlob(i, x); + getDelegatePreparedStatement().setFloat(parameterIndex, x); } catch (final SQLException e) { handleException(e); } } @Override - public void setClob(final int i, final Clob x) throws SQLException { + public void setInt(final int parameterIndex, final int x) throws SQLException { checkOpen(); try { - getDelegatePreparedStatement().setClob(i, x); + getDelegatePreparedStatement().setInt(parameterIndex, x); } catch (final SQLException e) { handleException(e); } } @Override - public void setArray(final int i, final Array x) throws SQLException { + public void setLong(final int parameterIndex, final long x) throws SQLException { checkOpen(); try { - getDelegatePreparedStatement().setArray(i, x); + getDelegatePreparedStatement().setLong(parameterIndex, x); } catch (final SQLException e) { handleException(e); } } @Override - public ResultSetMetaData getMetaData() throws SQLException { + public void setNCharacterStream(final int parameterIndex, final Reader reader) throws SQLException { checkOpen(); try { - return getDelegatePreparedStatement().getMetaData(); + getDelegatePreparedStatement().setNCharacterStream(parameterIndex, reader); } catch (final SQLException e) { handleException(e); - throw new AssertionError(); } } @Override - public void setDate(final int parameterIndex, final Date x, final Calendar cal) throws SQLException { + public void setNCharacterStream(final int parameterIndex, final Reader value, final long length) + throws SQLException { checkOpen(); try { - getDelegatePreparedStatement().setDate(parameterIndex, x, cal); + getDelegatePreparedStatement().setNCharacterStream(parameterIndex, value, length); } catch (final SQLException e) { handleException(e); } } @Override - public void setTime(final int parameterIndex, final Time x, final Calendar cal) throws SQLException { + public void setNClob(final int parameterIndex, final NClob value) throws SQLException { checkOpen(); try { - getDelegatePreparedStatement().setTime(parameterIndex, x, cal); + getDelegatePreparedStatement().setNClob(parameterIndex, value); } catch (final SQLException e) { handleException(e); } } @Override - public void setTimestamp(final int parameterIndex, final Timestamp x, final Calendar cal) throws SQLException { + public void setNClob(final int parameterIndex, final Reader reader) throws SQLException { checkOpen(); try { - getDelegatePreparedStatement().setTimestamp(parameterIndex, x, cal); + getDelegatePreparedStatement().setNClob(parameterIndex, reader); } catch (final SQLException e) { handleException(e); } } @Override - public void setNull(final int paramIndex, final int sqlType, final String typeName) throws SQLException { + public void setNClob(final int parameterIndex, final Reader reader, final long length) throws SQLException { checkOpen(); try { - getDelegatePreparedStatement().setNull(paramIndex, sqlType, typeName); + getDelegatePreparedStatement().setNClob(parameterIndex, reader, length); } catch (final SQLException e) { handleException(e); } } - /** - * Returns a String representation of this object. - * - * @return String - */ - @SuppressWarnings("resource") @Override - public String toString() { - final Statement statement = getDelegate(); - return statement == null ? "NULL" : statement.toString(); - } - - @Override - public void setURL(final int parameterIndex, final java.net.URL x) throws SQLException { + public void setNString(final int parameterIndex, final String value) throws SQLException { checkOpen(); try { - getDelegatePreparedStatement().setURL(parameterIndex, x); + getDelegatePreparedStatement().setNString(parameterIndex, value); } catch (final SQLException e) { handleException(e); } } @Override - public java.sql.ParameterMetaData getParameterMetaData() throws SQLException { + public void setNull(final int parameterIndex, final int sqlType) throws SQLException { checkOpen(); try { - return getDelegatePreparedStatement().getParameterMetaData(); + getDelegatePreparedStatement().setNull(parameterIndex, sqlType); } catch (final SQLException e) { handleException(e); - throw new AssertionError(); } } @Override - public void setRowId(final int parameterIndex, final RowId value) throws SQLException { + public void setNull(final int paramIndex, final int sqlType, final String typeName) throws SQLException { checkOpen(); try { - getDelegatePreparedStatement().setRowId(parameterIndex, value); + getDelegatePreparedStatement().setNull(paramIndex, sqlType, typeName); } catch (final SQLException e) { handleException(e); } } @Override - public void setNString(final int parameterIndex, final String value) throws SQLException { + public void setObject(final int parameterIndex, final Object x) throws SQLException { checkOpen(); try { - getDelegatePreparedStatement().setNString(parameterIndex, value); + getDelegatePreparedStatement().setObject(parameterIndex, x); } catch (final SQLException e) { handleException(e); } } @Override - public void setNCharacterStream(final int parameterIndex, final Reader value, final long length) - throws SQLException { + public void setObject(final int parameterIndex, final Object x, final int targetSqlType) throws SQLException { checkOpen(); try { - getDelegatePreparedStatement().setNCharacterStream(parameterIndex, value, length); + getDelegatePreparedStatement().setObject(parameterIndex, x, targetSqlType); } catch (final SQLException e) { handleException(e); } } @Override - public void setNClob(final int parameterIndex, final NClob value) throws SQLException { + public void setObject(final int parameterIndex, final Object x, final int targetSqlType, final int scale) + throws SQLException { checkOpen(); try { - getDelegatePreparedStatement().setNClob(parameterIndex, value); + getDelegatePreparedStatement().setObject(parameterIndex, x, targetSqlType, scale); } catch (final SQLException e) { handleException(e); } } + /** + * @since 2.5.0 + */ @Override - public void setClob(final int parameterIndex, final Reader reader, final long length) throws SQLException { + public void setObject(final int parameterIndex, final Object x, final SQLType targetSqlType) throws SQLException { checkOpen(); try { - getDelegatePreparedStatement().setClob(parameterIndex, reader, length); + getDelegatePreparedStatement().setObject(parameterIndex, x, targetSqlType); } catch (final SQLException e) { handleException(e); } } + /** + * @since 2.5.0 + */ @Override - public void setBlob(final int parameterIndex, final InputStream inputStream, final long length) - throws SQLException { + public void setObject(final int parameterIndex, final Object x, final SQLType targetSqlType, final int scaleOrLength) throws SQLException { checkOpen(); try { - getDelegatePreparedStatement().setBlob(parameterIndex, inputStream, length); + getDelegatePreparedStatement().setObject(parameterIndex, x, targetSqlType, scaleOrLength); } catch (final SQLException e) { handleException(e); } } @Override - public void setNClob(final int parameterIndex, final Reader reader, final long length) throws SQLException { + public void setRef(final int i, final Ref x) throws SQLException { checkOpen(); try { - getDelegatePreparedStatement().setNClob(parameterIndex, reader, length); + getDelegatePreparedStatement().setRef(i, x); } catch (final SQLException e) { handleException(e); } } @Override - public void setSQLXML(final int parameterIndex, final SQLXML value) throws SQLException { + public void setRowId(final int parameterIndex, final RowId value) throws SQLException { checkOpen(); try { - getDelegatePreparedStatement().setSQLXML(parameterIndex, value); + getDelegatePreparedStatement().setRowId(parameterIndex, value); } catch (final SQLException e) { handleException(e); } } @Override - public void setAsciiStream(final int parameterIndex, final InputStream inputStream, final long length) - throws SQLException { + public void setShort(final int parameterIndex, final short x) throws SQLException { checkOpen(); try { - getDelegatePreparedStatement().setAsciiStream(parameterIndex, inputStream, length); + getDelegatePreparedStatement().setShort(parameterIndex, x); } catch (final SQLException e) { handleException(e); } } @Override - public void setBinaryStream(final int parameterIndex, final InputStream inputStream, final long length) - throws SQLException { + public void setSQLXML(final int parameterIndex, final SQLXML value) throws SQLException { checkOpen(); try { - getDelegatePreparedStatement().setBinaryStream(parameterIndex, inputStream, length); + getDelegatePreparedStatement().setSQLXML(parameterIndex, value); } catch (final SQLException e) { handleException(e); } } @Override - public void setCharacterStream(final int parameterIndex, final Reader reader, final long length) - throws SQLException { + public void setString(final int parameterIndex, final String x) throws SQLException { checkOpen(); try { - getDelegatePreparedStatement().setCharacterStream(parameterIndex, reader, length); + getDelegatePreparedStatement().setString(parameterIndex, x); } catch (final SQLException e) { handleException(e); } } @Override - public void setAsciiStream(final int parameterIndex, final InputStream inputStream) throws SQLException { + public void setTime(final int parameterIndex, final Time x) throws SQLException { checkOpen(); try { - getDelegatePreparedStatement().setAsciiStream(parameterIndex, inputStream); + getDelegatePreparedStatement().setTime(parameterIndex, x); } catch (final SQLException e) { handleException(e); } } @Override - public void setBinaryStream(final int parameterIndex, final InputStream inputStream) throws SQLException { + public void setTime(final int parameterIndex, final Time x, final Calendar cal) throws SQLException { checkOpen(); try { - getDelegatePreparedStatement().setBinaryStream(parameterIndex, inputStream); + getDelegatePreparedStatement().setTime(parameterIndex, x, cal); } catch (final SQLException e) { handleException(e); } } @Override - public void setCharacterStream(final int parameterIndex, final Reader reader) throws SQLException { + public void setTimestamp(final int parameterIndex, final Timestamp x) throws SQLException { checkOpen(); try { - getDelegatePreparedStatement().setCharacterStream(parameterIndex, reader); + getDelegatePreparedStatement().setTimestamp(parameterIndex, x); } catch (final SQLException e) { handleException(e); } } @Override - public void setNCharacterStream(final int parameterIndex, final Reader reader) throws SQLException { + public void setTimestamp(final int parameterIndex, final Timestamp x, final Calendar cal) throws SQLException { checkOpen(); try { - getDelegatePreparedStatement().setNCharacterStream(parameterIndex, reader); + getDelegatePreparedStatement().setTimestamp(parameterIndex, x, cal); } catch (final SQLException e) { handleException(e); } } + /** @deprecated Use setAsciiStream(), setCharacterStream() or setNCharacterStream() */ + @Deprecated @Override - public void setClob(final int parameterIndex, final Reader reader) throws SQLException { + public void setUnicodeStream(final int parameterIndex, final InputStream x, final int length) throws SQLException { checkOpen(); try { - getDelegatePreparedStatement().setClob(parameterIndex, reader); + getDelegatePreparedStatement().setUnicodeStream(parameterIndex, x, length); } catch (final SQLException e) { handleException(e); } } @Override - public void setBlob(final int parameterIndex, final InputStream inputStream) throws SQLException { + public void setURL(final int parameterIndex, final java.net.URL x) throws SQLException { checkOpen(); try { - getDelegatePreparedStatement().setBlob(parameterIndex, inputStream); + getDelegatePreparedStatement().setURL(parameterIndex, x); } catch (final SQLException e) { handleException(e); } } + /** + * Returns a String representation of this object. + * + * @return String + */ + @SuppressWarnings("resource") @Override - public void setNClob(final int parameterIndex, final Reader reader) throws SQLException { - checkOpen(); - try { - getDelegatePreparedStatement().setNClob(parameterIndex, reader); - } catch (final SQLException e) { - handleException(e); - } + public String toString() { + final Statement statement = getDelegate(); + return statement == null ? "NULL" : statement.toString(); } } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org