mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
添加ExceptionSorter
git-svn-id: http://code.alibabatech.com/svn/druid/trunk@306 b9813039-fb51-4c41-a8b9-e21c2acb5095
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -54,6 +54,13 @@ public class PoolableConnection implements PooledConnection, Connection {
|
||||
this.holder = holder;
|
||||
}
|
||||
|
||||
protected SQLException checkException(Throwable t) throws SQLException {
|
||||
// if (mc != null) mc.connectionError(t);
|
||||
// if (t instanceof SQLException) throw (SQLException) t;
|
||||
// else throw new NestedSQLException("Error", t);
|
||||
return null;
|
||||
}
|
||||
|
||||
void closePoolableStatement(PoolablePreparedStatement stmt) throws SQLException {
|
||||
PreparedStatement rawStatement = stmt.getRawPreparedStatement();
|
||||
|
||||
@@ -118,7 +125,8 @@ public class PoolableConnection implements PooledConnection, Connection {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
|
||||
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency)
|
||||
throws SQLException {
|
||||
checkOpen();
|
||||
|
||||
if (holder.isPoolPreparedStatements()) {
|
||||
@@ -142,7 +150,8 @@ public class PoolableConnection implements PooledConnection, Connection {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
|
||||
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency,
|
||||
int resultSetHoldability) throws SQLException {
|
||||
checkOpen();
|
||||
|
||||
if (holder.isPoolPreparedStatements()) {
|
||||
@@ -155,7 +164,8 @@ public class PoolableConnection implements PooledConnection, Connection {
|
||||
return poolableStatement;
|
||||
}
|
||||
|
||||
PreparedStatement stmt = conn.prepareStatement(sql, resultSetType, resultSetConcurrency, resultSetHoldability);
|
||||
PreparedStatement stmt = conn.prepareStatement(sql, resultSetType, resultSetConcurrency,
|
||||
resultSetHoldability);
|
||||
|
||||
holder.getDataSource().initStatement(stmt);
|
||||
|
||||
@@ -264,7 +274,8 @@ public class PoolableConnection implements PooledConnection, Connection {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
|
||||
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency,
|
||||
int resultSetHoldability) throws SQLException {
|
||||
checkOpen();
|
||||
|
||||
if (holder.isPoolPreparedStatements()) {
|
||||
@@ -328,7 +339,8 @@ public class PoolableConnection implements PooledConnection, Connection {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
|
||||
public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability)
|
||||
throws SQLException {
|
||||
checkOpen();
|
||||
|
||||
Statement stmt = conn.createStatement(resultSetType, resultSetConcurrency, resultSetHoldability);
|
||||
|
||||
@@ -73,283 +73,503 @@ public class PoolablePreparedStatement extends PoolableStatement implements Prep
|
||||
|
||||
@Override
|
||||
public ResultSet executeQuery() throws SQLException {
|
||||
ResultSet rs = stmt.executeQuery();
|
||||
try {
|
||||
ResultSet rs = stmt.executeQuery();
|
||||
|
||||
PoolableResultSet poolableResultSet = new PoolableResultSet(this, rs);
|
||||
resultSetTrace.add(poolableResultSet);
|
||||
PoolableResultSet poolableResultSet = new PoolableResultSet(this, rs);
|
||||
resultSetTrace.add(poolableResultSet);
|
||||
|
||||
return poolableResultSet;
|
||||
return poolableResultSet;
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int executeUpdate() throws SQLException {
|
||||
return stmt.executeUpdate();
|
||||
try {
|
||||
return stmt.executeUpdate();
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNull(int parameterIndex, int sqlType) throws SQLException {
|
||||
stmt.setNull(parameterIndex, sqlType);
|
||||
try {
|
||||
stmt.setNull(parameterIndex, sqlType);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBoolean(int parameterIndex, boolean x) throws SQLException {
|
||||
stmt.setBoolean(parameterIndex, x);
|
||||
try {
|
||||
stmt.setBoolean(parameterIndex, x);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setByte(int parameterIndex, byte x) throws SQLException {
|
||||
stmt.setByte(parameterIndex, x);
|
||||
try {
|
||||
stmt.setByte(parameterIndex, x);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setShort(int parameterIndex, short x) throws SQLException {
|
||||
stmt.setShort(parameterIndex, x);
|
||||
try {
|
||||
stmt.setShort(parameterIndex, x);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInt(int parameterIndex, int x) throws SQLException {
|
||||
stmt.setInt(parameterIndex, x);
|
||||
try {
|
||||
stmt.setInt(parameterIndex, x);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLong(int parameterIndex, long x) throws SQLException {
|
||||
stmt.setLong(parameterIndex, x);
|
||||
try {
|
||||
stmt.setLong(parameterIndex, x);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFloat(int parameterIndex, float x) throws SQLException {
|
||||
stmt.setFloat(parameterIndex, x);
|
||||
try {
|
||||
stmt.setFloat(parameterIndex, x);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDouble(int parameterIndex, double x) throws SQLException {
|
||||
stmt.setDouble(parameterIndex, x);
|
||||
try {
|
||||
stmt.setDouble(parameterIndex, x);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException {
|
||||
stmt.setBigDecimal(parameterIndex, x);
|
||||
try {
|
||||
stmt.setBigDecimal(parameterIndex, x);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setString(int parameterIndex, String x) throws SQLException {
|
||||
stmt.setString(parameterIndex, x);
|
||||
try {
|
||||
stmt.setString(parameterIndex, x);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBytes(int parameterIndex, byte[] x) throws SQLException {
|
||||
stmt.setBytes(parameterIndex, x);
|
||||
try {
|
||||
stmt.setBytes(parameterIndex, x);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDate(int parameterIndex, Date x) throws SQLException {
|
||||
stmt.setDate(parameterIndex, x);
|
||||
try {
|
||||
stmt.setDate(parameterIndex, x);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTime(int parameterIndex, Time x) throws SQLException {
|
||||
stmt.setTime(parameterIndex, x);
|
||||
try {
|
||||
stmt.setTime(parameterIndex, x);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTimestamp(int parameterIndex, Timestamp x) throws SQLException {
|
||||
stmt.setTimestamp(parameterIndex, x);
|
||||
try {
|
||||
stmt.setTimestamp(parameterIndex, x);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException {
|
||||
stmt.setAsciiStream(parameterIndex, x, length);
|
||||
try {
|
||||
stmt.setAsciiStream(parameterIndex, x, length);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException {
|
||||
stmt.setUnicodeStream(parameterIndex, x, length);
|
||||
try {
|
||||
stmt.setUnicodeStream(parameterIndex, x, length);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException {
|
||||
stmt.setBinaryStream(parameterIndex, x, length);
|
||||
try {
|
||||
stmt.setBinaryStream(parameterIndex, x, length);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearParameters() throws SQLException {
|
||||
stmt.clearParameters();
|
||||
try {
|
||||
stmt.clearParameters();
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException {
|
||||
stmt.setObject(parameterIndex, x, targetSqlType);
|
||||
try {
|
||||
stmt.setObject(parameterIndex, x, targetSqlType);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setObject(int parameterIndex, Object x) throws SQLException {
|
||||
stmt.setObject(parameterIndex, x);
|
||||
try {
|
||||
stmt.setObject(parameterIndex, x);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute() throws SQLException {
|
||||
return stmt.execute();
|
||||
try {
|
||||
return stmt.execute();
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addBatch() throws SQLException {
|
||||
stmt.addBatch();
|
||||
try {
|
||||
stmt.addBatch();
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCharacterStream(int parameterIndex, Reader reader, int length) throws SQLException {
|
||||
stmt.setCharacterStream(parameterIndex, reader, length);
|
||||
try {
|
||||
stmt.setCharacterStream(parameterIndex, reader, length);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRef(int parameterIndex, Ref x) throws SQLException {
|
||||
stmt.setRef(parameterIndex, x);
|
||||
try {
|
||||
stmt.setRef(parameterIndex, x);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlob(int parameterIndex, Blob x) throws SQLException {
|
||||
stmt.setBlob(parameterIndex, x);
|
||||
try {
|
||||
stmt.setBlob(parameterIndex, x);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setClob(int parameterIndex, Clob x) throws SQLException {
|
||||
stmt.setClob(parameterIndex, x);
|
||||
try {
|
||||
stmt.setClob(parameterIndex, x);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setArray(int parameterIndex, Array x) throws SQLException {
|
||||
stmt.setArray(parameterIndex, x);
|
||||
try {
|
||||
stmt.setArray(parameterIndex, x);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSetMetaData getMetaData() throws SQLException {
|
||||
return stmt.getMetaData();
|
||||
try {
|
||||
return stmt.getMetaData();
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDate(int parameterIndex, Date x, Calendar cal) throws SQLException {
|
||||
stmt.setDate(parameterIndex, x, cal);
|
||||
try {
|
||||
stmt.setDate(parameterIndex, x, cal);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTime(int parameterIndex, Time x, Calendar cal) throws SQLException {
|
||||
stmt.setTime(parameterIndex, x, cal);
|
||||
try {
|
||||
stmt.setTime(parameterIndex, x, cal);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) throws SQLException {
|
||||
stmt.setTimestamp(parameterIndex, x, cal);
|
||||
try {
|
||||
stmt.setTimestamp(parameterIndex, x, cal);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNull(int parameterIndex, int sqlType, String typeName) throws SQLException {
|
||||
stmt.setNull(parameterIndex, sqlType, typeName);
|
||||
try {
|
||||
stmt.setNull(parameterIndex, sqlType, typeName);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setURL(int parameterIndex, URL x) throws SQLException {
|
||||
stmt.setURL(parameterIndex, x);
|
||||
try {
|
||||
stmt.setURL(parameterIndex, x);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParameterMetaData getParameterMetaData() throws SQLException {
|
||||
return stmt.getParameterMetaData();
|
||||
try {
|
||||
return stmt.getParameterMetaData();
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRowId(int parameterIndex, RowId x) throws SQLException {
|
||||
stmt.setRowId(parameterIndex, x);
|
||||
try {
|
||||
stmt.setRowId(parameterIndex, x);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNString(int parameterIndex, String value) throws SQLException {
|
||||
stmt.setNString(parameterIndex, value);
|
||||
try {
|
||||
stmt.setNString(parameterIndex, value);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException {
|
||||
stmt.setNCharacterStream(parameterIndex, value, length);
|
||||
try {
|
||||
stmt.setNCharacterStream(parameterIndex, value, length);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNClob(int parameterIndex, NClob value) throws SQLException {
|
||||
stmt.setNClob(parameterIndex, value);
|
||||
try {
|
||||
stmt.setNClob(parameterIndex, value);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setClob(int parameterIndex, Reader reader, long length) throws SQLException {
|
||||
stmt.setClob(parameterIndex, reader, length);
|
||||
try {
|
||||
stmt.setClob(parameterIndex, reader, length);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException {
|
||||
stmt.setBlob(parameterIndex, inputStream, length);
|
||||
try {
|
||||
stmt.setBlob(parameterIndex, inputStream, length);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNClob(int parameterIndex, Reader reader, long length) throws SQLException {
|
||||
stmt.setNClob(parameterIndex, reader, length);
|
||||
try {
|
||||
stmt.setNClob(parameterIndex, reader, length);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException {
|
||||
stmt.setSQLXML(parameterIndex, xmlObject);
|
||||
try {
|
||||
stmt.setSQLXML(parameterIndex, xmlObject);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength) throws SQLException {
|
||||
stmt.setObject(parameterIndex, x, targetSqlType, scaleOrLength);
|
||||
try {
|
||||
stmt.setObject(parameterIndex, x, targetSqlType, scaleOrLength);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAsciiStream(int parameterIndex, InputStream x, long length) throws SQLException {
|
||||
stmt.setAsciiStream(parameterIndex, x, length);
|
||||
try {
|
||||
stmt.setAsciiStream(parameterIndex, x, length);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBinaryStream(int parameterIndex, InputStream x, long length) throws SQLException {
|
||||
stmt.setBinaryStream(parameterIndex, x, length);
|
||||
try {
|
||||
stmt.setBinaryStream(parameterIndex, x, length);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCharacterStream(int parameterIndex, Reader reader, long length) throws SQLException {
|
||||
stmt.setCharacterStream(parameterIndex, reader, length);
|
||||
try {
|
||||
stmt.setCharacterStream(parameterIndex, reader, length);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAsciiStream(int parameterIndex, InputStream x) throws SQLException {
|
||||
stmt.setAsciiStream(parameterIndex, x);
|
||||
try {
|
||||
stmt.setAsciiStream(parameterIndex, x);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBinaryStream(int parameterIndex, InputStream x) throws SQLException {
|
||||
stmt.setBinaryStream(parameterIndex, x);
|
||||
try {
|
||||
stmt.setBinaryStream(parameterIndex, x);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCharacterStream(int parameterIndex, Reader reader) throws SQLException {
|
||||
stmt.setCharacterStream(parameterIndex, reader);
|
||||
try {
|
||||
stmt.setCharacterStream(parameterIndex, reader);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException {
|
||||
stmt.setNCharacterStream(parameterIndex, value);
|
||||
try {
|
||||
stmt.setNCharacterStream(parameterIndex, value);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setClob(int parameterIndex, Reader reader) throws SQLException {
|
||||
stmt.setClob(parameterIndex, reader);
|
||||
try {
|
||||
stmt.setClob(parameterIndex, reader);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlob(int parameterIndex, InputStream inputStream) throws SQLException {
|
||||
stmt.setBlob(parameterIndex, inputStream);
|
||||
try {
|
||||
stmt.setBlob(parameterIndex, inputStream);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNClob(int parameterIndex, Reader reader) throws SQLException {
|
||||
stmt.setNClob(parameterIndex, reader);
|
||||
try {
|
||||
stmt.setNClob(parameterIndex, reader);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
static class PreparedStatementKey {
|
||||
|
||||
@@ -37,6 +37,10 @@ public class PoolableStatement extends PoolableWrapper implements Statement {
|
||||
this.stmt = stmt;
|
||||
}
|
||||
|
||||
protected SQLException checkException(Throwable error) throws SQLException {
|
||||
return conn.checkException(error);
|
||||
}
|
||||
|
||||
public PoolableConnection getPoolableConnection() {
|
||||
return conn;
|
||||
}
|
||||
@@ -60,17 +64,25 @@ public class PoolableStatement extends PoolableWrapper implements Statement {
|
||||
|
||||
@Override
|
||||
public final ResultSet executeQuery(String sql) throws SQLException {
|
||||
ResultSet rs = stmt.executeQuery(sql);
|
||||
try {
|
||||
ResultSet rs = stmt.executeQuery(sql);
|
||||
|
||||
PoolableResultSet poolableResultSet = new PoolableResultSet(this, rs);
|
||||
resultSetTrace.add(poolableResultSet);
|
||||
PoolableResultSet poolableResultSet = new PoolableResultSet(this, rs);
|
||||
resultSetTrace.add(poolableResultSet);
|
||||
|
||||
return poolableResultSet;
|
||||
return poolableResultSet;
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int executeUpdate(String sql) throws SQLException {
|
||||
return stmt.executeUpdate(sql);
|
||||
try {
|
||||
return stmt.executeUpdate(sql);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -84,127 +96,223 @@ public class PoolableStatement extends PoolableWrapper implements Statement {
|
||||
|
||||
@Override
|
||||
public final int getMaxFieldSize() throws SQLException {
|
||||
return stmt.getMaxFieldSize();
|
||||
try {
|
||||
return stmt.getMaxFieldSize();
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void setMaxFieldSize(int max) throws SQLException {
|
||||
stmt.setMaxFieldSize(max);
|
||||
try {
|
||||
stmt.setMaxFieldSize(max);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int getMaxRows() throws SQLException {
|
||||
return stmt.getMaxRows();
|
||||
try {
|
||||
return stmt.getMaxRows();
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void setMaxRows(int max) throws SQLException {
|
||||
stmt.setMaxRows(max);
|
||||
try {
|
||||
stmt.setMaxRows(max);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void setEscapeProcessing(boolean enable) throws SQLException {
|
||||
stmt.setEscapeProcessing(enable);
|
||||
try {
|
||||
stmt.setEscapeProcessing(enable);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int getQueryTimeout() throws SQLException {
|
||||
return stmt.getQueryTimeout();
|
||||
try {
|
||||
return stmt.getQueryTimeout();
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void setQueryTimeout(int seconds) throws SQLException {
|
||||
stmt.setQueryTimeout(seconds);
|
||||
try {
|
||||
stmt.setQueryTimeout(seconds);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void cancel() throws SQLException {
|
||||
stmt.cancel();
|
||||
try {
|
||||
stmt.cancel();
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final SQLWarning getWarnings() throws SQLException {
|
||||
return stmt.getWarnings();
|
||||
try {
|
||||
return stmt.getWarnings();
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void clearWarnings() throws SQLException {
|
||||
stmt.clearWarnings();
|
||||
try {
|
||||
stmt.clearWarnings();
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void setCursorName(String name) throws SQLException {
|
||||
stmt.setCursorName(name);
|
||||
try {
|
||||
stmt.setCursorName(name);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean execute(String sql) throws SQLException {
|
||||
return stmt.execute(sql);
|
||||
try {
|
||||
return stmt.execute(sql);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final ResultSet getResultSet() throws SQLException {
|
||||
ResultSet rs = stmt.getResultSet();
|
||||
try {
|
||||
ResultSet rs = stmt.getResultSet();
|
||||
|
||||
PoolableResultSet poolableResultSet = new PoolableResultSet(this, rs);
|
||||
resultSetTrace.add(poolableResultSet);
|
||||
PoolableResultSet poolableResultSet = new PoolableResultSet(this, rs);
|
||||
resultSetTrace.add(poolableResultSet);
|
||||
|
||||
return poolableResultSet;
|
||||
return poolableResultSet;
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int getUpdateCount() throws SQLException {
|
||||
return stmt.getUpdateCount();
|
||||
try {
|
||||
return stmt.getUpdateCount();
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean getMoreResults() throws SQLException {
|
||||
return stmt.getMoreResults();
|
||||
try {
|
||||
return stmt.getMoreResults();
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void setFetchDirection(int direction) throws SQLException {
|
||||
stmt.setFetchDirection(direction);
|
||||
try {
|
||||
stmt.setFetchDirection(direction);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int getFetchDirection() throws SQLException {
|
||||
return stmt.getFetchDirection();
|
||||
try {
|
||||
return stmt.getFetchDirection();
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void setFetchSize(int rows) throws SQLException {
|
||||
stmt.setFetchSize(rows);
|
||||
try {
|
||||
stmt.setFetchSize(rows);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int getFetchSize() throws SQLException {
|
||||
return stmt.getFetchSize();
|
||||
try {
|
||||
return stmt.getFetchSize();
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int getResultSetConcurrency() throws SQLException {
|
||||
return stmt.getResultSetConcurrency();
|
||||
try {
|
||||
return stmt.getResultSetConcurrency();
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int getResultSetType() throws SQLException {
|
||||
return stmt.getResultSetType();
|
||||
try {
|
||||
return stmt.getResultSetType();
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void addBatch(String sql) throws SQLException {
|
||||
stmt.addBatch(sql);
|
||||
try {
|
||||
stmt.addBatch(sql);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void clearBatch() throws SQLException {
|
||||
stmt.clearBatch();
|
||||
try {
|
||||
stmt.clearBatch();
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int[] executeBatch() throws SQLException {
|
||||
return stmt.executeBatch();
|
||||
try {
|
||||
return stmt.executeBatch();
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -214,58 +322,98 @@ public class PoolableStatement extends PoolableWrapper implements Statement {
|
||||
|
||||
@Override
|
||||
public final boolean getMoreResults(int current) throws SQLException {
|
||||
return stmt.getMoreResults(current);
|
||||
try {
|
||||
return stmt.getMoreResults(current);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final ResultSet getGeneratedKeys() throws SQLException {
|
||||
ResultSet rs = stmt.getGeneratedKeys();
|
||||
try {
|
||||
ResultSet rs = stmt.getGeneratedKeys();
|
||||
|
||||
PoolableResultSet poolableResultSet = new PoolableResultSet(this, rs);
|
||||
PoolableResultSet poolableResultSet = new PoolableResultSet(this, rs);
|
||||
|
||||
resultSetTrace.add(poolableResultSet);
|
||||
resultSetTrace.add(poolableResultSet);
|
||||
|
||||
return poolableResultSet;
|
||||
return poolableResultSet;
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException {
|
||||
return stmt.executeUpdate(sql, autoGeneratedKeys);
|
||||
try {
|
||||
return stmt.executeUpdate(sql, autoGeneratedKeys);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int executeUpdate(String sql, int columnIndexes[]) throws SQLException {
|
||||
return stmt.executeUpdate(sql, columnIndexes);
|
||||
try {
|
||||
return stmt.executeUpdate(sql, columnIndexes);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int executeUpdate(String sql, String columnNames[]) throws SQLException {
|
||||
return stmt.executeUpdate(sql, columnNames);
|
||||
try {
|
||||
return stmt.executeUpdate(sql, columnNames);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean execute(String sql, int autoGeneratedKeys) throws SQLException {
|
||||
return stmt.execute(sql, autoGeneratedKeys);
|
||||
try {
|
||||
return stmt.execute(sql, autoGeneratedKeys);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean execute(String sql, int columnIndexes[]) throws SQLException {
|
||||
return stmt.execute(sql, columnIndexes);
|
||||
try {
|
||||
return stmt.execute(sql, columnIndexes);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean execute(String sql, String columnNames[]) throws SQLException {
|
||||
return stmt.execute(sql, columnNames);
|
||||
try {
|
||||
return stmt.execute(sql, columnNames);
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int getResultSetHoldability() throws SQLException {
|
||||
return stmt.getResultSetHoldability();
|
||||
try {
|
||||
return stmt.getResultSetHoldability();
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean isClosed() throws SQLException {
|
||||
return stmt.isClosed();
|
||||
try {
|
||||
return stmt.isClosed();
|
||||
} catch (Throwable t) {
|
||||
throw checkException(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user