Class QueryExecutorImpl
- All Implemented Interfaces:
QueryExecutor, TypeTransferModeRegistry
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AdaptiveFetchCacheprivate final booleanprivate Stringapplication_name connection property.private final SimpleQueryprivate final SimpleQueryprivate final SimpleQueryprivate final booleanprivate final CommandCompleteParserCommandComplete(B)messages are quite common, so we reuse instance to parse thoseprivate shortprivate final SimpleQueryprivate intThe estimated server response size since we last consumed the input stream from the server, in bytes.private booleanTrue if server uses integers for date and time fields.private StringThis caches the latest observedset search_pathquery so the reset of prepared statement cache can be skipped if using repeated calls for the sameset search_pathvalue.private ObjectSupplement to synchronization of public methods on current QueryExecutor.private static final Loggerprivate static final intprivate longprivate static final Field[]private static final intprivate final ReferenceQueue<Portal> private final HashMap<PhantomReference<Portal>, String> private final ReferenceQueue<SimpleQuery> private final HashMap<PhantomReference<SimpleQuery>, String> private final Deque<SimpleQuery> private final Deque<DescribeRequest> private final Deque<ExecuteRequest> private final Deque<SimpleQuery> (package private) AtomicBooleanprivate final SimpleQueryprivate final ReplicationProtocolprivate final SimpleQueryprivate final SimpleQueryThis is a fake query object so processResults can distinguish "ReadyForQuery" messages from Sync messages vs from simple execute (aka 'Q').private TimeZoneTimeZone of the current connection (TimeZone backend parameter).private SQLExceptionThe exception that caused the last transaction to fail.private static final Portalprivate final IntSetBit set that has a bit set for each oid which should be received using binary format.private final IntSetBit set that has a bit set for each oid which should be sent using binary format.Fields inherited from class QueryExecutorBase
closeAction, lock, lockCondition, logServerErrorDetail, pgStream, protocolVersionFields inherited from interface QueryExecutor
MAX_SAVE_POINTS, QUERY_BOTH_ROWS_AND_STATUS, QUERY_DESCRIBE_ONLY, QUERY_DISALLOW_BATCHING, QUERY_EXECUTE_AS_SIMPLE, QUERY_FORCE_DESCRIBE_PORTAL, QUERY_FORWARD_CURSOR, QUERY_NO_BINARY_TRANSFER, QUERY_NO_METADATA, QUERY_NO_RESULTS, QUERY_ONESHOT, QUERY_READ_ONLY_HINT, QUERY_SUPPRESS_BEGIN -
Constructor Summary
ConstructorsConstructorDescriptionQueryExecutorImpl(PGStream pgStream, int cancelSignalTimeout, Properties info) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBinaryReceiveOid(int oid) Adds a single oid that should be received using binary encoding.voidaddBinarySendOid(int oid) Adds a single oid that should be sent using binary encoding.voidaddQueryToAdaptiveFetchCache(boolean adaptiveFetch, ResultCursor cursor) Add query to adaptive fetch cache inside QueryExecutor.voidFinishes a copy operation and unlocks connection discarding any exchanged data.createFastpathParameters(int count) Create a new ParameterList implementation suitable for invoking a fastpath function viaQueryExecutor.fastpathCall(int, ParameterList, boolean).createSimpleQuery(String sql) Create an unparameterized Query object suitable for execution by this QueryExecutor.voidlongFinishes writing to copy and unlocks connection.voidexecute(Query[] queries, ParameterList[] parameterLists, BatchResultHandler batchHandler, int maxRows, int fetchSize, int flags) Execute several Query, passing results to a provided ResultHandler.voidexecute(Query[] queries, ParameterList[] parameterLists, BatchResultHandler batchHandler, int maxRows, int fetchSize, int flags, boolean adaptiveFetch) Execute several Query with adaptive fetch, passing results to a provided ResultHandler.voidexecute(Query query, ParameterList parameters, ResultHandler handler, int maxRows, int fetchSize, int flags) Execute a Query, passing results to a provided ResultHandler.voidexecute(Query query, ParameterList parameters, ResultHandler handler, int maxRows, int fetchSize, int flags, boolean adaptiveFetch) Execute a Query with adaptive fetch, passing results to a provided ResultHandler.byte[]fastpathCall(int fnid, ParameterList parameters, boolean suppressBegin) Invoke a backend function via the fastpath interface.voidfetch(ResultCursor cursor, ResultHandler handler, int fetchSize, boolean adaptiveFetch) Fetch additional rows from a cursor.voidprivate voidflushIfDeadlockRisk(Query query, boolean disallowBatching, ResultHandler resultHandler, BatchResultHandler batchHandler, int flags) booleanGet state of adaptive fetch inside QueryExecutor.intgetAdaptiveFetchSize(boolean adaptiveFetch, ResultCursor cursor) Get fetch size computed by adaptive fetch size for given query.Returns application_name connection property.Gets the oids that should be received using binary encoding.Gets the oids that should be sent using binary encoding.booleanReturns true if server uses integer instead of double for binary date and time encodings.Returns backend timezone in java format.private boolean(package private) booleanprivate voidLocks connection and calls initializer for a new CopyOperation Called via startCopy -> processCopyResults.private voidinterpretCommandStatus(String status, ResultHandler handler) private voidObtain lock over this connection for given object, blocking to wait if necessary.(package private) CopyOperationImplprocessCopyResults(CopyOperationImpl op, boolean block) Handles copy sub protocol responses from server.private voidprivate voidvoidPrior to attempting to retrieve notifications, we need to pull any recently received notifications off of the network buffers.voidprocessNotifies(int timeoutMillis) Prior to attempting to retrieve notifications, we need to pull any recently received notifications off of the network buffers.protected voidprocessResults(ResultHandler handler, int flags) protected voidprocessResults(ResultHandler handler, int flags, boolean adaptiveFetch) (package private) voidreadFromCopy(CopyOperationImpl op, boolean block) Wait for a row of data to be received from server on an active copy operation Connection gets unlocked by processCopyResults() at end of operation.voidprivate voidprivate Stringprivate SQLExceptionprivate byte[]private Field[]private SQLWarningvoidprivate voidprivate voidregisterOpenPortal(Portal portal) private voidregisterParsedQuery(SimpleQuery query, String statementName) private voidreleaseSavePoint(boolean autosave) voidremoveBinaryReceiveOid(int oid) Remove given oid from the list of oids for binary receive encoding.voidremoveBinarySendOid(int oid) Remove given oid from the list of oids for binary send encoding.voidremoveQueryFromAdaptiveFetchCache(boolean adaptiveFetch, ResultCursor cursor) Remove query from adaptive fetch cache inside QueryExecutorprivate voidrollbackIfRequired(boolean autosave, SQLException e) private booleansendAutomaticSavepoint(Query query, int flags) private voidsendBind(SimpleQuery query, SimpleParameterList params, Portal portal, boolean noBinaryTransfer) protected voidSends "terminate connection" message to the backend.private voidsendClosePortal(String portalName) private voidsendCloseStatement(String statementName) private voidsendDescribePortal(SimpleQuery query, Portal portal) private voidsendDescribeStatement(SimpleQuery query, SimpleParameterList params, boolean describeOnly) private voidsendExecute(SimpleQuery query, Portal portal, int limit) private voidsendFastpathCall(int fnid, SimpleParameterList params) private voidsendOneQuery(SimpleQuery query, SimpleParameterList params, int maxRows, int fetchSize, int flags) private voidsendParse(SimpleQuery query, SimpleParameterList params, boolean oneShot) private voidsendQuery(Query query, V3ParameterList parameters, int maxRows, int fetchSize, int flags, ResultHandler resultHandler, BatchResultHandler batchHandler, boolean adaptiveFetch) private ResultHandlersendQueryPreamble(ResultHandler delegateHandler, int flags) private voidsendSimpleQuery(SimpleQuery query, SimpleParameterList params) private voidsendSync()voidsetAdaptiveFetch(boolean adaptiveFetch) Set state of adaptive fetch inside QueryExecutor.voidsetApplicationName(String applicationName) voidsetBinaryReceiveOids(Set<Integer> oids) Sets the oids that should be received using binary encoding.voidsetBinarySendOids(Set<Integer> oids) Sets the oids that should be sent using binary encoding.private voidsetIntegerDateTimes(boolean state) private voidsetSocketTimeout(int millis) voidsetTimeZone(TimeZone timeZone) private voidIgnore the response message by reading the message length and skipping over those bytes in the communication stream.Sends given query to BE to start, initialize and lock connection for a CopyOperation.private voidRelease lock on this connection presumably held by given object.private intupdateQueryMode(int flags) private booleanReturns true if the specified field should be retrieved using binary encoding.booleanuseBinaryForReceive(int oid) Returns if given oid should be received in binary format.booleanuseBinaryForSend(int oid) Returns if given oid should be sent in binary format.private voidWait until our lock is released.wrap(List<NativeQuery> queries) Wrap given native query into a ready for execution format.voidwriteToCopy(CopyOperationImpl op, byte[] data, int off, int siz) Sends data during a live COPY IN operation.voidwriteToCopy(CopyOperationImpl op, ByteStreamWriter from) Sends data during a live COPY IN operation.Methods inherited from class QueryExecutorBase
abort, addNotification, addWarning, borrowCallableQuery, borrowQuery, borrowQueryByKey, borrowReturningQuery, close, createCloseAction, createQuery, createQueryByKey, createQueryKey, getAutoSave, getBackendPID, getCloseAction, getDatabase, getEncoding, getEscapeSyntaxCallMode, getHostSpec, getNetworkTimeout, getNotifications, getParameterStatus, getParameterStatuses, getPreferQueryMode, getQuoteReturningIdentifiers, getServerVersion, getServerVersionNum, getStandardConformingStrings, getTransactionState, getUser, getWarnings, hasNotifications, isClosed, isColumnSanitiserDisabled, isFlushCacheOnDeallocate, isReWriteBatchedInsertsEnabled, onParameterStatus, releaseQuery, sendQueryCancel, setAutoSave, setBackendKeyData, setEncoding, setFlushCacheOnDeallocate, setNetworkTimeout, setPreferQueryMode, setServerVersion, setServerVersionNum, setStandardConformingStrings, setTransactionState, willHealOnRetry, willHealViaReparse
-
Field Details
-
LOGGER
-
NO_FIELDS
-
timeZone
TimeZone of the current connection (TimeZone backend parameter). -
applicationName
application_name connection property. -
integerDateTimes
private boolean integerDateTimesTrue if server uses integers for date and time fields. False if server uses double. -
useBinaryReceiveForOids
Bit set that has a bit set for each oid which should be received using binary format. -
useBinarySendForOids
Bit set that has a bit set for each oid which should be sent using binary format. -
sync
This is a fake query object so processResults can distinguish "ReadyForQuery" messages from Sync messages vs from simple execute (aka 'Q'). -
deallocateEpoch
private short deallocateEpoch -
lastSetSearchPathQuery
This caches the latest observedset search_pathquery so the reset of prepared statement cache can be skipped if using repeated calls for the sameset search_pathvalue. -
transactionFailCause
The exception that caused the last transaction to fail. -
replicationProtocol
-
commandCompleteParser
CommandComplete(B)messages are quite common, so we reuse instance to parse those -
adaptiveFetchCache
-
lockedFor
Supplement to synchronization of public methods on current QueryExecutor.Necessary for keeping the connection intact between calls to public methods sharing a state such as COPY subprotocol. waitOnLock() must be called at beginning of each connection access point.
Public methods sharing that state must then be synchronized among themselves. Normal method synchronization typically suffices for that.
See notes on related methods as well as currentCopy() below.
-
MAX_BUFFERED_RECV_BYTES
private static final int MAX_BUFFERED_RECV_BYTES- See Also:
-
NODATA_QUERY_RESPONSE_SIZE_BYTES
private static final int NODATA_QUERY_RESPONSE_SIZE_BYTES- See Also:
-
processingCopyResults
AtomicBoolean processingCopyResults -
parsedQueryMap
-
parsedQueryCleanupQueue
-
openPortalMap
-
openPortalCleanupQueue
-
UNNAMED_PORTAL
-
pendingParseQueue
-
pendingBindQueue
-
pendingExecuteQueue
-
pendingDescribeStatementQueue
-
pendingDescribePortalQueue
-
nextUniqueID
private long nextUniqueID -
allowEncodingChanges
private final boolean allowEncodingChanges -
cleanupSavePoints
private final boolean cleanupSavePoints -
estimatedReceiveBufferBytes
private int estimatedReceiveBufferBytesThe estimated server response size since we last consumed the input stream from the server, in bytes.Starts at zero, reset by every Sync message. Mainly used for batches.
Used to avoid deadlocks, see MAX_BUFFERED_RECV_BYTES.
-
beginTransactionQuery
-
beginReadOnlyTransactionQuery
-
emptyQuery
-
autoSaveQuery
-
releaseAutoSave
-
restoreToAutoSave
-
-
Constructor Details
-
QueryExecutorImpl
public QueryExecutorImpl(PGStream pgStream, int cancelSignalTimeout, Properties info) throws SQLException, IOException - Throws:
SQLExceptionIOException
-
-
Method Details
-
getProtocolVersion
- Returns:
- the version of the implementation
-
lock
Obtain lock over this connection for given object, blocking to wait if necessary.- Parameters:
obtainer- object that gets the lock. Normally current thread.- Throws:
PSQLException- when already holding the lock or getting interrupted.
-
unlock
Release lock on this connection presumably held by given object.- Parameters:
holder- object that holds the lock. Normally current thread.- Throws:
PSQLException- when this thread does not hold the lock
-
waitOnLock
Wait until our lock is released. Execution of a single synchronized method can then continue without further ado. Must be called at beginning of each synchronized public method.- Throws:
PSQLException
-
hasLockOn
- Parameters:
holder- object assumed to hold the lock- Returns:
- whether given object actually holds the lock
-
hasLock
- Parameters:
holder- object assumed to hold the lock- Returns:
- whether given object actually holds the lock
-
createSimpleQuery
Description copied from interface:QueryExecutorCreate an unparameterized Query object suitable for execution by this QueryExecutor. The provided query string is not parsed for parameter placeholders ('?' characters), and theQuery.createParameterList()of the returned object will always return an empty ParameterList.- Parameters:
sql- the SQL for the query to create- Returns:
- a new Query object
- Throws:
SQLException- if something goes wrong
-
wrap
Description copied from interface:QueryExecutorWrap given native query into a ready for execution format.- Parameters:
queries- list of queries in native to database syntax- Returns:
- query object ready for execution by this query executor
-
updateQueryMode
private int updateQueryMode(int flags) -
execute
public void execute(Query query, ParameterList parameters, ResultHandler handler, int maxRows, int fetchSize, int flags) throws SQLException Description copied from interface:QueryExecutorExecute a Query, passing results to a provided ResultHandler.- Parameters:
query- the query to execute; must be a query returned from callingQueryExecutor.wrap(List)on this QueryExecutor object.parameters- the parameters for the query. Must be non-nullif the query takes parameters. Must be a parameter object returned byQuery.createParameterList().handler- a ResultHandler responsible for handling results generated by this querymaxRows- the maximum number of rows to retrievefetchSize- if QUERY_FORWARD_CURSOR is set, the preferred number of rows to retrieve before suspendingflags- a combination of QUERY_* flags indicating how to handle the query.- Throws:
SQLException- if query execution fails
-
execute
public void execute(Query query, ParameterList parameters, ResultHandler handler, int maxRows, int fetchSize, int flags, boolean adaptiveFetch) throws SQLException Description copied from interface:QueryExecutorExecute a Query with adaptive fetch, passing results to a provided ResultHandler.- Parameters:
query- the query to execute; must be a query returned from callingQueryExecutor.wrap(List)on this QueryExecutor object.parameters- the parameters for the query. Must be non-nullif the query takes parameters. Must be a parameter object returned byQuery.createParameterList().handler- a ResultHandler responsible for handling results generated by this querymaxRows- the maximum number of rows to retrievefetchSize- if QUERY_FORWARD_CURSOR is set, the preferred number of rows to retrieve before suspendingflags- a combination of QUERY_* flags indicating how to handle the query.adaptiveFetch- state of adaptiveFetch to use during execution- Throws:
SQLException- if query execution fails
-
sendAutomaticSavepoint
- Throws:
IOException
-
releaseSavePoint
- Throws:
SQLException
-
rollbackIfRequired
- Throws:
SQLException
-
execute
public void execute(Query[] queries, ParameterList[] parameterLists, BatchResultHandler batchHandler, int maxRows, int fetchSize, int flags) throws SQLException Description copied from interface:QueryExecutorExecute several Query, passing results to a provided ResultHandler.- Parameters:
queries- the queries to execute; each must be a query returned from callingQueryExecutor.wrap(List)on this QueryExecutor object.parameterLists- the parameter lists for the queries. The parameter lists correspond 1:1 to the queries passed in thequeriesarray. Each must be non-nullif the corresponding query takes parameters, and must be a parameter object returned byQuery.createParameterList()created by the corresponding query.batchHandler- a ResultHandler responsible for handling results generated by this querymaxRows- the maximum number of rows to retrievefetchSize- if QUERY_FORWARD_CURSOR is set, the preferred number of rows to retrieve before suspendingflags- a combination of QUERY_* flags indicating how to handle the query.- Throws:
SQLException- if query execution fails
-
execute
public void execute(Query[] queries, ParameterList[] parameterLists, BatchResultHandler batchHandler, int maxRows, int fetchSize, int flags, boolean adaptiveFetch) throws SQLException Description copied from interface:QueryExecutorExecute several Query with adaptive fetch, passing results to a provided ResultHandler.- Parameters:
queries- the queries to execute; each must be a query returned from callingQueryExecutor.wrap(List)on this QueryExecutor object.parameterLists- the parameter lists for the queries. The parameter lists correspond 1:1 to the queries passed in thequeriesarray. Each must be non-nullif the corresponding query takes parameters, and must be a parameter object returned byQuery.createParameterList()created by the corresponding query.batchHandler- a ResultHandler responsible for handling results generated by this querymaxRows- the maximum number of rows to retrievefetchSize- if QUERY_FORWARD_CURSOR is set, the preferred number of rows to retrieve before suspendingflags- a combination of QUERY_* flags indicating how to handle the query.adaptiveFetch- state of adaptiveFetch to use during execution- Throws:
SQLException- if query execution fails
-
sendQueryPreamble
private ResultHandler sendQueryPreamble(ResultHandler delegateHandler, int flags) throws IOException - Throws:
IOException
-
fastpathCall
public byte[] fastpathCall(int fnid, ParameterList parameters, boolean suppressBegin) throws SQLException Description copied from interface:QueryExecutorInvoke a backend function via the fastpath interface.- Parameters:
fnid- the OID of the backend function to invokeparameters- a ParameterList returned fromQueryExecutor.createFastpathParameters(int)containing the parameters to pass to the backend functionsuppressBegin- if begin should be suppressed- Returns:
- the binary-format result of the fastpath call, or
nullif a void result was returned - Throws:
SQLException- if an error occurs while executing the fastpath call
-
doSubprotocolBegin
- Throws:
SQLException
-
createFastpathParameters
Description copied from interface:QueryExecutorCreate a new ParameterList implementation suitable for invoking a fastpath function viaQueryExecutor.fastpathCall(int, ParameterList, boolean).- Parameters:
count- the number of parameters the fastpath call will take- Returns:
- a ParameterList suitable for passing to
QueryExecutor.fastpathCall(int, ParameterList, boolean).
-
sendFastpathCall
private void sendFastpathCall(int fnid, SimpleParameterList params) throws SQLException, IOException - Throws:
SQLExceptionIOException
-
processNotifies
Description copied from interface:QueryExecutorPrior to attempting to retrieve notifications, we need to pull any recently received notifications off of the network buffers. The notification retrieval in ProtocolConnection cannot do this as it is prone to deadlock, so the higher level caller must be responsible which requires exposing this method.- Throws:
SQLException- if and error occurs while fetching notifications
-
processNotifies
Description copied from interface:QueryExecutorPrior to attempting to retrieve notifications, we need to pull any recently received notifications off of the network buffers. The notification retrieval in ProtocolConnection cannot do this as it is prone to deadlock, so the higher level caller must be responsible which requires exposing this method. This variant supports blocking for the given time in millis.- Parameters:
timeoutMillis- when > 0, block for this time when =0, block forever when < 0, don't block- Throws:
SQLException- if and error occurs while fetching notifications
-
setSocketTimeout
- Throws:
PSQLException
-
receiveFastpathResult
- Throws:
IOExceptionSQLException
-
startCopy
Sends given query to BE to start, initialize and lock connection for a CopyOperation.- Parameters:
sql- COPY FROM STDIN / COPY TO STDOUT statementsuppressBegin- if begin should be suppressed- Returns:
- CopyIn or CopyOut operation object
- Throws:
SQLException- on failure
-
initCopy
Locks connection and calls initializer for a new CopyOperation Called via startCopy -> processCopyResults.- Parameters:
op- an uninitialized CopyOperation- Throws:
SQLException- on locking failureIOException- on database connection failure
-
cancelCopy
Finishes a copy operation and unlocks connection discarding any exchanged data.- Parameters:
op- the copy operation presumably currently holding lock on this connection- Throws:
SQLException- on any additional failure
-
endCopy
Finishes writing to copy and unlocks connection.- Parameters:
op- the copy operation presumably currently holding lock on this connection- Returns:
- number of rows updated for server versions 8.2 or newer
- Throws:
SQLException- on failure
-
writeToCopy
Sends data during a live COPY IN operation. Only unlocks the connection if server suddenly returns CommandComplete, which should not happen- Parameters:
op- the CopyIn operation presumably currently holding lock on this connectiondata- bytes to sendoff- index of first byte to send (usually 0)siz- number of bytes to send (usually data.length)- Throws:
SQLException- on failure
-
writeToCopy
Sends data during a live COPY IN operation. Only unlocks the connection if server suddenly returns CommandComplete, which should not happen- Parameters:
op- the CopyIn operation presumably currently holding lock on this connectionfrom- the source of bytes, e.g. a ByteBufferByteStreamWriter- Throws:
SQLException- on failure
-
flushCopy
- Throws:
SQLException
-
readFromCopy
Wait for a row of data to be received from server on an active copy operation Connection gets unlocked by processCopyResults() at end of operation.- Parameters:
op- the copy operation presumably currently holding lock on this connectionblock- whether to block waiting for input- Throws:
SQLException- on any failure
-
processCopyResults
CopyOperationImpl processCopyResults(CopyOperationImpl op, boolean block) throws SQLException, IOException Handles copy sub protocol responses from server. Unlocks at end of sub protocol, so operations on pgStream or QueryExecutor are not allowed in a method after calling this!- Parameters:
block- whether to block waiting for input- Returns:
- CopyIn when COPY FROM STDIN starts; CopyOut when COPY TO STDOUT starts; null when copy ends; otherwise, the operation given as parameter.
- Throws:
SQLException- in case of misuseIOException- from the underlying connection
-
flushIfDeadlockRisk
private void flushIfDeadlockRisk(Query query, boolean disallowBatching, ResultHandler resultHandler, BatchResultHandler batchHandler, int flags) throws IOException - Throws:
IOException
-
sendQuery
private void sendQuery(Query query, V3ParameterList parameters, int maxRows, int fetchSize, int flags, ResultHandler resultHandler, BatchResultHandler batchHandler, boolean adaptiveFetch) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
sendSync
- Throws:
IOException
-
sendParse
private void sendParse(SimpleQuery query, SimpleParameterList params, boolean oneShot) throws IOException - Throws:
IOException
-
sendBind
private void sendBind(SimpleQuery query, SimpleParameterList params, Portal portal, boolean noBinaryTransfer) throws IOException - Throws:
IOException
-
useBinary
Returns true if the specified field should be retrieved using binary encoding.- Parameters:
field- The field whose Oid type to analyse.- Returns:
- True if
Field.BINARY_FORMATshould be used, false ifField.BINARY_FORMAT.
-
sendDescribePortal
- Throws:
IOException
-
sendDescribeStatement
private void sendDescribeStatement(SimpleQuery query, SimpleParameterList params, boolean describeOnly) throws IOException - Throws:
IOException
-
sendExecute
- Throws:
IOException
-
sendClosePortal
- Throws:
IOException
-
sendCloseStatement
- Throws:
IOException
-
sendOneQuery
private void sendOneQuery(SimpleQuery query, SimpleParameterList params, int maxRows, int fetchSize, int flags) throws IOException - Throws:
IOException
-
sendSimpleQuery
- Throws:
IOException
-
registerParsedQuery
-
processDeadParsedQueries
- Throws:
IOException
-
registerOpenPortal
-
processDeadPortals
- Throws:
IOException
-
processResults
- Throws:
IOException
-
processResults
protected void processResults(ResultHandler handler, int flags, boolean adaptiveFetch) throws IOException - Throws:
IOException
-
skipMessage
Ignore the response message by reading the message length and skipping over those bytes in the communication stream.- Throws:
IOException
-
fetch
public void fetch(ResultCursor cursor, ResultHandler handler, int fetchSize, boolean adaptiveFetch) throws SQLException Description copied from interface:QueryExecutorFetch additional rows from a cursor.- Parameters:
cursor- the cursor to fetch fromhandler- the handler to feed results tofetchSize- the preferred number of rows to retrieve before suspendingadaptiveFetch- state of adaptiveFetch to use during fetching- Throws:
SQLException- if query execution fails
-
getAdaptiveFetchSize
Description copied from interface:QueryExecutorGet fetch size computed by adaptive fetch size for given query.- Parameters:
adaptiveFetch- state of adaptive fetch, which should be used during retrievingcursor- Cursor used by resultSet, containing query, have to be able to cast to Portal class.- Returns:
- fetch size computed by adaptive fetch size for given query passed inside cursor
-
setAdaptiveFetch
public void setAdaptiveFetch(boolean adaptiveFetch) Description copied from interface:QueryExecutorSet state of adaptive fetch inside QueryExecutor.- Parameters:
adaptiveFetch- desired state of adaptive fetch
-
getAdaptiveFetch
public boolean getAdaptiveFetch()Description copied from interface:QueryExecutorGet state of adaptive fetch inside QueryExecutor.- Returns:
- state of adaptive fetch inside QueryExecutor
-
addQueryToAdaptiveFetchCache
Description copied from interface:QueryExecutorAdd query to adaptive fetch cache inside QueryExecutor.- Parameters:
adaptiveFetch- state of adaptive fetch used during adding querycursor- Cursor used by resultSet, containing query, have to be able to cast to Portal class.
-
removeQueryFromAdaptiveFetchCache
Description copied from interface:QueryExecutorRemove query from adaptive fetch cache inside QueryExecutor- Parameters:
adaptiveFetch- state of adaptive fetch used during removing querycursor- Cursor used by resultSet, containing query, have to be able to cast to Portal class.
-
receiveFields
- Throws:
IOException
-
receiveAsyncNotify
- Throws:
IOException
-
receiveErrorResponse
- Throws:
IOException
-
receiveNoticeResponse
- Throws:
IOException
-
receiveCommandStatus
- Throws:
IOException
-
interpretCommandStatus
-
receiveRFQ
- Throws:
IOException
-
sendCloseMessage
Description copied from class:QueryExecutorBaseSends "terminate connection" message to the backend.- Specified by:
sendCloseMessagein classQueryExecutorBase- Throws:
IOException- in case connection termination fails
-
readStartupMessages
- Throws:
IOExceptionSQLException
-
receiveParameterStatus
- Throws:
IOExceptionSQLException
-
setTimeZone
-
getTimeZone
Description copied from interface:QueryExecutorReturns backend timezone in java format.- Returns:
- backend timezone in java format.
-
setApplicationName
-
getApplicationName
Description copied from interface:QueryExecutorReturns application_name connection property.- Returns:
- application_name connection property
-
getReplicationProtocol
- Returns:
- the ReplicationProtocol instance for this connection.
-
addBinaryReceiveOid
public void addBinaryReceiveOid(int oid) Description copied from interface:QueryExecutorAdds a single oid that should be received using binary encoding.- Parameters:
oid- The oid to request with binary encoding.
-
removeBinaryReceiveOid
public void removeBinaryReceiveOid(int oid) Description copied from interface:QueryExecutorRemove given oid from the list of oids for binary receive encoding.Note: the binary receive for the oid can be re-activated later.
- Parameters:
oid- The oid to request with binary encoding.
-
getBinaryReceiveOids
Description copied from interface:QueryExecutorGets the oids that should be received using binary encoding.Note: this returns an unmodifiable set, and its contents might not reflect the current state.
- Returns:
- The oids to request with binary encoding.
-
useBinaryForReceive
public boolean useBinaryForReceive(int oid) Description copied from interface:TypeTransferModeRegistryReturns if given oid should be received in binary format.- Parameters:
oid- type oid- Returns:
- true if given oid should be received in binary format
-
setBinaryReceiveOids
Description copied from interface:QueryExecutorSets the oids that should be received using binary encoding.- Parameters:
oids- The oids to request with binary encoding.
-
addBinarySendOid
public void addBinarySendOid(int oid) Description copied from interface:QueryExecutorAdds a single oid that should be sent using binary encoding.- Parameters:
oid- The oid to send with binary encoding.
-
removeBinarySendOid
public void removeBinarySendOid(int oid) Description copied from interface:QueryExecutorRemove given oid from the list of oids for binary send encoding.Note: the binary send for the oid can be re-activated later.
- Parameters:
oid- The oid to send with binary encoding.
-
getBinarySendOids
Description copied from interface:QueryExecutorGets the oids that should be sent using binary encoding.Note: this returns an unmodifiable set, and its contents might not reflect the current state.
- Returns:
- useBinaryForOids The oids to send with binary encoding.
-
useBinaryForSend
public boolean useBinaryForSend(int oid) Description copied from interface:TypeTransferModeRegistryReturns if given oid should be sent in binary format.- Parameters:
oid- type oid- Returns:
- true if given oid should be sent in binary format
-
setBinarySendOids
Description copied from interface:QueryExecutorSets the oids that should be sent using binary encoding.- Parameters:
oids- The oids to send with binary encoding.
-
setIntegerDateTimes
private void setIntegerDateTimes(boolean state) -
getIntegerDateTimes
public boolean getIntegerDateTimes()Description copied from interface:QueryExecutorReturns true if server uses integer instead of double for binary date and time encodings.- Returns:
- the server integer_datetime setting.
-