public abstract class QueryExecutorBase extends Object implements QueryExecutor
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
datashareEnabled |
protected boolean |
enableMultiSqlSupport |
protected boolean |
enableStatementCache |
protected boolean |
isCrossDatasharingEnabled |
protected RedshiftLogger |
logger |
protected boolean |
logServerErrorDetail |
protected RedshiftStream |
pgStream |
protected Properties |
properties |
protected int |
serverProtocolVersion |
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| Modifier | Constructor and Description |
|---|---|
protected |
QueryExecutorBase(RedshiftStream pgStream,
String user,
String database,
int cancelSignalTimeout,
Properties info,
RedshiftLogger logger) |
| Modifier and Type | Method and Description |
|---|---|
void |
abort()
Abort at network level without sending the Terminate message to the backend.
|
void |
addNotification(RedshiftNotification notification) |
void |
addWarning(SQLWarning newWarning) |
CachedQuery |
borrowCallableQuery(String sql) |
CachedQuery |
borrowQuery(String sql) |
CachedQuery |
borrowQueryByKey(Object key) |
CachedQuery |
borrowReturningQuery(String sql,
String[] columnNames) |
void |
close()
Close this connection cleanly.
|
void |
closeRingBufferThread(RedshiftRowsBlockingQueue<Tuple> queueRows,
Thread ringBufferThread)
Close the last active ring buffer thread.
|
void |
closeStatementAndPortal()
Close the statement and portal when statement get closed.
|
CachedQuery |
createQuery(String sql,
boolean escapeProcessing,
boolean isParameterized,
String... columnNames) |
CachedQuery |
createQueryByKey(Object key) |
Object |
createQueryKey(String sql,
boolean escapeProcessing,
boolean isParameterized,
String... columnNames) |
AutoSave |
getAutoSave() |
int |
getBackendPID()
Return the process ID (PID) of the backend server process handling this connection.
|
String |
getDatabase() |
Encoding |
getEncoding() |
EscapeSyntaxCallMode |
getEscapeSyntaxCallMode() |
HostSpec |
getHostSpec() |
int |
getNetworkTimeout() |
RedshiftNotification[] |
getNotifications()
Retrieve and clear the set of asynchronous notifications pending on this connection.
|
String |
getParameterStatus(String parameterName) |
Map<String,String> |
getParameterStatuses() |
PreferQueryMode |
getPreferQueryMode() |
int |
getServerProtocolVersion()
Redshift supports different versions to accomodate
new request for optimization for better performance.
|
String |
getServerVersion()
Return the server version from the server_version GUC.
|
int |
getServerVersionNum()
Get a machine-readable server version.
|
boolean |
getStandardConformingStrings()
Returns whether the server treats string-literals according to the SQL standard or if it uses
traditional Redshift escaping rules.
|
TransactionState |
getTransactionState()
Get the current transaction state of this connection.
|
String |
getUser() |
SQLWarning |
getWarnings()
Retrieve and clear the chain of warnings accumulated on this connection.
|
protected boolean |
hasNotifications() |
boolean |
isClosed()
Check if this connection is closed.
|
boolean |
isColumnSanitiserDisabled() |
boolean |
isCrossDatasharingEnabled()
Get the server capability for cross-datashare database query support.
|
boolean |
isDatashareEnabled()
Get the server capability for datashare database query support.
|
boolean |
isFlushCacheOnDeallocate() |
boolean |
isMultiSqlSupport()
Get multiple SQL supports.
|
boolean |
isRaiseExceptionOnSilentRollback() |
boolean |
isReWriteBatchedInsertsEnabled() |
boolean |
isRingBufferThreadRunning()
Check for a running ring buffer thread.
|
protected void |
onParameterStatus(String parameterName,
String parameterStatus)
Update the parameter status map in response to a new ParameterStatus
wire protocol message.
|
void |
releaseQuery(CachedQuery cachedQuery) |
protected abstract void |
sendCloseMessage() |
void |
sendQueryCancel()
Sends a query cancellation for this connection.
|
void |
setAutoSave(AutoSave autoSave) |
void |
setBackendKeyData(int cancelPid,
int cancelKey) |
void |
setCrossDatasharingEnabled(boolean isCrossDatasharingEnabled) |
void |
setDatashareEnabled(boolean datashareEnabled) |
void |
setEncoding(Encoding encoding) |
void |
setFlushCacheOnDeallocate(boolean flushCacheOnDeallocate)
By default, the connection resets statement cache in case deallocate all/discard all
message is observed.
|
void |
setNetworkTimeout(int milliseconds) |
void |
setRaiseExceptionOnSilentRollback(boolean raiseExceptionOnSilentRollback) |
protected void |
setServerProtocolVersion(String serverProtocolVersion) |
void |
setServerVersion(String serverVersion) |
void |
setServerVersionNum(int serverVersionNum) |
void |
setStandardConformingStrings(boolean value) |
void |
setTransactionState(TransactionState state) |
boolean |
willHealOnRetry(SQLException e) |
protected boolean |
willHealViaReparse(SQLException e) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreateFastpathParameters, createSimpleQuery, execute, execute, fastpathCall, fetch, getApplicationName, getIntegerDateTimes, getProtocolVersion, getReplicationProtocol, getTimeZone, processNotifies, processNotifies, setBinaryReceiveOids, setBinarySendOids, startCopy, waitForRingBufferThreadToFinish, wrapuseBinaryForReceive, useBinaryForSendprotected RedshiftLogger logger
protected final RedshiftStream pgStream
protected final boolean logServerErrorDetail
protected boolean enableStatementCache
protected int serverProtocolVersion
protected boolean datashareEnabled
protected boolean enableMultiSqlSupport
protected boolean isCrossDatasharingEnabled
protected Properties properties
protected QueryExecutorBase(RedshiftStream pgStream, String user, String database, int cancelSignalTimeout, Properties info, RedshiftLogger logger) throws SQLException
SQLExceptionprotected abstract void sendCloseMessage()
throws IOException
IOExceptionpublic void setNetworkTimeout(int milliseconds)
throws IOException
setNetworkTimeout in interface QueryExecutorIOExceptionpublic int getNetworkTimeout()
throws IOException
getNetworkTimeout in interface QueryExecutorIOExceptionpublic HostSpec getHostSpec()
getHostSpec in interface QueryExecutorpublic String getUser()
getUser in interface QueryExecutorpublic String getDatabase()
getDatabase in interface QueryExecutorpublic void setBackendKeyData(int cancelPid,
int cancelKey)
public int getBackendPID()
QueryExecutorgetBackendPID in interface QueryExecutorpublic boolean isCrossDatasharingEnabled()
QueryExecutorisCrossDatasharingEnabled in interface QueryExecutorpublic void abort()
QueryExecutorabort in interface QueryExecutorpublic void close()
QueryExecutorclose in interface QueryExecutorpublic boolean isClosed()
QueryExecutorisClosed in interface QueryExecutorpublic void sendQueryCancel()
throws SQLException
QueryExecutorsendQueryCancel in interface QueryExecutorSQLException - if something goes wrong.public void addWarning(SQLWarning newWarning)
public void setCrossDatasharingEnabled(boolean isCrossDatasharingEnabled)
public void addNotification(RedshiftNotification notification)
public RedshiftNotification[] getNotifications() throws SQLException
QueryExecutorgetNotifications in interface QueryExecutorSQLException - if and error occurs while fetching notificationspublic SQLWarning getWarnings()
QueryExecutorgetWarnings in interface QueryExecutorpublic String getServerVersion()
QueryExecutorReturn 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. Redshift 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.
getServerVersion in interface QueryExecutorpublic int getServerProtocolVersion()
QueryExecutorgetServerProtocolVersion in interface QueryExecutorpublic boolean isDatashareEnabled()
QueryExecutorisDatashareEnabled in interface QueryExecutorpublic int getServerVersionNum()
QueryExecutorGet 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.
getServerVersionNum in interface QueryExecutorpublic void setServerVersion(String serverVersion)
protected void setServerProtocolVersion(String serverProtocolVersion)
public void setDatashareEnabled(boolean datashareEnabled)
public void setServerVersionNum(int serverVersionNum)
public void setTransactionState(TransactionState state)
public void setStandardConformingStrings(boolean value)
public boolean getStandardConformingStrings()
QueryExecutorstandard_conforming_strings server variable.getStandardConformingStrings in interface QueryExecutorpublic TransactionState getTransactionState()
QueryExecutorgetTransactionState in interface QueryExecutorpublic void setEncoding(Encoding encoding) throws IOException
IOExceptionpublic Encoding getEncoding()
getEncoding in interface QueryExecutorpublic boolean isReWriteBatchedInsertsEnabled()
isReWriteBatchedInsertsEnabled in interface QueryExecutorpublic boolean isMultiSqlSupport()
QueryExecutorisMultiSqlSupport in interface QueryExecutorpublic final CachedQuery borrowQuery(String sql) throws SQLException
borrowQuery in interface QueryExecutorSQLExceptionpublic final CachedQuery borrowCallableQuery(String sql) throws SQLException
borrowCallableQuery in interface QueryExecutorSQLExceptionpublic final CachedQuery borrowReturningQuery(String sql, String[] columnNames) throws SQLException
borrowReturningQuery in interface QueryExecutorSQLExceptionpublic CachedQuery borrowQueryByKey(Object key) throws SQLException
borrowQueryByKey in interface QueryExecutorSQLExceptionpublic void releaseQuery(CachedQuery cachedQuery)
releaseQuery in interface QueryExecutorpublic final Object createQueryKey(String sql, boolean escapeProcessing, boolean isParameterized, String... columnNames)
createQueryKey in interface QueryExecutorpublic CachedQuery createQueryByKey(Object key) throws SQLException
createQueryByKey in interface QueryExecutorSQLExceptionpublic final CachedQuery createQuery(String sql, boolean escapeProcessing, boolean isParameterized, String... columnNames) throws SQLException
createQuery in interface QueryExecutorSQLExceptionpublic boolean isColumnSanitiserDisabled()
isColumnSanitiserDisabled in interface QueryExecutorpublic EscapeSyntaxCallMode getEscapeSyntaxCallMode()
getEscapeSyntaxCallMode in interface QueryExecutorpublic PreferQueryMode getPreferQueryMode()
getPreferQueryMode in interface QueryExecutorpublic AutoSave getAutoSave()
getAutoSave in interface QueryExecutorpublic void setAutoSave(AutoSave autoSave)
setAutoSave in interface QueryExecutorprotected boolean willHealViaReparse(SQLException e)
public boolean willHealOnRetry(SQLException e)
willHealOnRetry in interface QueryExecutorpublic boolean isFlushCacheOnDeallocate()
public void setFlushCacheOnDeallocate(boolean flushCacheOnDeallocate)
QueryExecutorsetFlushCacheOnDeallocate in interface QueryExecutorflushCacheOnDeallocate - true if statement cache should be reset when "deallocate/discard" message observedpublic boolean isRaiseExceptionOnSilentRollback()
isRaiseExceptionOnSilentRollback in interface QueryExecutorpublic void setRaiseExceptionOnSilentRollback(boolean raiseExceptionOnSilentRollback)
setRaiseExceptionOnSilentRollback in interface QueryExecutorprotected boolean hasNotifications()
public final Map<String,String> getParameterStatuses()
getParameterStatuses in interface QueryExecutorpublic final String getParameterStatus(String parameterName)
getParameterStatus in interface QueryExecutorprotected void onParameterStatus(String parameterName, String parameterStatus)
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.
parameterName - case-insensitive case-preserving name of parameter to create or updateparameterStatus - new value of parameterRedshiftConnection.getParameterStatuses(),
RedshiftConnection.getParameterStatus(java.lang.String)public void closeRingBufferThread(RedshiftRowsBlockingQueue<Tuple> queueRows, Thread ringBufferThread)
closeRingBufferThread in interface QueryExecutorqueueRows - the blocking queue rowsringBufferThread - the thread fetching rows in the blocking queue.public boolean isRingBufferThreadRunning()
isRingBufferThreadRunning in interface QueryExecutorpublic void closeStatementAndPortal()
QueryExecutorcloseStatementAndPortal in interface QueryExecutorCopyright © 2024 Amazon.com Inc.. All rights reserved.