Search in sources :

Example 6 with CallableStatementProxy

use of com.alibaba.druid.proxy.jdbc.CallableStatementProxy 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)

Example 7 with CallableStatementProxy

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

the class WallFilter method connection_prepareCall.

@Override
public CallableStatementProxy connection_prepareCall(FilterChain chain, ConnectionProxy connection, String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
    String dbType = connection.getDirectDataSource().getDbType();
    WallContext.create(dbType);
    try {
        sql = check(sql);
        CallableStatementProxy stmt = chain.connection_prepareCall(connection, sql, resultSetType, resultSetConcurrency, resultSetHoldability);
        setSqlStatAttribute(stmt);
        return stmt;
    } finally {
        WallContext.clearContext();
    }
}
Also used : CallableStatementProxy(com.alibaba.druid.proxy.jdbc.CallableStatementProxy)

Example 8 with CallableStatementProxy

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

the class FilterEventAdapter method connection_prepareCall.

@Override
public CallableStatementProxy connection_prepareCall(FilterChain chain, ConnectionProxy connection, String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
    CallableStatementProxy statement = super.connection_prepareCall(chain, connection, sql, resultSetType, resultSetConcurrency);
    statementPrepareCallAfter(statement);
    return statement;
}
Also used : CallableStatementProxy(com.alibaba.druid.proxy.jdbc.CallableStatementProxy)

Aggregations

CallableStatementProxy (com.alibaba.druid.proxy.jdbc.CallableStatementProxy)8 PreparedStatementProxy (com.alibaba.druid.proxy.jdbc.PreparedStatementProxy)3 SQLException (java.sql.SQLException)3 FilterAdapter (com.alibaba.druid.filter.FilterAdapter)2 FilterChain (com.alibaba.druid.filter.FilterChain)2 DruidDataSource (com.alibaba.druid.pool.DruidDataSource)2 ConnectionProxy (com.alibaba.druid.proxy.jdbc.ConnectionProxy)1 PreparedStatement (java.sql.PreparedStatement)1