Package com.mysql.cj
Class ServerPreparedQuery
java.lang.Object
- All Implemented Interfaces:
PreparedQuery<ServerPreparedQueryBindings>,Query
- Direct Known Subclasses:
ServerPreparedQueryTestcaseGenerator
public class ServerPreparedQuery extends AbstractPreparedQuery<ServerPreparedQueryBindings>
-
Nested Class Summary
-
Field Summary
Fields Modifier and Type Field Description static intBLOB_STREAM_READ_BUF_SIZEprotected NativeMessageBuildercommandBuilderprotected RuntimeProperty<java.lang.Boolean>explainSlowQueriesprotected booleangatherPerfMetricsThe "gatherPerfMetrics" connection property valueprotected booleanlogSlowQueriesThe "logSlowQueries" connection property valuestatic byteOPEN_CURSOR_FLAGprotected booleanprofileSQLThe "profileSQL" connection property valueprotected booleanqueryWasSlowprotected RuntimeProperty<java.lang.Integer>slowQueryThresholdMillisprotected booleanuseCursorFetchFields inherited from class com.mysql.cj.AbstractPreparedQuery
autoClosePStmtStreams, batchCommandIndex, originalSql, parameterCount, parseInfo, queryBindings, useStreamLengthsInPrepStmtsFields inherited from class com.mysql.cj.AbstractQuery
batchedArgs, cancelTimeoutMutex, charEncoding, clearWarningsCalled, currentDb, fetchSize, maxAllowedPacket, resultSetType, session, statementExecuting, statementId, timeoutInMillis -
Constructor Summary
Constructors Modifier Constructor Description protectedServerPreparedQuery(NativeSession sess) -
Method Summary
Modifier and Type Method Description voidclearParameters(boolean clearServerParameters)voidcloseQuery()protected long[]computeMaxParameterSetSizeAndBatchSize(int numBatchedArgs)Computes the maximum parameter set size and the size of the entire batch given the number of arguments in the batch.<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.static ServerPreparedQuerygetInstance(NativeSession sess)Field[]getParameterFields()ColumnDefinitiongetResultFields()longgetServerStatementId()NativePacketPayloadprepareExecutePacket()<T extends Resultset>
TreadExecuteResult(NativePacketPayload resultPacket, int maxRowsToRetrieve, boolean createStreamingResultSet, ColumnDefinition metadata, ProtocolEntityFactory<T,NativePacketPayload> resultSetFactory, java.lang.String queryAsString)NativePacketPayloadsendExecutePacket(NativePacketPayload packet, java.lang.String queryAsString)<T extends Resultset>
TserverExecute(int maxRowsToRetrieve, boolean createStreamingResultSet, ColumnDefinition metadata, ProtocolEntityFactory<T,NativePacketPayload> resultSetFactory)voidserverPrepare(java.lang.String sql)voidserverResetStatement()voidsetParameterFields(Field[] parameterFields)voidsetResultFields(ColumnDefinition resultFields)voidsetServerStatementId(long serverStatementId)voidstatementBegins()voidstoreReader(int parameterIndex, NativePacketPayload packet, java.io.Reader inStream)voidstoreStream(int parameterIndex, NativePacketPayload packet, java.io.InputStream inStream)Methods inherited from class com.mysql.cj.AbstractPreparedQuery
asSql, asSql, checkNullOrEmptyQuery, computeBatchSize, getBatchCommandIndex, getOriginalSql, getParameterCount, getParseInfo, getQueryBindings, setBatchCommandIndex, setOriginalSql, setParameterCount, setParseInfo, setQueryBindingsMethods 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, 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, stopQueryTimer
-
Field Details
-
BLOB_STREAM_READ_BUF_SIZE
public static final int BLOB_STREAM_READ_BUF_SIZE- See Also:
- Constant Field Values
-
OPEN_CURSOR_FLAG
public static final byte OPEN_CURSOR_FLAG- See Also:
- Constant Field Values
-
profileSQL
protected boolean profileSQLThe "profileSQL" connection property value -
gatherPerfMetrics
protected boolean gatherPerfMetricsThe "gatherPerfMetrics" connection property value -
logSlowQueries
protected boolean logSlowQueriesThe "logSlowQueries" connection property value -
slowQueryThresholdMillis
-
explainSlowQueries
-
useCursorFetch
protected boolean useCursorFetch -
queryWasSlow
protected boolean queryWasSlow -
commandBuilder
-
-
Constructor Details
-
Method Details
-
getInstance
-
serverPrepare
public void serverPrepare(java.lang.String sql) throws java.io.IOException- Parameters:
sql- query string- Throws:
java.io.IOException- if an i/o error occurs
-
statementBegins
public void statementBegins()- Specified by:
statementBeginsin interfaceQuery- Overrides:
statementBeginsin classAbstractQuery
-
serverExecute
public <T extends Resultset> T serverExecute(int maxRowsToRetrieve, boolean createStreamingResultSet, ColumnDefinition metadata, ProtocolEntityFactory<T,NativePacketPayload> resultSetFactory)- Type Parameters:
T- extendsResultset- Parameters:
maxRowsToRetrieve- rows limitcreateStreamingResultSet- should c/J create a streaming result?metadata- use this metadata instead of the one provided on wireresultSetFactory-ProtocolEntityFactory- Returns:
- T instance
-
prepareExecutePacket
-
sendExecutePacket
public NativePacketPayload sendExecutePacket(NativePacketPayload packet, java.lang.String queryAsString) -
readExecuteResult
public <T extends Resultset> T readExecuteResult(NativePacketPayload resultPacket, int maxRowsToRetrieve, boolean createStreamingResultSet, ColumnDefinition metadata, ProtocolEntityFactory<T,NativePacketPayload> resultSetFactory, java.lang.String queryAsString) -
closeQuery
public void closeQuery()- Specified by:
closeQueryin interfaceQuery- Overrides:
closeQueryin classAbstractPreparedQuery<ServerPreparedQueryBindings>
-
getServerStatementId
public long getServerStatementId() -
setServerStatementId
public void setServerStatementId(long serverStatementId) -
getParameterFields
-
setParameterFields
-
getResultFields
-
setResultFields
-
storeStream
public void storeStream(int parameterIndex, NativePacketPayload packet, java.io.InputStream inStream) -
storeReader
-
clearParameters
public void clearParameters(boolean clearServerParameters)- Parameters:
clearServerParameters- flag indicating whether we need an additional clean up
-
serverResetStatement
public void serverResetStatement() -
computeMaxParameterSetSizeAndBatchSize
protected long[] computeMaxParameterSetSizeAndBatchSize(int numBatchedArgs)Computes the maximum parameter set size and the size of the entire batch given the number of arguments in the batch.- Specified by:
computeMaxParameterSetSizeAndBatchSizein classAbstractPreparedQuery<ServerPreparedQueryBindings>
-
fillSendPacket
Description copied from class:AbstractPreparedQueryCreates the packet that contains the query to be sent to the server.- Specified by:
fillSendPacketin interfacePreparedQuery<ServerPreparedQueryBindings>- Overrides:
fillSendPacketin classAbstractPreparedQuery<ServerPreparedQueryBindings>- Returns:
- A Buffer filled with the query representing the PreparedStatement.
-
fillSendPacket
Description copied from class:AbstractPreparedQueryCreates the packet that contains the query to be sent to the server.- Specified by:
fillSendPacketin interfacePreparedQuery<ServerPreparedQueryBindings>- Overrides:
fillSendPacketin classAbstractPreparedQuery<ServerPreparedQueryBindings>- Parameters:
bindings- values- Returns:
- a Buffer filled with the query that represents this statement
-