public class ServerPreparedQuery extends ClientPreparedQuery
Query.CancelStatus| Modifier and Type | Field and Description |
|---|---|
static int |
BLOB_STREAM_READ_BUF_SIZE |
protected NativeMessageBuilder |
commandBuilder |
protected RuntimeProperty<java.lang.Boolean> |
explainSlowQueries |
protected boolean |
gatherPerfMetrics
The "gatherPerfMetrics" connection property value
|
protected boolean |
logSlowQueries
The "logSlowQueries" connection property value
|
static byte |
OPEN_CURSOR_FLAG |
static byte |
PARAMETER_COUNT_AVAILABLE |
private Field[] |
parameterFields
Field-level metadata for parameters
|
protected boolean |
profileSQL
The "profileSQL" connection property value
|
protected boolean |
queryWasSlow |
private ColumnDefinition |
resultFields
Field-level metadata for result sets.
|
private long |
serverStatementId
The ID that the server uses to identify this PreparedStatement
|
protected RuntimeProperty<java.lang.Integer> |
slowQueryThresholdMillis |
private boolean |
useAutoSlowLog |
protected boolean |
useCursorFetch |
autoClosePStmtStreams, batchCommandIndex, originalSql, parameterCount, queryBindings, queryInfo, useStreamLengthsInPrepStmtsbatchedArgs, cancelTimeoutMutex, charEncoding, clearWarningsCalled, currentDb, fetchSize, maxAllowedPacket, queryAttributesBindings, resultSetType, session, statementCounter, statementExecuting, statementId, timeoutInMillis| Modifier | Constructor and Description |
|---|---|
protected |
ServerPreparedQuery(NativeSession sess) |
| Modifier and Type | Method and Description |
|---|---|
void |
clearParameters(boolean clearServerParameters) |
void |
closeQuery() |
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> |
fillSendPacket(QueryBindings bindings) |
static ServerPreparedQuery |
getInstance(NativeSession sess) |
Field[] |
getParameterFields() |
ColumnDefinition |
getResultFields() |
long |
getServerStatementId() |
NativePacketPayload |
prepareExecutePacket() |
<T extends Resultset> |
readExecuteResult(NativePacketPayload resultPacket,
int maxRowsToRetrieve,
boolean createStreamingResultSet,
ColumnDefinition metadata,
ProtocolEntityFactory<T,NativePacketPayload> resultSetFactory,
java.lang.String queryAsString) |
NativePacketPayload |
sendExecutePacket(NativePacketPayload packet,
java.lang.String queryAsString) |
<T extends Resultset> |
serverExecute(int maxRowsToRetrieve,
boolean createStreamingResultSet,
ColumnDefinition metadata,
ProtocolEntityFactory<T,NativePacketPayload> resultSetFactory) |
private void |
serverLongData(int parameterIndex,
BindValue binding)
Sends stream-type data parameters to the server.
|
void |
serverPrepare(java.lang.String sql) |
void |
serverResetStatement() |
void |
setParameterFields(Field[] parameterFields) |
void |
setResultFields(ColumnDefinition resultFields) |
void |
setServerStatementId(long serverStatementId) |
void |
statementBegins() |
private void |
storeStreamOrReader(int parameterIndex,
NativePacketPayload packet,
java.io.Closeable streamOrReader) |
private java.lang.String |
truncateQueryToLog(java.lang.String sql) |
asSql, checkNullOrEmptyQuery, computeBatchSize, getBatchCommandIndex, getOriginalSql, getParameterCount, getQueryBindings, getQueryInfo, setBatchCommandIndex, setOriginalSql, setParameterCount, setQueryBindings, setQueryInfoaddBatch, checkCancelTimeout, clearBatchedArgs, getBatchedArgs, getCancelTimeoutMutex, getCurrentDatabase, getExecuteTime, getId, getQueryAttributesBindings, getResultFetchSize, getResultSetFactory, getResultType, getSession, getStatementExecuting, getTimeoutInMillis, isClearWarningsCalled, resetCancelledState, setCancelStatus, setClearWarningsCalled, setCurrentDatabase, setExecuteTime, setResultFetchSize, setResultType, setTimeoutInMillis, startQueryTimer, stopQueryTimerclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddBatch, checkCancelTimeout, clearBatchedArgs, getBatchedArgs, getCancelTimeoutMutex, getCurrentDatabase, getExecuteTime, getId, getQueryAttributesBindings, getResultFetchSize, getResultSetFactory, getResultType, getSession, getStatementExecuting, getTimeoutInMillis, isClearWarningsCalled, resetCancelledState, setCancelStatus, setClearWarningsCalled, setCurrentDatabase, setExecuteTime, setResultFetchSize, setResultType, setTimeoutInMillis, startQueryTimer, stopQueryTimerpublic static final int BLOB_STREAM_READ_BUF_SIZE
public static final byte OPEN_CURSOR_FLAG
public static final byte PARAMETER_COUNT_AVAILABLE
private long serverStatementId
private Field[] parameterFields
private ColumnDefinition resultFields
protected boolean profileSQL
protected boolean gatherPerfMetrics
protected boolean logSlowQueries
private boolean useAutoSlowLog
protected RuntimeProperty<java.lang.Integer> slowQueryThresholdMillis
protected RuntimeProperty<java.lang.Boolean> explainSlowQueries
protected boolean useCursorFetch
protected boolean queryWasSlow
protected NativeMessageBuilder commandBuilder
protected ServerPreparedQuery(NativeSession sess)
public static ServerPreparedQuery getInstance(NativeSession sess)
public void serverPrepare(java.lang.String sql)
throws java.io.IOException
sql - query stringjava.io.IOException - if an i/o error occurspublic void statementBegins()
statementBegins in interface QuerystatementBegins in class AbstractQuerypublic <T extends Resultset> T serverExecute(int maxRowsToRetrieve, boolean createStreamingResultSet, ColumnDefinition metadata, ProtocolEntityFactory<T,NativePacketPayload> resultSetFactory)
T - extends ResultsetmaxRowsToRetrieve - rows limitcreateStreamingResultSet - should c/J create a streaming result?metadata - use this metadata instead of the one provided on wireresultSetFactory - ProtocolEntityFactorypublic NativePacketPayload prepareExecutePacket()
public NativePacketPayload sendExecutePacket(NativePacketPayload packet, java.lang.String queryAsString)
public <T extends Resultset> T readExecuteResult(NativePacketPayload resultPacket, int maxRowsToRetrieve, boolean createStreamingResultSet, ColumnDefinition metadata, ProtocolEntityFactory<T,NativePacketPayload> resultSetFactory, java.lang.String queryAsString)
private void serverLongData(int parameterIndex,
BindValue binding)
Long data handling:
- Server gets the long data in pieces with command type 'COM_LONG_DATA'.
- The packet received will have the format:
[COM_LONG_DATA: 1][STMT_ID:4][parameter_number:2][type:2][data]
- Checks if the type is specified by client, and if yes reads the type,
and stores the data in that format.
- It is up to the client to check for read data ended. The server does not
care; and also server does not notify to the client that it got the
data or not; if there is any error; then during execute; the error
will be returned
parameterIndex - parameter indexbinding - containing long datapublic void closeQuery()
closeQuery in interface QuerycloseQuery in class ClientPreparedQuerypublic long getServerStatementId()
public void setServerStatementId(long serverStatementId)
public Field[] getParameterFields()
public void setParameterFields(Field[] parameterFields)
public ColumnDefinition getResultFields()
public void setResultFields(ColumnDefinition resultFields)
private void storeStreamOrReader(int parameterIndex,
NativePacketPayload packet,
java.io.Closeable streamOrReader)
public void clearParameters(boolean clearServerParameters)
clearServerParameters - flag indicating whether we need an additional clean uppublic void serverResetStatement()
protected long[] computeMaxParameterSetSizeAndBatchSize(int numBatchedArgs)
computeMaxParameterSetSizeAndBatchSize in class ClientPreparedQuerynumBatchedArgs - number of batched argumentsprivate java.lang.String truncateQueryToLog(java.lang.String sql)
public <M extends Message> M fillSendPacket(QueryBindings bindings)
fillSendPacket in interface PreparedQueryfillSendPacket in class ClientPreparedQuery