com.impossibl.postgres.jdbc.PGStatementDelegator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pgjdbc-ng Show documentation
Show all versions of pgjdbc-ng Show documentation
PostgreSQL JDBC - NG - Driver
/**
* Copyright (c) 2013, impossibl.com
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of impossibl.com nor the names of its contributors may
* be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package com.impossibl.postgres.jdbc;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.SQLWarning;
import java.sql.Statement;
/**
* Statement delegator
*/
public class PGStatementDelegator implements Statement {
private PGPooledConnectionDelegator owner;
private Statement delegator;
/**
* Constructor
* @param owner The owner
* @param delegator The delegator
*/
public PGStatementDelegator(PGPooledConnectionDelegator owner, Statement delegator) {
this.owner = owner;
this.delegator = delegator;
}
/**
* {@inheritDoc}
*/
public void addBatch(String sql) throws SQLException {
delegator.addBatch(sql);
}
/**
* {@inheritDoc}
*/
public void cancel() throws SQLException {
delegator.cancel();
}
/**
* {@inheritDoc}
*/
public void clearBatch() throws SQLException {
delegator.clearBatch();
}
/**
* {@inheritDoc}
*/
public void clearWarnings() throws SQLException {
delegator.clearWarnings();
}
/**
* {@inheritDoc}
*/
public void close() throws SQLException {
delegator.close();
}
/**
* {@inheritDoc}
*/
public void closeOnCompletion() throws SQLException {
delegator.closeOnCompletion();
}
/**
* {@inheritDoc}
*/
public boolean execute(String sql) throws SQLException {
return delegator.execute(sql);
}
/**
* {@inheritDoc}
*/
public boolean execute(String sql, int autoGeneratedKeys) throws SQLException {
return delegator.execute(sql, autoGeneratedKeys);
}
/**
* {@inheritDoc}
*/
public boolean execute(String sql, int[] columnIndexes) throws SQLException {
return delegator.execute(sql, columnIndexes);
}
/**
* {@inheritDoc}
*/
public boolean execute(String sql, String[] columnNames) throws SQLException {
return delegator.execute(sql, columnNames);
}
/**
* {@inheritDoc}
*/
public int[] executeBatch() throws SQLException {
return delegator.executeBatch();
}
/**
* {@inheritDoc}
*/
public ResultSet executeQuery(String sql) throws SQLException {
return delegator.executeQuery(sql);
}
/**
* {@inheritDoc}
*/
public int executeUpdate(String sql) throws SQLException {
return delegator.executeUpdate(sql);
}
/**
* {@inheritDoc}
*/
public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException {
return delegator.executeUpdate(sql, autoGeneratedKeys);
}
/**
* {@inheritDoc}
*/
public int executeUpdate(String sql, int[] columnIndexes) throws SQLException {
return delegator.executeUpdate(sql, columnIndexes);
}
/**
* {@inheritDoc}
*/
public int executeUpdate(String sql, String[] columnNames) throws SQLException {
return delegator.executeUpdate(sql, columnNames);
}
/**
* {@inheritDoc}
*/
public Connection getConnection() throws SQLException {
return owner;
}
/**
* {@inheritDoc}
*/
public int getFetchDirection() throws SQLException {
return delegator.getFetchDirection();
}
/**
* {@inheritDoc}
*/
public int getFetchSize() throws SQLException {
return delegator.getFetchSize();
}
/**
* {@inheritDoc}
*/
public ResultSet getGeneratedKeys() throws SQLException {
return delegator.getGeneratedKeys();
}
/**
* {@inheritDoc}
*/
public int getMaxFieldSize() throws SQLException {
return delegator.getMaxFieldSize();
}
/**
* {@inheritDoc}
*/
public int getMaxRows() throws SQLException {
return delegator.getMaxRows();
}
/**
* {@inheritDoc}
*/
public boolean getMoreResults() throws SQLException {
return delegator.getMoreResults();
}
/**
* {@inheritDoc}
*/
public boolean getMoreResults(int current) throws SQLException {
return delegator.getMoreResults(current);
}
/**
* {@inheritDoc}
*/
public int getQueryTimeout() throws SQLException {
return delegator.getQueryTimeout();
}
/**
* {@inheritDoc}
*/
public ResultSet getResultSet() throws SQLException {
return delegator.getResultSet();
}
/**
* {@inheritDoc}
*/
public int getResultSetConcurrency() throws SQLException {
return delegator.getResultSetConcurrency();
}
/**
* {@inheritDoc}
*/
public int getResultSetHoldability() throws SQLException {
return delegator.getResultSetHoldability();
}
/**
* {@inheritDoc}
*/
public int getResultSetType() throws SQLException {
return delegator.getResultSetType();
}
/**
* {@inheritDoc}
*/
public int getUpdateCount() throws SQLException {
return delegator.getUpdateCount();
}
/**
* {@inheritDoc}
*/
public SQLWarning getWarnings() throws SQLException {
return delegator.getWarnings();
}
/**
* {@inheritDoc}
*/
public boolean isClosed() throws SQLException {
return delegator.isClosed();
}
/**
* {@inheritDoc}
*/
public boolean isCloseOnCompletion() throws SQLException {
return delegator.isCloseOnCompletion();
}
/**
* {@inheritDoc}
*/
public boolean isPoolable() throws SQLException {
return delegator.isPoolable();
}
/**
* {@inheritDoc}
*/
public void setCursorName(String name) throws SQLException {
delegator.setCursorName(name);
}
/**
* {@inheritDoc}
*/
public void setEscapeProcessing(boolean enable) throws SQLException {
delegator.setEscapeProcessing(enable);
}
/**
* {@inheritDoc}
*/
public void setFetchDirection(int direction) throws SQLException {
delegator.setFetchDirection(direction);
}
/**
* {@inheritDoc}
*/
public void setFetchSize(int rows) throws SQLException {
delegator.setFetchSize(rows);
}
/**
* {@inheritDoc}
*/
public void setMaxFieldSize(int max) throws SQLException {
delegator.setMaxFieldSize(max);
}
/**
* {@inheritDoc}
*/
public void setMaxRows(int max) throws SQLException {
delegator.setMaxRows(max);
}
/**
* {@inheritDoc}
*/
public void setPoolable(boolean poolable) throws SQLException {
delegator.setPoolable(poolable);
}
/**
* {@inheritDoc}
*/
public void setQueryTimeout(int seconds) throws SQLException {
delegator.setQueryTimeout(seconds);
}
/**
* {@inheritDoc}
*/
public boolean isWrapperFor(Class> iface) throws SQLException {
try {
//checkClosed();
return delegator.isWrapperFor(iface);
}
catch (SQLException se) {
owner.fireConnectionError(se);
throw se;
}
}
/**
* {@inheritDoc}
*/
public T unwrap(Class iface) throws SQLException {
try {
//checkClosed();
return delegator.unwrap(iface);
}
catch (SQLException se) {
owner.fireConnectionError(se);
throw se;
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy