package org.enhydra.jdbc.core;
import org.enhydra.jdbc.util.Logger;
import org.enhydra.jdbc.util.JdbcUtil;
import java.io.InputStream;
import java.io.Reader;
import java.math.BigDecimal;
import java.sql.Array;
import java.sql.Blob;
import java.sql.Clob;
import java.sql.Connection;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.Ref;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.SQLWarning;
import java.sql.Time;
import java.sql.Timestamp;
import java.util.Calendar;
public abstract class CorePreparedStatement
extends JdbcUtil
implements PreparedStatement {
public PreparedStatement ps;
public void setLogger(Logger alog) {
log = alog;
}
public void addBatch() throws SQLException {
try {
ps.addBatch();
} catch (SQLException e) {
catchInvoke(e);
}
}
public void clearParameters() throws SQLException {
try {
ps.clearParameters();
} catch (SQLException e) {
catchInvoke(e);
}
}
public boolean execute() throws SQLException {
try {
return ps.execute();
} catch (SQLException e) {
catchInvoke(e);
}
return false;
}
public ResultSet executeQuery() throws SQLException {
try {
return ps.executeQuery();
} catch (SQLException e) {
catchInvoke(e);
}
return null;
}
public int executeUpdate() throws SQLException {
try {
return ps.executeUpdate();
} catch (SQLException e) {
catchInvoke(e);
}
return 0;
}
public ResultSetMetaData getMetaData() throws SQLException {
try {
return ps.getMetaData();
} catch (SQLException e) {
catchInvoke(e);
}
return null;
}
public void setArray(int i, Array x) throws SQLException {
try {
ps.setArray(i, x);
} catch (SQLException e) {
catchInvoke(e);
}
}
public void setAsciiStream(int parameterIndex, InputStream x, int length)
throws SQLException {
try {
ps.setAsciiStream(parameterIndex, x, length);
} catch (SQLException e) {
catchInvoke(e);
}
}
public void setBigDecimal(int parameterIndex, BigDecimal x)
throws SQLException {
try {
ps.setBigDecimal(parameterIndex, x);
} catch (SQLException e) {
catchInvoke(e);
}
}
public void setBinaryStream(int parameterIndex, InputStream x, int length)
throws SQLException {
try {
ps.setBinaryStream(parameterIndex, x, length);
} catch (SQLException e) {
catchInvoke(e);
}
}
public void setBlob(int i, Blob x) throws SQLException {
try {
ps.setBlob(i, x);
} catch (SQLException e) {
catchInvoke(e);
}
}
public void setBoolean(int parameterIndex, boolean x) throws SQLException {
try {
ps.setBoolean(parameterIndex, x);
} catch (SQLException e) {
catchInvoke(e);
}
}
public void setByte(int parameterIndex, byte x) throws SQLException {
try {
ps.setByte(parameterIndex, x);
} catch (SQLException e) {
catchInvoke(e);
}
}
public void setBytes(int parameterIndex, byte x[]) throws SQLException {
try {
ps.setBytes(parameterIndex, x);
} catch (SQLException e) {
catchInvoke(e);
}
}
public void setCharacterStream(
int parameterIndex,
Reader reader,
int length)
throws SQLException {
try {
ps.setCharacterStream(parameterIndex, reader, length);
} catch (SQLException e) {
catchInvoke(e);
}
}
public void setClob(int i, Clob x) throws SQLException {
try {
ps.setClob(i, x);
} catch (SQLException e) {
catchInvoke(e);
}
}
public void setDate(int parameterIndex, Date x) throws SQLException {
try {
ps.setDate(parameterIndex, x);
} catch (SQLException e) {
catchInvoke(e);
}
}
public void setDate(int parameterIndex, Date x, Calendar cal)
throws SQLException {
try {
ps.setDate(parameterIndex, x, cal);
} catch (SQLException e) {
catchInvoke(e);
}
}
public void setDouble(int parameterIndex, double x) throws SQLException {
try {
ps.setDouble(parameterIndex, x);
} catch (SQLException e) {
catchInvoke(e);
}
}
public void setFloat(int parameterIndex, float x) throws SQLException {
try {
ps.setFloat(parameterIndex, x);
} catch (SQLException e) {
catchInvoke(e);
}
}
public void setInt(int parameterIndex, int x) throws SQLException {
try {
ps.setInt(parameterIndex, x);
} catch (SQLException e) {
catchInvoke(e);
}
}
public void setLong(int parameterIndex, long x) throws SQLException {
try {
ps.setLong(parameterIndex, x);
} catch (SQLException e) {
catchInvoke(e);
}
}
public void setNull(int parameterIndex, int sqlType) throws SQLException {
try {
ps.setNull(parameterIndex, sqlType);
} catch (SQLException e) {
catchInvoke(e);
}
}
public void setNull(int paramIndex, int sqlType, String typeName)
throws SQLException {
try {
ps.setNull(paramIndex, sqlType, typeName);
} catch (SQLException e) {
catchInvoke(e);
}
}
public void setObject(int parameterIndex, Object x) throws SQLException {
try {
ps.setObject(parameterIndex, x);
} catch (SQLException e) {
catchInvoke(e);
}
}
public void setObject(int parameterIndex, Object x, int targetSqlType)
throws SQLException {
try {
ps.setObject(parameterIndex, x, targetSqlType);
} catch (SQLException e) {
catchInvoke(e);
}
}
public void setObject(
int parameterIndex,
Object x,
int targetSqlType,
int scale)
throws SQLException {
try {
ps.setObject(parameterIndex, x, targetSqlType, scale);
} catch (SQLException e) {
catchInvoke(e);
}
}
public void setRef(int i, Ref x) throws SQLException {
try {
ps.setRef(i, x);
} catch (SQLException e) {
catchInvoke(e);
}
}
public void setShort(int parameterIndex, short x) throws SQLException {
try {
ps.setShort(parameterIndex, x);
} catch (SQLException e) {
catchInvoke(e);
}
}
public void setString(int parameterIndex, String x) throws SQLException {
try {
ps.setString(parameterIndex, x);
} catch (SQLException e) {
catchInvoke(e);
}
}
public void setTime(int parameterIndex, Time x) throws SQLException {
try {
ps.setTime(parameterIndex, x);
} catch (SQLException e) {
catchInvoke(e);
}
}
public void setTime(int parameterIndex, Time x, Calendar cal)
throws SQLException {
try {
ps.setTime(parameterIndex, x, cal);
} catch (SQLException e) {
catchInvoke(e);
}
}
public void setTimestamp(int parameterIndex, Timestamp x)
throws SQLException {
try {
ps.setTimestamp(parameterIndex, x);
} catch (SQLException e) {
catchInvoke(e);
}
}
public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal)
throws SQLException {
try {
ps.setTimestamp(parameterIndex, x, cal);
} catch (SQLException e) {
catchInvoke(e);
}
}
public void setUnicodeStream(int parameterIndex, InputStream x, int length)
throws SQLException {
try {
ps.setUnicodeStream(parameterIndex, x, length);
} catch (SQLException e) {
catchInvoke(e);
}
}
public void close() throws SQLException {
if (ps != null) {
ps.close();
}
}
public int[] executeBatch() throws SQLException {
try {
return ps.executeBatch();
} catch (SQLException e) {
catchInvoke(e);
}
return null;
}
public int getMaxFieldSize() throws SQLException {
try {
return ps.getMaxFieldSize();
} catch (SQLException e) {
catchInvoke(e);
}
return 0;
}
public void setMaxFieldSize(int max) throws SQLException {
try {
ps.setMaxFieldSize(max);
} catch (SQLException e) {
catchInvoke(e);
}
}
public int getMaxRows() throws SQLException {
try {
return ps.getMaxRows();
} catch (SQLException e) {
catchInvoke(e);
}
return 0;
}
public void setMaxRows(int max) throws SQLException {
try {
ps.setMaxRows(max);
} catch (SQLException e) {
catchInvoke(e);
}
}
public void setEscapeProcessing(boolean enable) throws SQLException {
try {
ps.setEscapeProcessing(enable);
} catch (SQLException e) {
catchInvoke(e);
}
}
public int getQueryTimeout() throws SQLException {
try {
return ps.getQueryTimeout();
} catch (SQLException e) {
catchInvoke(e);
}
return 0;
}
public void setQueryTimeout(int seconds) throws SQLException {
try {
ps.setQueryTimeout(seconds);
} catch (SQLException e) {
catchInvoke(e);
}
}
public void cancel() throws SQLException {
try {
ps.cancel();
} catch (SQLException e) {
catchInvoke(e);
}
}
public SQLWarning getWarnings() throws SQLException {
try {
return ps.getWarnings();
} catch (SQLException e) {
catchInvoke(e);
}
return null;
}
public void clearWarnings() throws SQLException {
try {
ps.clearWarnings();
} catch (SQLException e) {
catchInvoke(e);
}
}
public void setCursorName(String name) throws SQLException {
try {
ps.setCursorName(name);
} catch (SQLException e) {
catchInvoke(e);
}
}
public ResultSet getResultSet() throws SQLException {
try {
return ps.getResultSet();
} catch (SQLException e) {
catchInvoke(e);
}
return null;
}
public int getUpdateCount() throws SQLException {
try {
return ps.getUpdateCount();
} catch (SQLException e) {
catchInvoke(e);
}
return 0;
}
public boolean getMoreResults() throws SQLException {
try {
return ps.getMoreResults();
} catch (SQLException e) {
catchInvoke(e);
}
return false;
}
public void setFetchDirection(int direction) throws SQLException {
try {
ps.setFetchDirection(direction);
} catch (SQLException e) {
catchInvoke(e);
}
}
public int getFetchDirection() throws SQLException {
try {
return ps.getFetchDirection();
} catch (SQLException e) {
catchInvoke(e);
}
return 0;
}
public void setFetchSize(int rows) throws SQLException {
try {
ps.setFetchSize(rows);
} catch (SQLException e) {
catchInvoke(e);
}
}
public int getFetchSize() throws SQLException {
try {
return ps.getFetchSize();
} catch (SQLException e) {
catchInvoke(e);
}
return 0;
}
public int getResultSetConcurrency() throws SQLException {
try {
return ps.getResultSetConcurrency();
} catch (SQLException e) {
catchInvoke(e);
}
return 0;
}
public int getResultSetType() throws SQLException {
try {
return ps.getResultSetType();
} catch (SQLException e) {
catchInvoke(e);
}
return 0;
}
public Connection getConnection() throws SQLException {
try {
return ps.getConnection();
} catch (SQLException e) {
catchInvoke(e);
}
return null;
}
public void clearBatch() throws SQLException {
try {
ps.clearBatch();
} catch (SQLException e) {
catchInvoke(e);
}
}
public void addBatch(String s) throws SQLException {
try {
ps.addBatch(s);
} catch (SQLException e) {
catchInvoke(e);
}
}
public boolean execute(String s) throws SQLException {
try {
return ps.execute(s);
} catch (SQLException e) {
catchInvoke(e);
}
return false;
}
public ResultSet executeQuery(String s) throws SQLException {
try {
return ps.executeQuery(s);
} catch (SQLException e) {
catchInvoke(e);
}
return null;
}
public int executeUpdate(String s) throws SQLException {
try {
return ps.executeUpdate(s);
} catch (SQLException e) {
catchInvoke(e);
}
return 0;
}
public boolean execute(String sql, int autoGeneratedKeys) throws SQLException {
try {
return ps.execute(sql, autoGeneratedKeys);
} catch (SQLException e) {
catchInvoke(e);
}
return false;
}
public boolean execute(String sql, int[] columnIndexes) throws SQLException {
try {
return ps.execute(sql, columnIndexes);
} catch (SQLException e) {
catchInvoke(e);
}
return false;
}
public boolean execute(String sql, String[] columnNames) throws SQLException {
try {
return ps.execute(sql, columnNames);
} catch (SQLException e) {
catchInvoke(e);
}
return false;
}
public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException {
try {
return ps.executeUpdate(sql, autoGeneratedKeys);
} catch (SQLException e) {
catchInvoke(e);
}
return 0;
}
public int executeUpdate(String sql, int[] columnIndexes) throws SQLException {
try {
return ps.executeUpdate(sql, columnIndexes);
} catch (SQLException e) {
catchInvoke(e);
}
return 0;
}
public int executeUpdate(String sql, String[] columnNames) throws SQLException {
try {
return ps.executeUpdate(sql, columnNames);
} catch (SQLException e) {
catchInvoke(e);
}
return 0;
}
public java.sql.ResultSet getGeneratedKeys() throws SQLException {
try {
return ps.getGeneratedKeys();
} catch (SQLException e) {
catchInvoke(e);
}
return null;
}
public boolean getMoreResults(int current) throws SQLException {
try {
return ps.getMoreResults(current);
} catch (SQLException e) {
catchInvoke(e);
}
return false;
}
public int getResultSetHoldability() throws SQLException {
try {
return ps.getResultSetHoldability();
} catch (SQLException e) {
catchInvoke(e);
}
return 0;
}
public java.sql.ParameterMetaData getParameterMetaData() throws SQLException {
try {
return ps.getParameterMetaData();
} catch (SQLException e) {
catchInvoke(e);
}
return null;
}
public void setURL(int parameterIndex, java.net.URL x) throws SQLException {
try {
ps.setURL(parameterIndex, x);
} catch (SQLException e) {
catchInvoke(e);
}
}
abstract public void preInvoke() throws SQLException;
abstract public void catchInvoke(SQLException e) throws SQLException;
}