Package com.mysql.cj
Class AbstractPreparedQuery<T extends QueryBindings<?>>
java.lang.Object
com.mysql.cj.AbstractQuery
com.mysql.cj.AbstractPreparedQuery<T>
- All Implemented Interfaces:
PreparedQuery<T>,Query
- Direct Known Subclasses:
ClientPreparedQuery,ServerPreparedQuery
public abstract class AbstractPreparedQuery<T extends QueryBindings<?>> extends AbstractQuery implements PreparedQuery<T>
-
Nested Class Summary
-
Field Summary
Fields Modifier and Type Field Description protected RuntimeProperty<java.lang.Boolean>autoClosePStmtStreamsprotected intbatchCommandIndexCommand index of currently executing batch command.protected java.lang.StringoriginalSqlThe SQL that was passed in to 'prepare'protected intparameterCountThe number of parameters in this PreparedStatementprotected ParseInfoparseInfoprotected TqueryBindingsprotected RuntimeProperty<java.lang.Boolean>useStreamLengthsInPrepStmtsFields inherited from class com.mysql.cj.AbstractQuery
batchedArgs, cancelTimeoutMutex, charEncoding, clearWarningsCalled, currentDb, fetchSize, maxAllowedPacket, resultSetType, session, statementExecuting, statementId, timeoutInMillis -
Constructor Summary
Constructors Constructor Description AbstractPreparedQuery(NativeSession sess) -
Method Summary
Modifier and Type Method Description java.lang.StringasSql()java.lang.StringasSql(boolean quoteStreamsAndUnknowns)voidcheckNullOrEmptyQuery(java.lang.String sql)Method checkNullOrEmptyQuery.voidcloseQuery()intcomputeBatchSize(int numBatchedArgs)Computes the optimum number of batched parameter lists to send without overflowing max_allowed_packet.protected abstract long[]computeMaxParameterSetSizeAndBatchSize(int numBatchedArgs)<M extends Message>
MfillSendPacket()Creates the packet that contains the query to be sent to the server.<M extends Message>
MfillSendPacket(QueryBindings<?> bindings)Creates the packet that contains the query to be sent to the server.intgetBatchCommandIndex()java.lang.StringgetOriginalSql()intgetParameterCount()ParseInfogetParseInfo()TgetQueryBindings()voidsetBatchCommandIndex(int batchCommandIndex)voidsetOriginalSql(java.lang.String originalSql)voidsetParameterCount(int parameterCount)voidsetParseInfo(ParseInfo parseInfo)voidsetQueryBindings(T queryBindings)Methods inherited from class com.mysql.cj.AbstractQuery
addBatch, checkCancelTimeout, clearBatchedArgs, getBatchedArgs, getCancelTimeoutMutex, getCurrentDatabase, getExecuteTime, getId, getResultFetchSize, getResultSetFactory, getResultType, getSession, getStatementExecuting, getTimeoutInMillis, isClearWarningsCalled, resetCancelledState, setCancelStatus, setClearWarningsCalled, setCurrentDatabase, setExecuteTime, setResultFetchSize, setResultType, setTimeoutInMillis, startQueryTimer, statementBegins, stopQueryTimerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.mysql.cj.Query
addBatch, checkCancelTimeout, clearBatchedArgs, getBatchedArgs, getCancelTimeoutMutex, getCurrentDatabase, getExecuteTime, getId, getResultFetchSize, getResultSetFactory, getResultType, getSession, getStatementExecuting, getTimeoutInMillis, isClearWarningsCalled, resetCancelledState, setCancelStatus, setClearWarningsCalled, setCurrentDatabase, setExecuteTime, setResultFetchSize, setResultType, setTimeoutInMillis, startQueryTimer, statementBegins, stopQueryTimer
-
Field Details
-
parseInfo
-
queryBindings
-
originalSql
protected java.lang.String originalSqlThe SQL that was passed in to 'prepare' -
parameterCount
protected int parameterCountThe number of parameters in this PreparedStatement -
autoClosePStmtStreams
-
batchCommandIndex
protected int batchCommandIndexCommand index of currently executing batch command. -
useStreamLengthsInPrepStmts
-
-
Constructor Details
-
Method Details
-
closeQuery
public void closeQuery()- Specified by:
closeQueryin interfaceQuery- Overrides:
closeQueryin classAbstractQuery
-
getParseInfo
- Specified by:
getParseInfoin interfacePreparedQuery<T extends QueryBindings<?>>
-
setParseInfo
- Specified by:
setParseInfoin interfacePreparedQuery<T extends QueryBindings<?>>
-
getOriginalSql
public java.lang.String getOriginalSql()- Specified by:
getOriginalSqlin interfacePreparedQuery<T extends QueryBindings<?>>
-
setOriginalSql
public void setOriginalSql(java.lang.String originalSql)- Specified by:
setOriginalSqlin interfacePreparedQuery<T extends QueryBindings<?>>
-
getParameterCount
public int getParameterCount()- Specified by:
getParameterCountin interfacePreparedQuery<T extends QueryBindings<?>>
-
setParameterCount
public void setParameterCount(int parameterCount)- Specified by:
setParameterCountin interfacePreparedQuery<T extends QueryBindings<?>>
-
getQueryBindings
- Specified by:
getQueryBindingsin interfacePreparedQuery<T extends QueryBindings<?>>
-
setQueryBindings
- Specified by:
setQueryBindingsin interfacePreparedQuery<T extends QueryBindings<?>>
-
getBatchCommandIndex
public int getBatchCommandIndex()- Specified by:
getBatchCommandIndexin interfacePreparedQuery<T extends QueryBindings<?>>
-
setBatchCommandIndex
public void setBatchCommandIndex(int batchCommandIndex)- Specified by:
setBatchCommandIndexin interfacePreparedQuery<T extends QueryBindings<?>>
-
computeBatchSize
public int computeBatchSize(int numBatchedArgs)Computes the optimum number of batched parameter lists to send without overflowing max_allowed_packet.- Specified by:
computeBatchSizein interfacePreparedQuery<T extends QueryBindings<?>>- Parameters:
numBatchedArgs- original batch size- Returns:
- computed batch size
-
checkNullOrEmptyQuery
public void checkNullOrEmptyQuery(java.lang.String sql)Method checkNullOrEmptyQuery.- Specified by:
checkNullOrEmptyQueryin interfacePreparedQuery<T extends QueryBindings<?>>- Parameters:
sql- the SQL to check- Throws:
WrongArgumentException- if query is null or empty.
-
asSql
public java.lang.String asSql()- Specified by:
asSqlin interfacePreparedQuery<T extends QueryBindings<?>>
-
asSql
public java.lang.String asSql(boolean quoteStreamsAndUnknowns)- Specified by:
asSqlin interfacePreparedQuery<T extends QueryBindings<?>>
-
computeMaxParameterSetSizeAndBatchSize
protected abstract long[] computeMaxParameterSetSizeAndBatchSize(int numBatchedArgs) -
fillSendPacket
Creates the packet that contains the query to be sent to the server.- Specified by:
fillSendPacketin interfacePreparedQuery<T extends QueryBindings<?>>- Returns:
- A Buffer filled with the query representing the PreparedStatement.
-
fillSendPacket
Creates the packet that contains the query to be sent to the server.- Specified by:
fillSendPacketin interfacePreparedQuery<T extends QueryBindings<?>>- Parameters:
bindings- values- Returns:
- a Buffer filled with the query that represents this statement
-