Package com.mysql.cj
Class AbstractQuery
java.lang.Object
com.mysql.cj.AbstractQuery
- All Implemented Interfaces:
Query
- Direct Known Subclasses:
AbstractPreparedQuery,SimpleQuery
public abstract class AbstractQuery extends java.lang.Object implements Query
-
Nested Class Summary
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<java.lang.Object>batchedArgsHolds batched commandsprotected java.lang.ObjectcancelTimeoutMutexMutex to prevent race between returning query results and noticing that query has been timed-out or cancelled.protected java.lang.StringcharEncodingThe character encoding to use (if available)protected booleanclearWarningsCalledHas clearWarnings() been called?protected java.lang.StringcurrentDbThe database in useprotected intfetchSizeThe number of rows to fetch at a time (currently ignored)protected RuntimeProperty<java.lang.Integer>maxAllowedPacketprotected Resultset.TyperesultSetTypeThe type of this result set (scroll sensitive or in-sensitive)NativeSessionsessionprotected java.util.concurrent.atomic.AtomicBooleanstatementExecutingCurrently executing a statement?protected intstatementIdUsed to identify this statement when profiling.protected inttimeoutInMillisThe timeout for a query -
Constructor Summary
Constructors Constructor Description AbstractQuery(NativeSession sess) -
Method Summary
Modifier and Type Method Description voidaddBatch(java.lang.Object batch)voidcheckCancelTimeout()voidclearBatchedArgs()voidcloseQuery()java.util.List<java.lang.Object>getBatchedArgs()Get the batched args as added by the addBatch method(s).java.lang.ObjectgetCancelTimeoutMutex()java.lang.StringgetCurrentDatabase()longgetExecuteTime()Returns the elapsed time for the server to execute the query.intgetId()Returns the query id used when profilingintgetResultFetchSize()<T extends Resultset, M extends Message>
ProtocolEntityFactory<T,M>getResultSetFactory()Resultset.TypegetResultType()NativeSessiongetSession()java.util.concurrent.atomic.AtomicBooleangetStatementExecuting()intgetTimeoutInMillis()booleanisClearWarningsCalled()voidresetCancelledState()voidsetCancelStatus(Query.CancelStatus cs)voidsetClearWarningsCalled(boolean clearWarningsCalled)voidsetCurrentDatabase(java.lang.String currentDb)voidsetExecuteTime(long executeTime)voidsetResultFetchSize(int fetchSize)voidsetResultType(Resultset.Type resultSetType)voidsetTimeoutInMillis(int timeoutInMillis)CancelQueryTaskstartQueryTimer(Query stmtToCancel, int timeout)voidstatementBegins()voidstopQueryTimer(CancelQueryTask timeoutTask, boolean rethrowCancelReason, boolean checkCancelTimeout)
-
Field Details
-
session
-
statementId
protected int statementIdUsed to identify this statement when profiling. -
maxAllowedPacket
-
charEncoding
protected java.lang.String charEncodingThe character encoding to use (if available) -
cancelTimeoutMutex
protected java.lang.Object cancelTimeoutMutexMutex to prevent race between returning query results and noticing that query has been timed-out or cancelled. -
timeoutInMillis
protected int timeoutInMillisThe timeout for a query -
batchedArgs
protected java.util.List<java.lang.Object> batchedArgsHolds batched commands -
resultSetType
The type of this result set (scroll sensitive or in-sensitive) -
fetchSize
protected int fetchSizeThe number of rows to fetch at a time (currently ignored) -
statementExecuting
protected final java.util.concurrent.atomic.AtomicBoolean statementExecutingCurrently executing a statement? -
currentDb
protected java.lang.String currentDbThe database in use -
clearWarningsCalled
protected boolean clearWarningsCalledHas clearWarnings() been called?
-
-
Constructor Details
-
Method Details
-
getId
public int getId()Description copied from interface:QueryReturns the query id used when profiling -
setCancelStatus
- Specified by:
setCancelStatusin interfaceQuery
-
getExecuteTime
public long getExecuteTime()Description copied from interface:QueryReturns the elapsed time for the server to execute the query.- Specified by:
getExecuteTimein interfaceQuery- Returns:
- the time it took for the server to execute the query.
-
setExecuteTime
public void setExecuteTime(long executeTime)- Specified by:
setExecuteTimein interfaceQuery
-
checkCancelTimeout
public void checkCancelTimeout()- Specified by:
checkCancelTimeoutin interfaceQuery
-
resetCancelledState
public void resetCancelledState()- Specified by:
resetCancelledStatein interfaceQuery
-
getResultSetFactory
- Specified by:
getResultSetFactoryin interfaceQuery
-
getSession
- Specified by:
getSessionin interfaceQuery
-
getCancelTimeoutMutex
public java.lang.Object getCancelTimeoutMutex()- Specified by:
getCancelTimeoutMutexin interfaceQuery
-
closeQuery
public void closeQuery()- Specified by:
closeQueryin interfaceQuery
-
addBatch
public void addBatch(java.lang.Object batch) -
getBatchedArgs
public java.util.List<java.lang.Object> getBatchedArgs()Description copied from interface:QueryGet the batched args as added by the addBatch method(s). The list is unmodifiable and might contain any combination of String, ClientPreparedQueryBindings, or ServerPreparedQueryBindings depending on how the parameters were batched.- Specified by:
getBatchedArgsin interfaceQuery- Returns:
- an unmodifiable List of batched args
-
clearBatchedArgs
public void clearBatchedArgs()- Specified by:
clearBatchedArgsin interfaceQuery
-
getResultFetchSize
public int getResultFetchSize()- Specified by:
getResultFetchSizein interfaceQuery
-
setResultFetchSize
public void setResultFetchSize(int fetchSize)- Specified by:
setResultFetchSizein interfaceQuery
-
getResultType
- Specified by:
getResultTypein interfaceQuery
-
setResultType
- Specified by:
setResultTypein interfaceQuery
-
getTimeoutInMillis
public int getTimeoutInMillis()- Specified by:
getTimeoutInMillisin interfaceQuery
-
setTimeoutInMillis
public void setTimeoutInMillis(int timeoutInMillis)- Specified by:
setTimeoutInMillisin interfaceQuery
-
startQueryTimer
- Specified by:
startQueryTimerin interfaceQuery
-
stopQueryTimer
public void stopQueryTimer(CancelQueryTask timeoutTask, boolean rethrowCancelReason, boolean checkCancelTimeout)- Specified by:
stopQueryTimerin interfaceQuery
-
getStatementExecuting
public java.util.concurrent.atomic.AtomicBoolean getStatementExecuting()- Specified by:
getStatementExecutingin interfaceQuery
-
getCurrentDatabase
public java.lang.String getCurrentDatabase()- Specified by:
getCurrentDatabasein interfaceQuery
-
setCurrentDatabase
public void setCurrentDatabase(java.lang.String currentDb)- Specified by:
setCurrentDatabasein interfaceQuery
-
isClearWarningsCalled
public boolean isClearWarningsCalled()- Specified by:
isClearWarningsCalledin interfaceQuery
-
setClearWarningsCalled
public void setClearWarningsCalled(boolean clearWarningsCalled)- Specified by:
setClearWarningsCalledin interfaceQuery
-
statementBegins
public void statementBegins()- Specified by:
statementBeginsin interfaceQuery
-