A wrapper for a statement.
| Method from org.jboss.resource.adapter.jdbc.WrappedStatement Detail: |
public void addBatch(String sql) throws SQLException {
lock();
try
{
checkState();
try
{
s.addBatch(sql);
}
catch (Throwable t)
{
throw checkException(t);
}
}
finally
{
unlock();
}
}
|
public void cancel() throws SQLException {
checkState();
try
{
s.cancel();
}
catch (Throwable t)
{
throw checkException(t);
}
}
|
protected void checkConfiguredQueryTimeout() throws SQLException {
lc.checkConfiguredQueryTimeout(this);
}
|
protected SQLException checkException(Throwable t) throws SQLException {
throw lc.checkException(t);
}
|
void checkState() throws SQLException {
if (closed.get())
throw new SQLException("The statement is closed.");
}
|
protected void checkTransaction() throws SQLException {
checkState();
lc.checkTransaction();
}
|
protected void checkTransactionActive() throws SQLException {
lc.checkTransactionActive();
}
|
public void clearBatch() throws SQLException {
lock();
try
{
checkState();
try
{
s.clearBatch();
}
catch (Throwable t)
{
throw checkException(t);
}
}
finally
{
unlock();
}
}
|
public void clearWarnings() throws SQLException {
lock();
try
{
checkState();
try
{
s.clearWarnings();
}
catch (Throwable t)
{
throw checkException(t);
}
}
finally
{
unlock();
}
}
|
public void close() throws SQLException {
if (closed.get())
return;
closed.set(true);
lc.unregisterStatement(this);
internalClose();
}
|
protected void closeResultSets() {
if (lc.getTrackStatements() == BaseWrapperManagedConnectionFactory.TRACK_STATEMENTS_FALSE_INT)
return;
synchronized (this)
{
if (resultSets == null)
return;
for (Iterator< Map.Entry< WrappedResultSet, Throwable > > i = resultSets.entrySet().iterator(); i.hasNext();)
{
Map.Entry< WrappedResultSet, Throwable > entry = i.next();
WrappedResultSet resultSet = entry.getKey();
if (lc.getTrackStatements() == BaseWrapperManagedConnectionFactory.TRACK_STATEMENTS_TRUE_INT)
{
Throwable stackTrace = entry.getValue();
lc.getLogger().warn("Closing a result set you left open! Please close it yourself.", stackTrace);
}
try
{
resultSet.internalClose();
}
catch (Throwable t)
{
lc.getLogger().warn("Error closing a result set you left open! Please close it yourself.", t);
}
}
resultSets.clear();
}
}
|
public boolean execute(String sql) throws SQLException {
lock();
try
{
checkTransaction();
try
{
checkConfiguredQueryTimeout();
return s.execute(sql);
}
catch (Throwable t)
{
throw checkException(t);
}
}
finally
{
unlock();
}
}
|
public boolean execute(String sql,
int autoGeneratedKeys) throws SQLException {
lock();
try
{
checkTransaction();
try
{
checkConfiguredQueryTimeout();
return s.execute(sql, autoGeneratedKeys);
}
catch (Throwable t)
{
throw checkException(t);
}
}
finally
{
unlock();
}
}
|
public boolean execute(String sql,
int[] columnIndexes) throws SQLException {
lock();
try
{
checkTransaction();
try
{
checkConfiguredQueryTimeout();
return s.execute(sql, columnIndexes);
}
catch (Throwable t)
{
throw checkException(t);
}
}
finally
{
unlock();
}
}
|
public boolean execute(String sql,
String[] columnNames) throws SQLException {
lock();
try
{
checkTransaction();
try
{
checkConfiguredQueryTimeout();
return s.execute(sql, columnNames);
}
catch (Throwable t)
{
throw checkException(t);
}
}
finally
{
unlock();
}
}
|
public int[] executeBatch() throws SQLException {
lock();
try
{
checkState();
try
{
checkConfiguredQueryTimeout();
return s.executeBatch();
}
catch (Throwable t)
{
throw checkException(t);
}
}
finally
{
unlock();
}
}
|
public ResultSet executeQuery(String sql) throws SQLException {
lock();
try
{
checkTransaction();
try
{
checkConfiguredQueryTimeout();
ResultSet result = s.executeQuery(sql);
return registerResultSet(result);
}
catch (Throwable t)
{
throw checkException(t);
}
}
finally
{
unlock();
}
}
|
public int executeUpdate(String sql) throws SQLException {
lock();
try
{
checkTransaction();
try
{
checkConfiguredQueryTimeout();
return s.executeUpdate(sql);
}
catch (Throwable t)
{
throw checkException(t);
}
}
finally
{
unlock();
}
}
|
public int executeUpdate(String sql,
int autoGeneratedKeys) throws SQLException {
lock();
try
{
checkTransaction();
try
{
checkConfiguredQueryTimeout();
return s.executeUpdate(sql, autoGeneratedKeys);
}
catch (Throwable t)
{
throw checkException(t);
}
}
finally
{
unlock();
}
}
|
public int executeUpdate(String sql,
int[] columnIndexes) throws SQLException {
lock();
try
{
checkTransaction();
try
{
checkConfiguredQueryTimeout();
return s.executeUpdate(sql, columnIndexes);
}
catch (Throwable t)
{
throw checkException(t);
}
}
finally
{
unlock();
}
}
|
public int executeUpdate(String sql,
String[] columnNames) throws SQLException {
lock();
try
{
checkTransaction();
try
{
checkConfiguredQueryTimeout();
return s.executeUpdate(sql, columnNames);
}
catch (Throwable t)
{
throw checkException(t);
}
}
finally
{
unlock();
}
}
|
public Connection getConnection() throws SQLException {
return lc;
}
|
public int getFetchDirection() throws SQLException {
lock();
try
{
checkState();
try
{
return s.getFetchDirection();
}
catch (Throwable t)
{
throw checkException(t);
}
}
finally
{
unlock();
}
}
|
public int getFetchSize() throws SQLException {
lock();
try
{
checkState();
try
{
return s.getFetchSize();
}
catch (Throwable t)
{
throw checkException(t);
}
}
finally
{
unlock();
}
}
|
public ResultSet getGeneratedKeys() throws SQLException {
lock();
try
{
checkState();
try
{
ResultSet resultSet = s.getGeneratedKeys();
return registerResultSet(resultSet);
}
catch (Throwable t)
{
throw checkException(t);
}
}
finally
{
unlock();
}
}
|
public int getMaxFieldSize() throws SQLException {
lock();
try
{
checkState();
try
{
return s.getMaxFieldSize();
}
catch (Throwable t)
{
throw checkException(t);
}
}
finally
{
unlock();
}
}
|
public int getMaxRows() throws SQLException {
lock();
try
{
checkState();
try
{
return s.getMaxRows();
}
catch (Throwable t)
{
throw checkException(t);
}
}
finally
{
unlock();
}
}
|
public boolean getMoreResults() throws SQLException {
lock();
try
{
checkState();
try
{
return s.getMoreResults();
}
catch (Throwable t)
{
throw checkException(t);
}
}
finally
{
unlock();
}
}
|
public boolean getMoreResults(int current) throws SQLException {
lock();
try
{
checkState();
try
{
return s.getMoreResults(current);
}
catch (Throwable t)
{
throw checkException(t);
}
}
finally
{
unlock();
}
}
|
public int getQueryTimeout() throws SQLException {
lock();
try
{
checkState();
try
{
return s.getQueryTimeout();
}
catch (Throwable t)
{
throw checkException(t);
}
}
finally
{
unlock();
}
}
|
public ResultSet getResultSet() throws SQLException {
lock();
try
{
checkState();
try
{
ResultSet result = s.getResultSet();
if (result == null)
return null;
else
return registerResultSet(result);
}
catch (Throwable t)
{
throw checkException(t);
}
}
finally
{
unlock();
}
}
|
public int getResultSetConcurrency() throws SQLException {
lock();
try
{
checkState();
try
{
return s.getResultSetConcurrency();
}
catch (Throwable t)
{
throw checkException(t);
}
}
finally
{
unlock();
}
}
|
public int getResultSetHoldability() throws SQLException {
lock();
try
{
checkState();
try
{
return s.getResultSetHoldability();
}
catch (Throwable t)
{
throw checkException(t);
}
}
finally
{
unlock();
}
}
|
public int getResultSetType() throws SQLException {
lock();
try
{
checkState();
try
{
return s.getResultSetType();
}
catch (Throwable t)
{
throw checkException(t);
}
}
finally
{
unlock();
}
}
|
public Statement getUnderlyingStatement() throws SQLException {
lock();
try
{
checkState();
return s;
}
finally
{
unlock();
}
}
|
public int getUpdateCount() throws SQLException {
lock();
try
{
checkState();
try
{
return s.getUpdateCount();
}
catch (Throwable t)
{
throw checkException(t);
}
}
finally
{
unlock();
}
}
|
public SQLWarning getWarnings() throws SQLException {
lock();
try
{
checkState();
try
{
return s.getWarnings();
}
catch (Throwable t)
{
throw checkException(t);
}
}
finally
{
unlock();
}
}
|
protected Statement getWrappedObject() throws SQLException {
return getUnderlyingStatement();
}
|
protected void internalClose() throws SQLException {
closed.set(true);
try
{
closeResultSets();
}
finally
{
s.close();
}
}
|
protected void lock() throws SQLException {
lc.lock();
}
|
protected ResultSet registerResultSet(ResultSet resultSet) {
if (resultSet != null)
resultSet = wrapResultSet(resultSet);
if (lc.getTrackStatements() == BaseWrapperManagedConnectionFactory.TRACK_STATEMENTS_FALSE_INT)
return resultSet;
WrappedResultSet wrapped = (WrappedResultSet) resultSet;
synchronized (this)
{
if (resultSets == null)
resultSets = new HashMap< WrappedResultSet, Throwable >();
if (lc.getTrackStatements() == BaseWrapperManagedConnectionFactory.TRACK_STATEMENTS_TRUE_INT)
resultSets.put(wrapped, new Throwable("STACKTRACE"));
else
resultSets.put(wrapped, null);
}
return resultSet;
}
|
public void setCursorName(String name) throws SQLException {
lock();
try
{
checkState();
try
{
s.setCursorName(name);
}
catch (Throwable t)
{
throw checkException(t);
}
}
finally
{
unlock();
}
}
|
public void setEscapeProcessing(boolean enable) throws SQLException {
lock();
try
{
checkState();
try
{
s.setEscapeProcessing(enable);
}
catch (Throwable t)
{
throw checkException(t);
}
}
finally
{
unlock();
}
}
|
public void setFetchDirection(int direction) throws SQLException {
lock();
try
{
checkState();
try
{
s.setFetchDirection(direction);
}
catch (Throwable t)
{
throw checkException(t);
}
}
finally
{
unlock();
}
}
|
public void setFetchSize(int rows) throws SQLException {
lock();
try
{
checkState();
try
{
s.setFetchSize(rows);
}
catch (Throwable t)
{
throw checkException(t);
}
}
finally
{
unlock();
}
}
|
public void setMaxFieldSize(int max) throws SQLException {
lock();
try
{
checkState();
try
{
s.setMaxFieldSize(max);
}
catch (Throwable t)
{
throw checkException(t);
}
}
finally
{
unlock();
}
}
|
public void setMaxRows(int max) throws SQLException {
lock();
try
{
checkState();
try
{
s.setMaxRows(max);
}
catch (Throwable t)
{
throw checkException(t);
}
}
finally
{
unlock();
}
}
|
public void setQueryTimeout(int timeout) throws SQLException {
lock();
try
{
checkState();
try
{
s.setQueryTimeout(timeout);
}
catch (Throwable t)
{
throw checkException(t);
}
}
finally
{
unlock();
}
}
|
protected void unlock() {
lc.unlock();
}
|
protected void unregisterResultSet(WrappedResultSet resultSet) {
if (lc.getTrackStatements() == BaseWrapperManagedConnectionFactory.TRACK_STATEMENTS_FALSE_INT)
return;
synchronized (this)
{
if (resultSets != null)
resultSets.remove(resultSet);
}
}
|
abstract protected WrappedResultSet wrapResultSet(ResultSet resultSet)
|