public class ServerPreparedStatement extends ClientPreparedStatement
Query.CancelStatus| Modifier and Type | Field and Description |
|---|---|
protected boolean |
isCacheable |
protected boolean |
isCached |
batchedValuesClause, batchHasPlainStatements, parameterMetaData, rewrittenBatchSizebatchedGeneratedKeys, charEncoding, commandBuilder, connection, continueBatchOnError, doEscapeProcessing, dontCheckOnDuplicateKeyUpdateInSQL, dontTrackOpenResources, dumpQueriesOnException, exceptionInterceptor, generatedKeysResults, holdResultsOpenOverClose, isClosed, lastInsertId, lastQueryIsOnDupKeyUpdate, logSlowQueries, maxAllowedPacket, maxFieldSize, maxRows, openResults, pedantic, PING_MARKER, pingTarget, profileSQL, query, results, resultSetConcurrency, resultSetFactory, retrieveGeneratedKeys, rewriteBatchedStatements, session, updateCount, USES_VARIABLES_FALSE, USES_VARIABLES_TRUE, USES_VARIABLES_UNKNOWN, useUsageAdvisor, warningChainMAX_ROWS| Modifier | Constructor and Description |
|---|---|
protected |
ServerPreparedStatement(JdbcConnection conn,
java.lang.String sql,
java.lang.String db,
int resultSetType,
int resultSetConcurrency)
Creates a new ServerPreparedStatement object.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addBatch() |
java.lang.String |
asSql(boolean quoteStreamsAndUnknowns) |
protected void |
checkBounds(int parameterIndex,
int parameterIndexOffset) |
protected JdbcConnection |
checkClosed()
Checks if closed() has been called, and throws an exception if so
|
void |
clearParameters() |
void |
close()
In many cases, it is desirable to immediately release a Statement's
database and JDBC resources instead of waiting for this to happen when it
is automatically closed.
|
protected boolean |
containsOnDuplicateKeyUpdateInSQL() |
protected long[] |
executeBatchSerially(int batchTimeout)
Executes the current batch of statements by executing them one-by-one.
|
protected <M extends Message> |
executeInternal(int maxRowsToRetrieve,
M sendPacket,
boolean createStreamingResultSet,
boolean queryIsSelectOnly,
ColumnDefinition metadata,
boolean isBatch)
Actually execute the prepared statement.
|
protected ServerPreparedQueryBindValue |
getBinding(int parameterIndex,
boolean forLongData)
Returns the structure representing the value that (can be)/(is)
bound at the given parameter index.
|
protected static ServerPreparedStatement |
getInstance(JdbcConnection conn,
java.lang.String sql,
java.lang.String db,
int resultSetType,
int resultSetConcurrency)
Creates a prepared statement instance
|
java.sql.ResultSetMetaData |
getMetaData() |
java.sql.ParameterMetaData |
getParameterMetaData() |
long |
getServerStatementId() |
protected void |
initQuery() |
boolean |
isNull(int paramIndex) |
protected ClientPreparedStatement |
prepareBatchedInsertSQL(JdbcConnection localConn,
int numBatches)
Returns a prepared statement for the number of batched parameters, used when re-writing batch INSERTs.
|
void |
realClose(boolean calledExplicitly,
boolean closeOpenResults)
Closes this statement, and frees resources.
|
protected void |
rePrepare()
Used by Connection when auto-reconnecting to retrieve 'lost' prepared
statements.
|
protected ResultSetInternalMethods |
serverExecute(int maxRowsToRetrieve,
boolean createStreamingResultSet,
ColumnDefinition metadata)
Tells the server to execute this prepared statement with the current
parameter bindings.
|
protected void |
serverPrepare(java.lang.String sql) |
protected void |
setClosed(boolean flag) |
protected int |
setOneBatchedParameterSet(java.sql.PreparedStatement batchedStatement,
int batchedParamIndex,
java.lang.Object paramSet) |
void |
setPoolable(boolean poolable) |
void |
setUnicodeStream(int parameterIndex,
java.io.InputStream x,
int length)
Deprecated.
|
void |
setURL(int parameterIndex,
java.net.URL x) |
java.lang.String |
toString()
Returns this PreparedStatement represented as a string.
|
addBatch, asSql, checkReadOnlySafeStatement, clearBatch, execute, executeBatchedInserts, executeBatchInternal, executeLargeUpdate, executePreparedBatchAsMultiStatement, executeQuery, executeUpdate, executeUpdateInternal, executeUpdateInternal, getBytesRepresentation, getCoreParameterIndex, getInstance, getInstance, getOrigBytes, getParameterBindings, getParameterIndexOffset, getParseInfo, getPreparedSql, getQueryBindings, getUpdateCount, isSelectQuery, setArray, setAsciiStream, setAsciiStream, setAsciiStream, setBigDecimal, setBigInteger, setBinaryStream, setBinaryStream, setBinaryStream, setBlob, setBlob, setBlob, setBoolean, setByte, setBytes, setBytes, setBytesNoEscape, setBytesNoEscapeNoQuotes, setCharacterStream, setCharacterStream, setCharacterStream, setClob, setClob, setClob, setDate, setDate, setDouble, setFloat, setInt, setLong, setNCharacterStream, setNCharacterStream, setNClob, setNClob, setNClob, setNString, setNull, setNull, setNull, setObject, setObject, setObject, setObject, setObject, setRef, setRetrieveGeneratedKeys, setRowId, setShort, setSQLXML, setString, setTime, setTime, setTimestamp, setTimestamp, setTimestampaddBatch, cancel, checkCancelTimeout, checkForDml, checkNullOrEmptyQuery, clearBatchedArgs, clearWarnings, closeAllOpenResults, closeOnCompletion, closeQuery, containsOnDuplicateKeyInString, createStreamingResultSet, disableStreamingResults, doPingInstead, enableStreamingResults, execute, execute, execute, execute, executeBatch, executeLargeBatch, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeQuery, executeSimpleNonQuery, executeUpdate, executeUpdate, executeUpdate, executeUpdate, executeUpdateInternal, findStartOfStatement, generatePingResultSet, getBatchedArgs, getBatchedGeneratedKeys, getBatchedGeneratedKeys, getCancelTimeoutMutex, getConnection, getCurrentDatabase, getExceptionInterceptor, getExecuteTime, getFetchDirection, getFetchSize, getGeneratedKeys, getGeneratedKeysInternal, getGeneratedKeysInternal, getId, getLargeMaxRows, getLargeUpdateCount, getLastInsertID, getLocalInfileInputStream, getLongUpdateCount, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getOpenResultSetCount, getQuery, getQueryTimeout, getResultFetchSize, getResultSet, getResultSetConcurrency, getResultSetFactory, getResultSetHoldability, getResultSetInternal, getResultSetType, getResultType, getSession, getStatementExecuting, getTimeoutInMillis, getWarnings, handleExceptionForBatch, hasDeadlockOrTimeoutRolledBackTx, implicitlyCloseAllOpenResults, isClearWarningsCalled, isClosed, isCloseOnCompletion, isPoolable, isWrapperFor, processMultiCountsAndKeys, removeOpenResultSet, resetCancelledState, setCancelStatus, setClearWarningsCalled, setCurrentDatabase, setCursorName, setEscapeProcessing, setExecuteTime, setFetchDirection, setFetchSize, setHoldResultsOpenOverClose, setLargeMaxRows, setLocalInfileInputStream, setMaxFieldSize, setMaxRows, setPingTarget, setQueryTimeout, setResultFetchSize, setResultType, setTimeoutInMillis, setupStreamingTimeout, startQueryTimer, statementBegins, stopQueryTimer, unwrapclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitdisableStreamingResults, enableStreamingResults, getExceptionInterceptor, getLocalInfileInputStream, getOpenResultSetCount, getQuery, removeOpenResultSet, setHoldResultsOpenOverClose, setLocalInfileInputStream, setPingTargetcancel, clearWarnings, closeOnCompletion, execute, execute, execute, execute, executeBatch, executeLargeBatch, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeQuery, executeUpdate, executeUpdate, executeUpdate, executeUpdate, getConnection, getFetchDirection, getFetchSize, getGeneratedKeys, getLargeMaxRows, getLargeUpdateCount, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getWarnings, isClosed, isCloseOnCompletion, isPoolable, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setLargeMaxRows, setMaxFieldSize, setMaxRows, setQueryTimeoutaddBatch, checkCancelTimeout, clearBatchedArgs, closeQuery, getBatchedArgs, getCancelTimeoutMutex, getCurrentDatabase, getExecuteTime, getId, getResultFetchSize, getResultSetFactory, getResultType, getSession, getStatementExecuting, getTimeoutInMillis, isClearWarningsCalled, resetCancelledState, setCancelStatus, setClearWarningsCalled, setCurrentDatabase, setExecuteTime, setResultFetchSize, setResultType, setTimeoutInMillis, startQueryTimer, statementBegins, stopQueryTimerprotected ServerPreparedStatement(JdbcConnection conn, java.lang.String sql, java.lang.String db, int resultSetType, int resultSetConcurrency) throws java.sql.SQLException
conn - the connection creating us.sql - the SQL containing the statement to prepare.db - the database in use when we were created.resultSetType - ResultSet typeresultSetConcurrency - ResultSet concurrencyjava.sql.SQLException - If an error occursprotected static ServerPreparedStatement getInstance(JdbcConnection conn, java.lang.String sql, java.lang.String db, int resultSetType, int resultSetConcurrency) throws java.sql.SQLException
conn - the connection creating us.sql - the SQL containing the statement to prepare.db - the database in use when we were created.resultSetType - ResultSet typeresultSetConcurrency - ResultSet concurrencyjava.sql.SQLException - If an error occursprotected void initQuery()
initQuery in class ClientPreparedStatementpublic java.lang.String toString()
ClientPreparedStatementtoString in class ClientPreparedStatementpublic void addBatch()
throws java.sql.SQLException
addBatch in interface java.sql.PreparedStatementaddBatch in class ClientPreparedStatementjava.sql.SQLExceptionpublic java.lang.String asSql(boolean quoteStreamsAndUnknowns)
throws java.sql.SQLException
asSql in class ClientPreparedStatementjava.sql.SQLExceptionprotected JdbcConnection checkClosed()
StatementImplcheckClosed in class StatementImplpublic void clearParameters()
clearParameters in interface java.sql.PreparedStatementclearParameters in class ClientPreparedStatementprotected void setClosed(boolean flag)
public void close()
throws java.sql.SQLException
StatementImplNote: A Statement is automatically closed when it is garbage collected. When a Statement is closed, its current ResultSet, if one exists, is also closed.
close in interface java.lang.AutoCloseableclose in interface java.sql.Statementclose in class StatementImpljava.sql.SQLException - if a database access error occursprotected long[] executeBatchSerially(int batchTimeout)
throws java.sql.SQLException
ClientPreparedStatementexecuteBatchSerially in class ClientPreparedStatementbatchTimeout - timeout for the batch executionjava.sql.SQLException - if an error occursprotected <M extends Message> ResultSetInternalMethods executeInternal(int maxRowsToRetrieve, M sendPacket, boolean createStreamingResultSet, boolean queryIsSelectOnly, ColumnDefinition metadata, boolean isBatch) throws java.sql.SQLException
ClientPreparedStatementexecuteInternal in class ClientPreparedStatementM - extends MessagemaxRowsToRetrieve - the max number of rows to returnsendPacket - the packet to sendcreateStreamingResultSet - should a 'streaming' result set be created?queryIsSelectOnly - is this query doing a SELECT?metadata - use this metadata instead of the one provided on wireisBatch - is this a batch query?java.sql.SQLException - if an error occurs.protected ServerPreparedQueryBindValue getBinding(int parameterIndex, boolean forLongData) throws java.sql.SQLException
parameterIndex - 1-basedforLongData - is this for a stream?ServerPreparedQueryBindValuejava.sql.SQLException - if a database access error occurs or this method is called on a closed PreparedStatementpublic java.sql.ResultSetMetaData getMetaData()
throws java.sql.SQLException
getMetaData in interface java.sql.PreparedStatementgetMetaData in class ClientPreparedStatementjava.sql.SQLExceptionpublic java.sql.ParameterMetaData getParameterMetaData()
throws java.sql.SQLException
getParameterMetaData in interface java.sql.PreparedStatementgetParameterMetaData in class ClientPreparedStatementjava.sql.SQLExceptionpublic boolean isNull(int paramIndex)
isNull in interface JdbcPreparedStatementisNull in class ClientPreparedStatementpublic void realClose(boolean calledExplicitly,
boolean closeOpenResults)
throws java.sql.SQLException
StatementImplrealClose in interface JdbcPreparedStatementrealClose in class ClientPreparedStatementcalledExplicitly - was this called from close()?closeOpenResults - should open result sets be closed?java.sql.SQLException - if an error occursprotected void rePrepare()
CJException - if an error occurs.protected ResultSetInternalMethods serverExecute(int maxRowsToRetrieve, boolean createStreamingResultSet, ColumnDefinition metadata) throws java.sql.SQLException
- Server gets the command 'COM_EXECUTE' to execute the
previously prepared query. If there is any param markers;
then client will send the data in the following format:
[COM_EXECUTE:1]
[STMT_ID:4]
[NULL_BITS:(param_count+7)/8)]
[TYPES_SUPPLIED_BY_CLIENT(0/1):1]
[[length]data]
[[length]data] .. [[length]data].
(Note: Except for string/binary types; all other types will not be
supplied with length field)
maxRowsToRetrieve - rows limitcreateStreamingResultSet - should c/J create a streaming result?metadata - use this metadata instead of the one provided on wirejava.sql.SQLException - if a database access error occurs or this method is called on a closed PreparedStatementprotected void serverPrepare(java.lang.String sql)
throws java.sql.SQLException
java.sql.SQLExceptionprotected void checkBounds(int parameterIndex,
int parameterIndexOffset)
throws java.sql.SQLException
checkBounds in class ClientPreparedStatementjava.sql.SQLException@Deprecated
public void setUnicodeStream(int parameterIndex,
java.io.InputStream x,
int length)
throws java.sql.SQLException
setUnicodeStream in interface java.sql.PreparedStatementsetUnicodeStream in class ClientPreparedStatementjava.sql.SQLExceptionpublic void setURL(int parameterIndex,
java.net.URL x)
throws java.sql.SQLException
setURL in interface java.sql.PreparedStatementsetURL in class ClientPreparedStatementjava.sql.SQLExceptionpublic long getServerStatementId()
getServerStatementId in class StatementImplprotected int setOneBatchedParameterSet(java.sql.PreparedStatement batchedStatement,
int batchedParamIndex,
java.lang.Object paramSet)
throws java.sql.SQLException
setOneBatchedParameterSet in class ClientPreparedStatementjava.sql.SQLExceptionprotected boolean containsOnDuplicateKeyUpdateInSQL()
containsOnDuplicateKeyUpdateInSQL in class ClientPreparedStatementprotected ClientPreparedStatement prepareBatchedInsertSQL(JdbcConnection localConn, int numBatches) throws java.sql.SQLException
ClientPreparedStatementprepareBatchedInsertSQL in class ClientPreparedStatementlocalConn - the connection creating this statementnumBatches - number of entries in a batchjava.sql.SQLException - if a database access error occurs or this method is called on a closed PreparedStatementpublic void setPoolable(boolean poolable)
throws java.sql.SQLException
setPoolable in interface java.sql.StatementsetPoolable in class StatementImpljava.sql.SQLException