/** Overrides method to provide caching support. */ @Override public Statement createStatement() throws SQLException { return createStatement(DEFAULT_RESULTSET_TYPE, DEFAULT_RESULTSET_CONCURRENCY, DEFAULT_RESULTSET_HOLDABILITY); }
log_debug(pool.getName() + ": Cleaning " + count + " cached Statement" + (count != 1 ? "s" : "")); synchronized(ssUsed) flushOpenStatements(); flushSpareStatements(); log_debug(pool.getName() + ": Cleaning " + count + " cached PreparedStatement" + (count != 1 ? "s" : "")); synchronized(psUsed) flushOpenPreparedStatements(); flushSparePreparedStatements(); log_debug(pool.getName() + ": Cleaning " + count + " cached CallableStatement" + (count != 1 ? "s" : "")); synchronized(csUsed) flushOpenCallableStatements(); flushSpareCallableStatements(); flushOpenNonCacheableStatements(); if (!getAutoCommit()) rollback(); log_warn(pool.getName() + ": " + sqlx.getMessage(), sqlx); setAutoCommit(true); clearWarnings();
ccon = new CacheConnection(this, con); ccon.setCacheStatements(cacheSS); ccon.setCachePreparedStatements(cachePS); ccon.setCacheCallableStatements(cacheCS); log_info("Created a new connection");
/** * Sets whether to use caching for {@link Statement} instances. * @param cache whether to cache {@code Statement} instances */ public void setCacheStatements(boolean cache) { // Release statements if required. if (cacheS && !cache) { try { flushSpareStatements(); } catch (SQLException sqlx) { log_warn(pool.getName() + ": " + sqlx.getMessage(), sqlx); } } this.cacheS = cache; }
/** * Sets whether to use caching for {@link PreparedStatement} instances. * @param cache whether to cache {@code PreparedStatement} instances */ public void setCachePreparedStatements(boolean cache) { // Release statements if required. if (cacheP && !cache) { try { flushSparePreparedStatements(); } catch (SQLException sqlx) { log_warn(pool.getName() + ": " + sqlx.getMessage(), sqlx); } } this.cacheP = cache; }
/** * Sets whether to use caching for {@link CallableStatement} instances. * @param cache whether to cache {@code CallableStatement} instances */ public void setCacheCallableStatements(boolean cache) { // Release statements if required. if (cacheC && !cache) { try { flushSpareCallableStatements(); } catch (SQLException sqlx) { log_warn(pool.getName() + ": " + sqlx.getMessage(), sqlx); } } this.cacheC = cache; }
/** Overrides method to provide caching support. */ @Override public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException { return createStatement(resultSetType, resultSetConcurrency, DEFAULT_RESULTSET_HOLDABILITY); }