/* * StreamCruncher: Copyright (c) 2006-2008, Ashwin Jayaprakash. All Rights Reserved. * Contact: ashwin {dot} jayaprakash {at} gmail {dot} com * Web: http://www.StreamCruncher.com * * This file is part of StreamCruncher. * * StreamCruncher is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * StreamCruncher 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 StreamCruncher. If not, see <http://www.gnu.org/licenses/>. */ package streamcruncher.innards.util; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.SQLWarning; import java.sql.Statement; /* * Author: Ashwin Jayaprakash Date: Jan 6, 2007 Time: 9:27:26 AM */ /** * Interface methods as of JDK 1.6. */ public abstract class StatementWrapper implements Statement { protected final Connection wrappedConnection; protected final Statement realStatement; protected StatementWrapper(Connection wrappedConnection, Statement realStatement) { this.wrappedConnection = wrappedConnection; this.realStatement = realStatement; } public void addBatch(String sql) throws SQLException { realStatement.addBatch(sql); } public void cancel() throws SQLException { realStatement.cancel(); } public void clearBatch() throws SQLException { realStatement.clearBatch(); } public void clearWarnings() throws SQLException { realStatement.clearWarnings(); } public void close() throws SQLException { realStatement.close(); } public boolean execute(String sql) throws SQLException { return realStatement.execute(sql); } public boolean execute(String sql, int autoGeneratedKeys) throws SQLException { return realStatement.execute(sql, autoGeneratedKeys); } public boolean execute(String sql, int[] columnIndexes) throws SQLException { return realStatement.execute(sql, columnIndexes); } public boolean execute(String sql, String[] columnNames) throws SQLException { return realStatement.execute(sql, columnNames); } public int[] executeBatch() throws SQLException { return realStatement.executeBatch(); } public ResultSet executeQuery(String sql) throws SQLException { return realStatement.executeQuery(sql); } public int executeUpdate(String sql) throws SQLException { return realStatement.executeUpdate(sql); } public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException { return realStatement.executeUpdate(sql, autoGeneratedKeys); } public int executeUpdate(String sql, int[] columnIndexes) throws SQLException { return realStatement.executeUpdate(sql, columnIndexes); } public int executeUpdate(String sql, String[] columnNames) throws SQLException { return realStatement.executeUpdate(sql, columnNames); } public Connection getConnection() throws SQLException { return wrappedConnection; } public int getFetchDirection() throws SQLException { return realStatement.getFetchDirection(); } public int getFetchSize() throws SQLException { return realStatement.getFetchSize(); } public ResultSet getGeneratedKeys() throws SQLException { return realStatement.getGeneratedKeys(); } public int getMaxFieldSize() throws SQLException { return realStatement.getMaxFieldSize(); } public int getMaxRows() throws SQLException { return realStatement.getMaxRows(); } public boolean getMoreResults() throws SQLException { return realStatement.getMoreResults(); } public boolean getMoreResults(int current) throws SQLException { return realStatement.getMoreResults(current); } public int getQueryTimeout() throws SQLException { return realStatement.getQueryTimeout(); } public ResultSet getResultSet() throws SQLException { return realStatement.getResultSet(); } public int getResultSetConcurrency() throws SQLException { return realStatement.getResultSetConcurrency(); } public int getResultSetHoldability() throws SQLException { return realStatement.getResultSetHoldability(); } public int getResultSetType() throws SQLException { return realStatement.getResultSetType(); } public int getUpdateCount() throws SQLException { return realStatement.getUpdateCount(); } public SQLWarning getWarnings() throws SQLException { return realStatement.getWarnings(); } public boolean isClosed() throws SQLException { return realStatement.isClosed(); } public boolean isPoolable() throws SQLException { return realStatement.isPoolable(); } public void setCursorName(String name) throws SQLException { realStatement.setCursorName(name); } public void setEscapeProcessing(boolean enable) throws SQLException { realStatement.setEscapeProcessing(enable); } public void setFetchDirection(int direction) throws SQLException { realStatement.setFetchDirection(direction); } public void setFetchSize(int rows) throws SQLException { realStatement.setFetchSize(rows); } public void setMaxFieldSize(int max) throws SQLException { realStatement.setMaxFieldSize(max); } public void setMaxRows(int max) throws SQLException { realStatement.setMaxRows(max); } public void setPoolable(boolean poolable) throws SQLException { realStatement.setPoolable(poolable); } public void setQueryTimeout(int seconds) throws SQLException { realStatement.setQueryTimeout(seconds); } /** * todo Not sure how to implement this. {@inheritDoc} */ public boolean isWrapperFor(Class<?> iface) throws SQLException { throw new SQLException("Unsupported operation"); } /** * todo Not sure how to implement this. {@inheritDoc} */ public <T> T unwrap(Class<T> iface) throws SQLException { throw new SQLException("Unsupported operation"); } }