Search in sources :

Example 16 with PreparedStatementProxy

use of com.alibaba.druid.proxy.jdbc.PreparedStatementProxy in project druid by alibaba.

the class PreparedStatementPool method closeRemovedStatement.

public void closeRemovedStatement(PreparedStatementHolder holder) {
    if (LOG.isDebugEnabled()) {
        String message = null;
        if (holder.statement instanceof PreparedStatementProxy) {
            PreparedStatementProxy stmtProxy = (PreparedStatementProxy) holder.statement;
            if (stmtProxy instanceof CallableStatementProxy) {
                message = "{conn-" + stmtProxy.getConnectionProxy().getId() + ", cstmt-" + stmtProxy.getId() + "} exit cache";
            } else {
                message = "{conn-" + stmtProxy.getConnectionProxy().getId() + ", pstmt-" + stmtProxy.getId() + "} exit cache";
            }
        } else {
            message = "stmt exit cache";
        }
        LOG.debug(message);
    }
    holder.setPooling(false);
    if (holder.isInUse()) {
        return;
    }
    if (holder.isEnterOracleImplicitCache()) {
        try {
            OracleUtils.exitImplicitCacheToClose(holder.statement);
        } catch (Exception ex) {
            LOG.error("exitImplicitCacheToClose error", ex);
        }
    }
    dataSource.closePreapredStatement(holder);
}
Also used : CallableStatementProxy(com.alibaba.druid.proxy.jdbc.CallableStatementProxy) PreparedStatementProxy(com.alibaba.druid.proxy.jdbc.PreparedStatementProxy) SQLException(java.sql.SQLException)

Aggregations

PreparedStatementProxy (com.alibaba.druid.proxy.jdbc.PreparedStatementProxy)16 SQLException (java.sql.SQLException)5 FilterChain (com.alibaba.druid.filter.FilterChain)4 DruidDataSource (com.alibaba.druid.pool.DruidDataSource)4 FilterAdapter (com.alibaba.druid.filter.FilterAdapter)3 CallableStatementProxy (com.alibaba.druid.proxy.jdbc.CallableStatementProxy)3 ResultSetProxy (com.alibaba.druid.proxy.jdbc.ResultSetProxy)3 StatementProxy (com.alibaba.druid.proxy.jdbc.StatementProxy)3 ConnectionProxy (com.alibaba.druid.proxy.jdbc.ConnectionProxy)2 PreparedStatement (java.sql.PreparedStatement)2 FilterChainImpl (com.alibaba.druid.filter.FilterChainImpl)1 FilterEventAdapter (com.alibaba.druid.filter.FilterEventAdapter)1 DruidPooledConnection (com.alibaba.druid.pool.DruidPooledConnection)1 ConnectionProxyImpl (com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl)1 DataSourceProxy (com.alibaba.druid.proxy.jdbc.DataSourceProxy)1 DataSourceProxyConfig (com.alibaba.druid.proxy.jdbc.DataSourceProxyConfig)1 DataSourceProxyImpl (com.alibaba.druid.proxy.jdbc.DataSourceProxyImpl)1 PreparedStatementProxyImpl (com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl)1 ResultSetProxyImpl (com.alibaba.druid.proxy.jdbc.ResultSetProxyImpl)1 BigDecimal (java.math.BigDecimal)1