Top Fields Constructors Methods
org.postgresql.core

public abstract Class QueryExecutorBase

extends Object
implements QueryExecutor
Class Inheritance
All Implemented Interfaces
org.postgresql.core.QueryExecutor, org.postgresql.core.v3.TypeTransferModeRegistry
Known Direct Subclasses
org.postgresql.core.v3.QueryExecutorImpl
Imports
org.postgresql.PGNotification, .PGProperty, org.postgresql.jdbc.AutoSave, .EscapeSyntaxCallMode, .PreferQueryMode, .ResourceLock, org.postgresql.util.HostSpec, .LruCache, .PSQLException, .PSQLState, .ServerErrorMessage, org.checkerframework.checker.nullness.qual.MonotonicNonNull, .Nullable, java.io.Closeable, .IOException, java.sql.SQLException, .SQLWarning, java.util.ArrayList, .Collections, .Map, .Properties, .TreeMap, java.util.concurrent.locks.Condition, java.util.logging.Level, .Logger

Field Summary

Modifier and TypeField and Description
private AutoSave
private final CachedQueryCreateAction
private int
private int
private final int
protected final QueryExecutorCloseAction
private final boolean
private final String
private final EscapeSyntaxCallMode
private boolean
protected final ResourceLock
protected final Condition
private static final Logger
protected final boolean
private final ArrayList<PGNotification>
private final TreeMap<String, String>
protected final PGStream
private PreferQueryMode
private final boolean
private final boolean
private @MonotonicNonNull String
private int
private boolean
private final LruCache<Object, CachedQuery>
private TransactionState
private final String
private @Nullable SQLWarning

Constructor Summary

AccessConstructor and Description
protected
QueryExecutorBase(PGStream pgStream, int cancelSignalTimeout, Properties info)

Method Summary

Modifier and TypeMethod and Description
public void
abort()

Implements org.postgresql.core.QueryExecutor.abort.

Abort at network level without sending the Terminate message to the backend.

public void
public void
addWarning(SQLWarning newWarning)

public final CachedQuery
public final CachedQuery
public CachedQuery
public final CachedQuery
public void
close()

Implements org.postgresql.core.QueryExecutor.close.

Close this connection cleanly.

protected QueryExecutorCloseAction
public final CachedQuery
createQuery(String sql, boolean escapeProcessing, boolean isParameterized, @Nullable String... columnNames)

public CachedQuery
public final Object
createQueryKey(String sql, boolean escapeProcessing, boolean isParameterized, @Nullable String... columnNames)

public AutoSave
public int
getBackendPID()

Implements org.postgresql.core.QueryExecutor.getBackendPID.

Return the process ID (PID) of the backend server process handling this connection.

public Closeable
getCloseAction()

Implements org.postgresql.core.QueryExecutor.getCloseAction.

Returns an action that would close the connection cleanly.

public String
public Encoding
public EscapeSyntaxCallMode
public HostSpec
public int
public PGNotification[]
getNotifications()

Implements org.postgresql.core.QueryExecutor.getNotifications.

Retrieve and clear the set of asynchronous notifications pending on this connection.

public final @Nullable String
public final Map<String, String>
public PreferQueryMode
public boolean
public String
getServerVersion()

Implements org.postgresql.core.QueryExecutor.getServerVersion.

Return the server version from the server_version GUC.

public int
getServerVersionNum()

Implements org.postgresql.core.QueryExecutor.getServerVersionNum.

Get a machine-readable server version.

public boolean
getStandardConformingStrings()

Implements org.postgresql.core.QueryExecutor.getStandardConformingStrings.

Returns whether the server treats string-literals according to the SQL standard or if it uses traditional PostgreSQL escaping rules.

public TransactionState
getTransactionState()

Implements org.postgresql.core.QueryExecutor.getTransactionState.

Get the current transaction state of this connection.

public String
public @Nullable SQLWarning
getWarnings()

Implements org.postgresql.core.QueryExecutor.getWarnings.

Retrieve and clear the chain of warnings accumulated on this connection.

protected boolean
public boolean
isClosed()

Implements org.postgresql.core.QueryExecutor.isClosed.

Check if this connection is closed.

public boolean
public boolean
public boolean
protected void
onParameterStatus(String
case-insensitive case-preserving name of parameter to create or update
parameterName
,
String
new value of parameter
parameterStatus
)

Update the parameter status map in response to a new ParameterStatus wire protocol message.

public void
protected abstract void
sendCloseMessage()
Deprecated use getCloseAction() instead

Sends "terminate connection" message to the backend.

public void
sendQueryCancel()

Implements org.postgresql.core.QueryExecutor.sendQueryCancel.

Sends a query cancellation for this connection.

public void
public void
setBackendKeyData(int cancelPid, int cancelKey)

public void
public void
setFlushCacheOnDeallocate(boolean
true if statement cache should be reset when "deallocate/discard" message observed
flushCacheOnDeallocate
)

Implements org.postgresql.core.QueryExecutor.setFlushCacheOnDeallocate.

By default, the connection resets statement cache in case deallocate all/discard all message is observed.

public void
public void
public void
setServerVersion(String serverVersion)

public void
setServerVersionNum(int serverVersionNum)

public void
public void
public boolean
protected boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

autoSaveback to summary
private AutoSave autoSave
cachedQueryCreateActionback to summary
private final CachedQueryCreateAction cachedQueryCreateAction
cancelKeyback to summary
private int cancelKey
cancelPidback to summary
private int cancelPid
cancelSignalTimeoutback to summary
private final int cancelSignalTimeout
closeActionback to summary
protected final QueryExecutorCloseAction closeAction
columnSanitiserDisabledback to summary
private final boolean columnSanitiserDisabled
databaseback to summary
private final String database
escapeSyntaxCallModeback to summary
private final EscapeSyntaxCallMode escapeSyntaxCallMode
flushCacheOnDeallocateback to summary
private boolean flushCacheOnDeallocate
lockback to summary
protected final ResourceLock lock
lockConditionback to summary
protected final Condition lockCondition
LOGGERback to summary
private static final Logger LOGGER
logServerErrorDetailback to summary
protected final boolean logServerErrorDetail
notificationsback to summary
private final ArrayList<PGNotification> notifications
parameterStatusesback to summary
private final TreeMap<String, String> parameterStatuses
pgStreamback to summary
protected final PGStream pgStream
preferQueryModeback to summary
private PreferQueryMode preferQueryMode
quoteReturningIdentifiersback to summary
private final boolean quoteReturningIdentifiers
reWriteBatchedInsertsback to summary
private final boolean reWriteBatchedInserts
serverVersionback to summary
private @MonotonicNonNull String serverVersion
serverVersionNumback to summary
private int serverVersionNum
standardConformingStringsback to summary
private boolean standardConformingStrings
statementCacheback to summary
private final LruCache<Object, CachedQuery> statementCache
transactionStateback to summary
private TransactionState transactionState
userback to summary
private final String user
warningsback to summary
private @Nullable SQLWarning warnings

Constructor Detail

QueryExecutorBaseback to summary
protected QueryExecutorBase(PGStream pgStream, int cancelSignalTimeout, Properties info) throws SQLException
Annotations
@SuppressWarnings:assignment, argument, method.invocation

Method Detail

abortback to summary
public void abort()

Implements org.postgresql.core.QueryExecutor.abort.

Doc from org.postgresql.core.QueryExecutor.abort.

Abort at network level without sending the Terminate message to the backend.

Annotations
@Override
addNotificationback to summary
public void addNotification(PGNotification notification)
addWarningback to summary
public void addWarning(SQLWarning newWarning)
borrowCallableQueryback to summary
public final CachedQuery borrowCallableQuery(String sql) throws SQLException

Implements org.postgresql.core.QueryExecutor.borrowCallableQuery.

Annotations
@Override
borrowQueryback to summary
public final CachedQuery borrowQuery(String sql) throws SQLException

Implements org.postgresql.core.QueryExecutor.borrowQuery.

Annotations
@Override
borrowQueryByKeyback to summary
public CachedQuery borrowQueryByKey(Object key) throws SQLException

Implements org.postgresql.core.QueryExecutor.borrowQueryByKey.

Annotations
@Override
borrowReturningQueryback to summary
public final CachedQuery borrowReturningQuery(String sql, @Nullable String[] columnNames) throws SQLException
Annotations
@Override
closeback to summary
public void close()

Implements org.postgresql.core.QueryExecutor.close.

Doc from org.postgresql.core.QueryExecutor.close.

Close this connection cleanly.

Annotations
@Override
createCloseActionback to summary
protected QueryExecutorCloseAction createCloseAction()
createQueryback to summary
public final CachedQuery createQuery(String sql, boolean escapeProcessing, boolean isParameterized, @Nullable String... columnNames) throws SQLException
Annotations
@Override
createQueryByKeyback to summary
public CachedQuery createQueryByKey(Object key) throws SQLException

Implements org.postgresql.core.QueryExecutor.createQueryByKey.

Annotations
@Override
createQueryKeyback to summary
public final Object createQueryKey(String sql, boolean escapeProcessing, boolean isParameterized, @Nullable String... columnNames)
Annotations
@Override
getAutoSaveback to summary
public AutoSave getAutoSave()

Implements org.postgresql.core.QueryExecutor.getAutoSave.

Annotations
@Override
getBackendPIDback to summary
public int getBackendPID()

Implements org.postgresql.core.QueryExecutor.getBackendPID.

Doc from org.postgresql.core.QueryExecutor.getBackendPID.

Return the process ID (PID) of the backend server process handling this connection.

Returns:int

process ID (PID) of the backend server process handling this connection

Annotations
@Override
getCloseActionback to summary
public Closeable getCloseAction()

Implements org.postgresql.core.QueryExecutor.getCloseAction.

Doc from org.postgresql.core.QueryExecutor.getCloseAction.

Returns an action that would close the connection cleanly. The returned object should refer only the minimum subset of objects required for proper resource cleanup. For instance, it should better not hold a strong reference to QueryExecutor.

Returns:Closeable

action that would close the connection cleanly.

Annotations
@Override
getDatabaseback to summary
public String getDatabase()

Implements org.postgresql.core.QueryExecutor.getDatabase.

Returns:String

Doc from org.postgresql.core.QueryExecutor.getDatabase.

the database this connection is connected to.

Annotations
@Override
getEncodingback to summary
public Encoding getEncoding()

Implements org.postgresql.core.QueryExecutor.getEncoding.

Returns:Encoding

Doc from org.postgresql.core.QueryExecutor.getEncoding.

the current encoding in use by this connection

Annotations
@Override
getEscapeSyntaxCallModeback to summary
public EscapeSyntaxCallMode getEscapeSyntaxCallMode()

Implements org.postgresql.core.QueryExecutor.getEscapeSyntaxCallMode.

Annotations
@Override
getHostSpecback to summary
public HostSpec getHostSpec()

Implements org.postgresql.core.QueryExecutor.getHostSpec.

Returns:HostSpec

Doc from org.postgresql.core.QueryExecutor.getHostSpec.

the host and port this connection is connected to.

Annotations
@Override
getNetworkTimeoutback to summary
public int getNetworkTimeout() throws IOException

Implements org.postgresql.core.QueryExecutor.getNetworkTimeout.

Annotations
@Override
getNotificationsback to summary
public PGNotification[] getNotifications() throws SQLException

Implements org.postgresql.core.QueryExecutor.getNotifications.

Doc from org.postgresql.core.QueryExecutor.getNotifications.

Retrieve and clear the set of asynchronous notifications pending on this connection.

Returns:PGNotification[]

an array of notifications; if there are no notifications, an empty array is returned.

Annotations
@Override
Exceptions
SQLException:
if and error occurs while fetching notifications
getParameterStatusback to summary
public final @Nullable String getParameterStatus(String parameterName)

Implements org.postgresql.core.QueryExecutor.getParameterStatus.

Annotations
@Override
getParameterStatusesback to summary
public final Map<String, String> getParameterStatuses()

Implements org.postgresql.core.QueryExecutor.getParameterStatuses.

Annotations
@Override
getPreferQueryModeback to summary
public PreferQueryMode getPreferQueryMode()

Implements org.postgresql.core.QueryExecutor.getPreferQueryMode.

Annotations
@Override
getQuoteReturningIdentifiersback to summary
public boolean getQuoteReturningIdentifiers()

Implements org.postgresql.core.QueryExecutor.getQuoteReturningIdentifiers.

Returns:boolean

Doc from org.postgresql.core.QueryExecutor.getQuoteReturningIdentifiers.

true if we are going to quote identifier provided in the returning array default is true

Annotations
@Override
getServerVersionback to summary
public String getServerVersion()

Implements org.postgresql.core.QueryExecutor.getServerVersion.

Doc from org.postgresql.core.QueryExecutor.getServerVersion.

Return the server version from the server_version GUC.

Note that there's no requirement for this to be numeric or of the form x.y.z. PostgreSQL development releases usually have the format x.ydevel e.g. 9.4devel; betas usually x.ybetan e.g. 9.4beta1. The --with-extra-version configure option may add an arbitrary string to this.

Don't use this string for logic, only use it when displaying the server version to the user. Prefer getServerVersionNum() for all logic purposes.

Returns:String

the server version string from the server_version GUC

Annotations
@Override
getServerVersionNumback to summary
public int getServerVersionNum()

Implements org.postgresql.core.QueryExecutor.getServerVersionNum.

Doc from org.postgresql.core.QueryExecutor.getServerVersionNum.

Get a machine-readable server version.

This returns the value of the server_version_num GUC. If no such GUC exists, it falls back on attempting to parse the text server version for the major version. If there's no minor version (e.g. a devel or beta release) then the minor version is set to zero. If the version could not be parsed, zero is returned.

Returns:int

the server version in numeric XXYYZZ form, eg 090401, from server_version_num

Annotations
@Override
getStandardConformingStringsback to summary
public boolean getStandardConformingStrings()

Implements org.postgresql.core.QueryExecutor.getStandardConformingStrings.

Doc from org.postgresql.core.QueryExecutor.getStandardConformingStrings.

Returns whether the server treats string-literals according to the SQL standard or if it uses traditional PostgreSQL escaping rules. Versions up to 8.1 always treated backslashes as escape characters in string-literals. Since 8.2, this depends on the value of the standard_conforming_strings server variable.

Returns:boolean

true if the server treats string literals according to the SQL standard

Annotations
@Override
getTransactionStateback to summary
public TransactionState getTransactionState()

Implements org.postgresql.core.QueryExecutor.getTransactionState.

Doc from org.postgresql.core.QueryExecutor.getTransactionState.

Get the current transaction state of this connection.

Returns:TransactionState

a ProtocolConnection.TRANSACTION_* constant.

Annotations
@Override
getUserback to summary
public String getUser()

Implements org.postgresql.core.QueryExecutor.getUser.

Returns:String

Doc from org.postgresql.core.QueryExecutor.getUser.

the user this connection authenticated as.

Annotations
@Override
getWarningsback to summary
public @Nullable SQLWarning getWarnings()

Implements org.postgresql.core.QueryExecutor.getWarnings.

Doc from org.postgresql.core.QueryExecutor.getWarnings.

Retrieve and clear the chain of warnings accumulated on this connection.

Returns:@Nullable SQLWarning

the first SQLWarning in the chain; subsequent warnings can be found via SQLWarning.getNextWarning().

Annotations
@Override
hasNotificationsback to summary
protected boolean hasNotifications()
isClosedback to summary
public boolean isClosed()

Implements org.postgresql.core.QueryExecutor.isClosed.

Doc from org.postgresql.core.QueryExecutor.isClosed.

Check if this connection is closed.

Returns:boolean

true iff the connection is closed.

Annotations
@Override
isColumnSanitiserDisabledback to summary
public boolean isColumnSanitiserDisabled()

Implements org.postgresql.core.QueryExecutor.isColumnSanitiserDisabled.

Annotations
@Override
isFlushCacheOnDeallocateback to summary
public boolean isFlushCacheOnDeallocate()
isReWriteBatchedInsertsEnabledback to summary
public boolean isReWriteBatchedInsertsEnabled()

Implements org.postgresql.core.QueryExecutor.isReWriteBatchedInsertsEnabled.

Annotations
@Override
onParameterStatusback to summary
protected void onParameterStatus(String parameterName, String parameterStatus)

Update the parameter status map in response to a new ParameterStatus wire protocol message.

The server sends ParameterStatus messages when GUC_REPORT settings are initially assigned and whenever they change.

A future version may invoke a client-defined listener class at this point, so this should be the only access path.

Keys are case-insensitive and case-preserving.

The server doesn't provide a way to report deletion of a reportable parameter so we don't expose one here.

Parameters
parameterName:String

case-insensitive case-preserving name of parameter to create or update

parameterStatus:String

new value of parameter

See Also
org.postgresql.PGConnection#getParameterStatuses, org.postgresql.PGConnection#getParameterStatus
releaseQueryback to summary
public void releaseQuery(CachedQuery cachedQuery)

Implements org.postgresql.core.QueryExecutor.releaseQuery.

Annotations
@Override
sendCloseMessageback to summary
protected abstract void sendCloseMessage() throws IOException

Deprecated

use getCloseAction() instead

Sends "terminate connection" message to the backend.

Annotations
@Deprecated
Exceptions
IOException:
in case connection termination fails
sendQueryCancelback to summary
public void sendQueryCancel() throws SQLException

Implements org.postgresql.core.QueryExecutor.sendQueryCancel.

Doc from org.postgresql.core.QueryExecutor.sendQueryCancel.

Sends a query cancellation for this connection.

Annotations
@Override
Exceptions
SQLException:
if something goes wrong.
setAutoSaveback to summary
public void setAutoSave(AutoSave autoSave)

Implements org.postgresql.core.QueryExecutor.setAutoSave.

Annotations
@Override
setBackendKeyDataback to summary
public void setBackendKeyData(int cancelPid, int cancelKey)
setEncodingback to summary
public void setEncoding(Encoding encoding) throws IOException
setFlushCacheOnDeallocateback to summary
public void setFlushCacheOnDeallocate(boolean flushCacheOnDeallocate)

Implements org.postgresql.core.QueryExecutor.setFlushCacheOnDeallocate.

Doc from org.postgresql.core.QueryExecutor.setFlushCacheOnDeallocate.

By default, the connection resets statement cache in case deallocate all/discard all message is observed. This API allows to disable that feature for testing purposes.

Parameters
flushCacheOnDeallocate:boolean

true if statement cache should be reset when "deallocate/discard" message observed

Annotations
@Override
setNetworkTimeoutback to summary
public void setNetworkTimeout(int milliseconds) throws IOException

Implements org.postgresql.core.QueryExecutor.setNetworkTimeout.

Annotations
@Override
setPreferQueryModeback to summary
public void setPreferQueryMode(PreferQueryMode mode)

Implements org.postgresql.core.QueryExecutor.setPreferQueryMode.

setServerVersionback to summary
public void setServerVersion(String serverVersion)
setServerVersionNumback to summary
public void setServerVersionNum(int serverVersionNum)
setStandardConformingStringsback to summary
public void setStandardConformingStrings(boolean value)
setTransactionStateback to summary
public void setTransactionState(TransactionState state)
willHealOnRetryback to summary
public boolean willHealOnRetry(SQLException e)

Implements org.postgresql.core.QueryExecutor.willHealOnRetry.

Annotations
@Override
willHealViaReparseback to summary
protected boolean willHealViaReparse(SQLException e)