/** * @see PGProperty#PREFER_QUERY_MODE * @return preferred query execution mode */ public PreferQueryMode getPreferQueryMode() { return PreferQueryMode.of(PGProperty.PREFER_QUERY_MODE.get(properties)); }
/** * @see PGProperty#PREFER_QUERY_MODE * @param preferQueryMode extended, simple, extendedForPrepared, or extendedCacheEverything */ public void setPreferQueryMode(PreferQueryMode preferQueryMode) { PGProperty.PREFER_QUERY_MODE.set(properties, preferQueryMode.value()); }
public static PreferQueryMode of(String mode) { for (PreferQueryMode preferQueryMode : values()) { if (preferQueryMode.value.equals(mode)) { return preferQueryMode; } } return EXTENDED; }
public boolean executeWithFlags(CachedQuery simpleQuery, int flags) throws SQLException { checkClosed(); if (connection.getPreferQueryMode().compareTo(PreferQueryMode.EXTENDED) < 0) { flags |= QueryExecutor.QUERY_EXECUTE_AS_SIMPLE; } execute(simpleQuery, null, flags); synchronized (this) { checkClosed(); return (result != null && result.getResultSet() != null); } }
boolean splitStatements = isParameterized || queryExecutor.getPreferQueryMode().compareTo(PreferQueryMode.EXTENDED) >= 0;
protected QueryExecutorBase(PGStream pgStream, String user, String database, int cancelSignalTimeout, Properties info) throws SQLException { this.pgStream = pgStream; this.user = user; this.database = database; this.cancelSignalTimeout = cancelSignalTimeout; this.reWriteBatchedInserts = PGProperty.REWRITE_BATCHED_INSERTS.getBoolean(info); this.columnSanitiserDisabled = PGProperty.DISABLE_COLUMN_SANITISER.getBoolean(info); String preferMode = PGProperty.PREFER_QUERY_MODE.get(info); this.preferQueryMode = PreferQueryMode.of(preferMode); this.autoSave = AutoSave.of(PGProperty.AUTOSAVE.get(info)); this.cachedQueryCreateAction = new CachedQueryCreateAction(this); statementCache = new LruCache<Object, CachedQuery>( Math.max(0, PGProperty.PREPARED_STATEMENT_CACHE_QUERIES.getInt(info)), Math.max(0, PGProperty.PREPARED_STATEMENT_CACHE_SIZE_MIB.getInt(info) * 1024 * 1024), false, cachedQueryCreateAction, new LruCache.EvictAction<CachedQuery>() { @Override public void evict(CachedQuery cachedQuery) throws SQLException { cachedQuery.query.close(); } }); }