/*
* Bitronix Transaction Manager
*
* Copyright (c) 2010, Bitronix Software.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package bitronix.tm.resource.jdbc4;
import java.io.InputStream;
import java.io.Reader;
import java.sql.CallableStatement;
import java.sql.NClob;
import java.sql.PreparedStatement;
import java.sql.RowId;
import java.sql.SQLException;
import java.sql.SQLXML;
import bitronix.tm.resource.jdbc.JdbcPreparedStatementHandle;
/**
* Caching {@link PreparedStatement} wrapper.
* <p/>
* This class is a proxy handler for a PreparedStatement. It does not
* implement the PreparedStatement interface or extend a class directly,
* but you methods implemented here will override those of the
* underlying delegate. Simply implement a method with the same
* signature, and the local method will be called rather than the delegate.
* <p/>
*
* @author lorban, brettw
*/
public class Jdbc4PreparedStatementHandle extends JdbcPreparedStatementHandle {
public Jdbc4PreparedStatementHandle(String sql) {
super(sql);
}
public Jdbc4PreparedStatementHandle(String sql, int autoGeneratedKeys) {
super(sql, autoGeneratedKeys);
}
public Jdbc4PreparedStatementHandle(String sql, int resultSetType, int resultSetConcurrency) {
super(sql, resultSetType, resultSetConcurrency);
}
public Jdbc4PreparedStatementHandle(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) {
super(sql, resultSetType, resultSetConcurrency, resultSetHoldability);
}
public Jdbc4PreparedStatementHandle(String sql, int[] columnIndexes) {
super(sql, columnIndexes);
}
public Jdbc4PreparedStatementHandle(String sql, String[] columnNames) {
super(sql, columnNames);
}
/* java.sql.Wrapper implementation */
public boolean isWrapperFor(Class<?> iface) throws SQLException {
if (CallableStatement.class.equals(iface)) {
return true;
}
return false;
}
@SuppressWarnings("unchecked")
public <T> T unwrap(java.lang.Class<T> iface) throws java.sql.SQLException {
if (CallableStatement.class.equals(iface)) {
return (T) getDelegate();
}
throw new SQLException(getClass().getName() + " is not a wrapper for interface " + iface.getName());
}
/* Delegated JDBC4 methods */
public boolean isClosed() throws SQLException {
return getDelegate().isClosed();
}
public boolean isPoolable() throws SQLException {
return getDelegate().isPoolable();
}
public void setPoolable(boolean poolable) throws SQLException {
getDelegate().setPoolable(poolable);
}
public void setAsciiStream(int arg0, InputStream arg1, long arg2) throws SQLException {
getDelegate().setAsciiStream(arg0, arg1, arg2);
}
public void setAsciiStream(int arg0, InputStream arg1) throws SQLException {
getDelegate().setAsciiStream(arg0, arg1);
}
public void setBinaryStream(int arg0, InputStream arg1, long arg2) throws SQLException {
getDelegate().setBinaryStream(arg0, arg1, arg2);
}
public void setBinaryStream(int arg0, InputStream arg1) throws SQLException {
getDelegate().setBinaryStream(arg0, arg1);
}
public void setBlob(int arg0, InputStream arg1, long arg2) throws SQLException {
getDelegate().setBlob(arg0, arg1, arg2);
}
public void setBlob(int arg0, InputStream arg1) throws SQLException {
getDelegate().setBlob(arg0, arg1);
}
public void setCharacterStream(int arg0, Reader arg1, long arg2) throws SQLException {
getDelegate().setCharacterStream(arg0, arg1, arg2);
}
public void setCharacterStream(int arg0, Reader arg1) throws SQLException {
getDelegate().setCharacterStream(arg0, arg1);
}
public void setClob(int arg0, Reader arg1, long arg2) throws SQLException {
getDelegate().setClob(arg0, arg1, arg2);
}
public void setClob(int arg0, Reader arg1) throws SQLException {
getDelegate().setClob(arg0, arg1);
}
public void setNCharacterStream(int arg0, Reader arg1, long arg2) throws SQLException {
getDelegate().setNCharacterStream(arg0, arg1, arg2);
}
public void setNCharacterStream(int arg0, Reader arg1) throws SQLException {
getDelegate().setNCharacterStream(arg0, arg1);
}
public void setNClob(int arg0, NClob arg1) throws SQLException {
getDelegate().setNClob(arg0, arg1);
}
public void setNClob(int arg0, Reader arg1, long arg2) throws SQLException {
getDelegate().setNClob(arg0, arg1, arg2);
}
public void setNClob(int arg0, Reader arg1) throws SQLException {
getDelegate().setNClob(arg0, arg1);
}
public void setNString(int arg0, String arg1) throws SQLException {
getDelegate().setNString(arg0, arg1);
}
public void setRowId(int arg0, RowId arg1) throws SQLException {
getDelegate().setRowId(arg0, arg1);
}
public void setSQLXML(int arg0, SQLXML arg1) throws SQLException {
getDelegate().setSQLXML(arg0, arg1);
}
}