Package com.alibaba.druid.pool
Class DruidPooledStatement
- java.lang.Object
-
- com.alibaba.druid.pool.PoolableWrapper
-
- com.alibaba.druid.pool.DruidPooledStatement
-
- All Implemented Interfaces:
AutoCloseable,Statement,Wrapper
- Direct Known Subclasses:
DruidPooledPreparedStatement
public class DruidPooledStatement extends PoolableWrapper implements Statement
- Author:
- wenshao [szujobs@hotmail.com]
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanclosedprotected DruidPooledConnectionconnprotected intexceptionCountprotected intfetchRowPeakprotected List<ResultSet>resultSetTrace-
Fields inherited from interface java.sql.Statement
CLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO
-
-
Constructor Summary
Constructors Constructor Description DruidPooledStatement(DruidPooledConnection conn, Statement stmt)
-
Method Summary
-
Methods inherited from class com.alibaba.druid.pool.PoolableWrapper
isWrapperFor, unwrap
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.sql.Statement
enquoteIdentifier, enquoteLiteral, enquoteNCharLiteral, executeLargeBatch, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, getLargeMaxRows, getLargeUpdateCount, isSimpleIdentifier, setLargeMaxRows
-
Methods inherited from interface java.sql.Wrapper
isWrapperFor, unwrap
-
-
-
-
Field Detail
-
conn
protected DruidPooledConnection conn
-
closed
protected boolean closed
-
fetchRowPeak
protected int fetchRowPeak
-
exceptionCount
protected int exceptionCount
-
-
Constructor Detail
-
DruidPooledStatement
public DruidPooledStatement(DruidPooledConnection conn, Statement stmt)
-
-
Method Detail
-
addResultSetTrace
protected void addResultSetTrace(ResultSet resultSet)
-
recordFetchRowCount
protected void recordFetchRowCount(int fetchRowCount)
-
getFetchRowPeak
public int getFetchRowPeak()
-
checkException
protected SQLException checkException(Throwable error) throws SQLException
- Throws:
SQLException
-
checkException
protected SQLException checkException(Throwable error, String sql) throws SQLException
- Throws:
SQLException
-
handleSocketTimeout
protected void handleSocketTimeout(Throwable error) throws SQLException
- Throws:
SQLException
-
getPoolableConnection
public DruidPooledConnection getPoolableConnection()
-
getStatement
public Statement getStatement()
-
checkOpen
protected void checkOpen() throws SQLException- Throws:
SQLException
-
clearResultSet
protected void clearResultSet()
-
incrementExecuteCount
public void incrementExecuteCount()
-
incrementExecuteBatchCount
public void incrementExecuteBatchCount()
-
incrementExecuteUpdateCount
public void incrementExecuteUpdateCount()
-
incrementExecuteQueryCount
public void incrementExecuteQueryCount()
-
transactionRecord
protected void transactionRecord(String sql) throws SQLException
- Throws:
SQLException
-
executeQuery
public final ResultSet executeQuery(String sql) throws SQLException
- Specified by:
executeQueryin interfaceStatement- Throws:
SQLException
-
executeUpdate
public final int executeUpdate(String sql) throws SQLException
- Specified by:
executeUpdatein interfaceStatement- Throws:
SQLException
-
errorCheck
protected final void errorCheck(Throwable t)
-
executeUpdate
public final int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException
- Specified by:
executeUpdatein interfaceStatement- Throws:
SQLException
-
executeUpdate
public final int executeUpdate(String sql, int[] columnIndexes) throws SQLException
- Specified by:
executeUpdatein interfaceStatement- Throws:
SQLException
-
executeUpdate
public final int executeUpdate(String sql, String[] columnNames) throws SQLException
- Specified by:
executeUpdatein interfaceStatement- Throws:
SQLException
-
execute
public final boolean execute(String sql, int autoGeneratedKeys) throws SQLException
- Specified by:
executein interfaceStatement- Throws:
SQLException
-
execute
public final boolean execute(String sql, int[] columnIndexes) throws SQLException
- Specified by:
executein interfaceStatement- Throws:
SQLException
-
execute
public final boolean execute(String sql, String[] columnNames) throws SQLException
- Specified by:
executein interfaceStatement- Throws:
SQLException
-
getMaxFieldSize
public int getMaxFieldSize() throws SQLException- Specified by:
getMaxFieldSizein interfaceStatement- Throws:
SQLException
-
close
public void close() throws SQLException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceStatement- Throws:
SQLException
-
setMaxFieldSize
public void setMaxFieldSize(int max) throws SQLException- Specified by:
setMaxFieldSizein interfaceStatement- Throws:
SQLException
-
getMaxRows
public final int getMaxRows() throws SQLException- Specified by:
getMaxRowsin interfaceStatement- Throws:
SQLException
-
setMaxRows
public void setMaxRows(int max) throws SQLException- Specified by:
setMaxRowsin interfaceStatement- Throws:
SQLException
-
setEscapeProcessing
public final void setEscapeProcessing(boolean enable) throws SQLException- Specified by:
setEscapeProcessingin interfaceStatement- Throws:
SQLException
-
getQueryTimeout
public final int getQueryTimeout() throws SQLException- Specified by:
getQueryTimeoutin interfaceStatement- Throws:
SQLException
-
setQueryTimeout
public void setQueryTimeout(int seconds) throws SQLException- Specified by:
setQueryTimeoutin interfaceStatement- Throws:
SQLException
-
cancel
public final void cancel() throws SQLException- Specified by:
cancelin interfaceStatement- Throws:
SQLException
-
getWarnings
public final SQLWarning getWarnings() throws SQLException
- Specified by:
getWarningsin interfaceStatement- Throws:
SQLException
-
clearWarnings
public final void clearWarnings() throws SQLException- Specified by:
clearWarningsin interfaceStatement- Throws:
SQLException
-
setCursorName
public final void setCursorName(String name) throws SQLException
- Specified by:
setCursorNamein interfaceStatement- Throws:
SQLException
-
execute
public final boolean execute(String sql) throws SQLException
- Specified by:
executein interfaceStatement- Throws:
SQLException
-
getResultSet
public final ResultSet getResultSet() throws SQLException
- Specified by:
getResultSetin interfaceStatement- Throws:
SQLException
-
getUpdateCount
public final int getUpdateCount() throws SQLException- Specified by:
getUpdateCountin interfaceStatement- Throws:
SQLException
-
getMoreResults
public final boolean getMoreResults() throws SQLException- Specified by:
getMoreResultsin interfaceStatement- Throws:
SQLException
-
setFetchDirection
public void setFetchDirection(int direction) throws SQLException- Specified by:
setFetchDirectionin interfaceStatement- Throws:
SQLException
-
getFetchDirection
public final int getFetchDirection() throws SQLException- Specified by:
getFetchDirectionin interfaceStatement- Throws:
SQLException
-
setFetchSize
public void setFetchSize(int rows) throws SQLException- Specified by:
setFetchSizein interfaceStatement- Throws:
SQLException
-
getFetchSize
public final int getFetchSize() throws SQLException- Specified by:
getFetchSizein interfaceStatement- Throws:
SQLException
-
getResultSetConcurrency
public final int getResultSetConcurrency() throws SQLException- Specified by:
getResultSetConcurrencyin interfaceStatement- Throws:
SQLException
-
getResultSetType
public final int getResultSetType() throws SQLException- Specified by:
getResultSetTypein interfaceStatement- Throws:
SQLException
-
addBatch
public final void addBatch(String sql) throws SQLException
- Specified by:
addBatchin interfaceStatement- Throws:
SQLException
-
clearBatch
public final void clearBatch() throws SQLException- Specified by:
clearBatchin interfaceStatement- Throws:
SQLException
-
executeBatch
public int[] executeBatch() throws SQLException- Specified by:
executeBatchin interfaceStatement- Throws:
SQLException
-
getConnection
public final Connection getConnection() throws SQLException
- Specified by:
getConnectionin interfaceStatement- Throws:
SQLException
-
getMoreResults
public final boolean getMoreResults(int current) throws SQLException- Specified by:
getMoreResultsin interfaceStatement- Throws:
SQLException
-
getGeneratedKeys
public final ResultSet getGeneratedKeys() throws SQLException
- Specified by:
getGeneratedKeysin interfaceStatement- Throws:
SQLException
-
getResultSetHoldability
public final int getResultSetHoldability() throws SQLException- Specified by:
getResultSetHoldabilityin interfaceStatement- Throws:
SQLException
-
isClosed
public final boolean isClosed() throws SQLException- Specified by:
isClosedin interfaceStatement- Throws:
SQLException
-
setPoolable
public final void setPoolable(boolean poolable) throws SQLException- Specified by:
setPoolablein interfaceStatement- Throws:
SQLException
-
isPoolable
public final boolean isPoolable() throws SQLException- Specified by:
isPoolablein interfaceStatement- Throws:
SQLException
-
closeOnCompletion
public void closeOnCompletion() throws SQLException- Specified by:
closeOnCompletionin interfaceStatement- Throws:
SQLException
-
isCloseOnCompletion
public boolean isCloseOnCompletion() throws SQLException- Specified by:
isCloseOnCompletionin interfaceStatement- Throws:
SQLException
-
-