/** * Overridden to provide caching support. * @throws SQLException if thrown while attempting to release statement */ @Override public void release() throws SQLException { st.close(); st = null; // Clear delegate to ensure no possible reuse. setStatementListener(null); }
@Override public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException { if (!open) throw new SQLException(MSG_CONNECTION_CLOSED); CachedPreparedStatement x = new CachedPreparedStatement(sql, con.prepareStatement(sql, columnNames)); x.setCacheable(false); x.setStatementListener(this); synchronized(nonCacheable) { nonCacheable.add(x); } return x; }
@Override public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException { if (!open) throw new SQLException(MSG_CONNECTION_CLOSED); CachedPreparedStatement x = new CachedPreparedStatement(sql, con.prepareStatement(sql, columnIndexes)); x.setCacheable(false); x.setStatementListener(this); synchronized(nonCacheable) { nonCacheable.add(x); } return x; }
@Override public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException { if (!open) throw new SQLException(MSG_CONNECTION_CLOSED); CachedPreparedStatement x = new CachedPreparedStatement(sql, con.prepareStatement(sql, autoGeneratedKeys)); x.setCacheable(false); x.setStatementListener(this); synchronized(nonCacheable) { nonCacheable.add(x); } return x; }
cps.setStatementListener(this); cps.setOpen(); cps.setStatementListener(this); cps.setOpen(); log_debug(pool.getName() + ": PreparedStatement cache miss [" + sql + "," + cps.getParametersString() + "] - " + showHitRate(psHit, psReq, "PS-"));