类 ServerPreparedStatement
- java.lang.Object
-
- com.mysql.cj.jdbc.StatementImpl
-
- com.mysql.cj.jdbc.ClientPreparedStatement
-
- com.mysql.cj.jdbc.ServerPreparedStatement
-
- 所有已实现的接口:
JdbcPreparedStatement,JdbcStatement,Query,AutoCloseable,PreparedStatement,Statement,Wrapper
public class ServerPreparedStatement extends ClientPreparedStatement
JDBC Interface for MySQL-4.1 and newer server-side PreparedStatements.
-
-
嵌套类概要
-
从接口继承的嵌套类/接口 com.mysql.cj.Query
Query.CancelStatus
-
-
字段概要
字段 修饰符和类型 字段 说明 protected booleanisCacheableprotected booleanisCached-
从类继承的字段 com.mysql.cj.jdbc.ClientPreparedStatement
batchedValuesClause, batchHasPlainStatements, parameterMetaData, rewrittenBatchSize
-
从类继承的字段 com.mysql.cj.jdbc.StatementImpl
batchedGeneratedKeys, 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, warningChain
-
从接口继承的字段 com.mysql.cj.jdbc.JdbcStatement
MAX_ROWS
-
-
构造器概要
构造器 限定符 构造器 说明 protectedServerPreparedStatement(JdbcConnection conn, String sql, String db, int resultSetType, int resultSetConcurrency)Creates a new ServerPreparedStatement object.
-
方法概要
所有方法 静态方法 实例方法 具体方法 已过时的方法 修饰符和类型 方法 说明 voidaddBatch()protected voidcheckBounds(int parameterIndex, int parameterIndexOffset)protected JdbcConnectioncheckClosed()Checks if closed() has been called, and throws an exception if sovoidclearParameters()voidclose()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 booleancontainsOnDuplicateKeyUpdate()protected long[]executeBatchSerially(int batchTimeout)Executes the current batch of statements by executing them one-by-one.protected <M extends Message>
ResultSetInternalMethodsexecuteInternal(int maxRowsToRetrieve, M sendPacket, boolean createStreamingResultSet, boolean queryIsSelectOnly, ColumnDefinition metadata, boolean isBatch)Actually execute the prepared statement.protected BindValuegetBinding(int parameterIndex, boolean forLongData)Returns the structure representing the value that (can be)/(is) bound at the given parameter index.protected static ServerPreparedStatementgetInstance(JdbcConnection conn, String sql, String db, int resultSetType, int resultSetConcurrency)Creates a prepared statement instanceResultSetMetaDatagetMetaData()ParameterMetaDatagetParameterMetaData()longgetServerStatementId()protected voidinitQuery()booleanisNull(int paramIndex)protected ClientPreparedStatementprepareBatchedInsertSQL(JdbcConnection localConn, int numBatches)Returns a prepared statement for the number of batched parameters, used when re-writing batch INSERTs.voidrealClose(boolean calledExplicitly, boolean closeOpenResults)Closes this statement, and frees resources.protected voidrePrepare()Used by Connection when auto-reconnecting to retrieve 'lost' prepared statements.protected ResultSetInternalMethodsserverExecute(int maxRowsToRetrieve, boolean createStreamingResultSet, ColumnDefinition metadata)Tells the server to execute this prepared statement with the current parameter bindings.protected voidserverPrepare(String sql)protected voidsetClosed(boolean flag)voidsetPoolable(boolean poolable)voidsetUnicodeStream(int parameterIndex, InputStream x, int length)已过时。voidsetURL(int parameterIndex, URL x)StringtoString()Returns this PreparedStatement represented as a string.-
从类继承的方法 com.mysql.cj.jdbc.ClientPreparedStatement
addBatch, checkReadOnlySafeStatement, clearBatch, execute, executeBatchedInserts, executeBatchInternal, executeLargeUpdate, executePreparedBatchAsMultiStatement, executeQuery, executeUpdate, executeUpdateInternal, executeUpdateInternal, getBytesRepresentation, getCoreParameterIndex, getInstance, getInstance, getParameterBindings, getParameterIndexOffset, getPreparedSql, getQueryBindings, getQueryInfo, getUpdateCount, isResultSetProducingQuery, setArray, setAsciiStream, setAsciiStream, setAsciiStream, setBigDecimal, setBigInteger, setBinaryStream, setBinaryStream, setBinaryStream, setBlob, setBlob, setBlob, setBoolean, setByte, setBytes, setBytes, 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, setOneBatchedParameterSet, setRef, setRetrieveGeneratedKeys, setRowId, setShort, setSQLXML, setString, setTime, setTime, setTimestamp, setTimestamp
-
从类继承的方法 com.mysql.cj.jdbc.StatementImpl
addBatch, cancel, checkCancelTimeout, checkNullOrEmptyQuery, clearAttributes, 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, 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, getQueryAttributesBindings, getQueryTimeout, getResultFetchSize, getResultSet, getResultSetConcurrency, getResultSetFactory, getResultSetHoldability, getResultSetInternal, getResultSetType, getResultType, getSession, getStatementExecuting, getTimeoutInMillis, getWarnings, handleExceptionForBatch, hasDeadlockOrTimeoutRolledBackTx, implicitlyCloseAllOpenResults, isClearWarningsCalled, isClosed, isCloseOnCompletion, isNonResultSetProducingQuery, isPoolable, isResultSetProducingQuery, isWrapperFor, processMultiCountsAndKeys, removeOpenResultSet, resetCancelledState, setAttribute, setCancelStatus, setClearWarningsCalled, setCurrentDatabase, setCursorName, setEscapeProcessing, setExecuteTime, setFetchDirection, setFetchSize, setHoldResultsOpenOverClose, setLargeMaxRows, setLocalInfileInputStream, setMaxFieldSize, setMaxRows, setPingTarget, setQueryTimeout, setResultFetchSize, setResultType, setTimeoutInMillis, setupStreamingTimeout, startQueryTimer, statementBegins, stopQueryTimer, unwrap
-
从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
从接口继承的方法 com.mysql.cj.jdbc.JdbcStatement
clearAttributes, disableStreamingResults, enableStreamingResults, getExceptionInterceptor, getLocalInfileInputStream, getOpenResultSetCount, getQuery, getResultSetInternal, removeOpenResultSet, setAttribute, setHoldResultsOpenOverClose, setLocalInfileInputStream, setPingTarget
-
从接口继承的方法 com.mysql.cj.Query
addBatch, checkCancelTimeout, clearBatchedArgs, closeQuery, getBatchedArgs, getCancelTimeoutMutex, getCurrentDatabase, getExecuteTime, getId, getQueryAttributesBindings, getResultFetchSize, getResultSetFactory, getResultType, getSession, getStatementExecuting, getTimeoutInMillis, isClearWarningsCalled, resetCancelledState, setCancelStatus, setClearWarningsCalled, setCurrentDatabase, setExecuteTime, setResultFetchSize, setResultType, setTimeoutInMillis, startQueryTimer, statementBegins, stopQueryTimer
-
从接口继承的方法 java.sql.Statement
cancel, clearWarnings, closeOnCompletion, enquoteIdentifier, enquoteLiteral, enquoteNCharLiteral, 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, isSimpleIdentifier, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setLargeMaxRows, setMaxFieldSize, setMaxRows, setQueryTimeout
-
从接口继承的方法 java.sql.Wrapper
isWrapperFor, unwrap
-
-
-
-
构造器详细资料
-
ServerPreparedStatement
protected ServerPreparedStatement(JdbcConnection conn, String sql, String db, int resultSetType, int resultSetConcurrency) throws SQLException
Creates a new ServerPreparedStatement object.- 参数:
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 concurrency- 抛出:
SQLException- If an error occurs
-
-
方法详细资料
-
getInstance
protected static ServerPreparedStatement getInstance(JdbcConnection conn, String sql, String db, int resultSetType, int resultSetConcurrency) throws SQLException
Creates a prepared statement instance- 参数:
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 concurrency- 返回:
- new ServerPreparedStatement
- 抛出:
SQLException- If an error occurs
-
initQuery
protected void initQuery()
- 覆盖:
initQuery在类中ClientPreparedStatement
-
toString
public String toString()
从类复制的说明:ClientPreparedStatementReturns this PreparedStatement represented as a string.- 覆盖:
toString在类中ClientPreparedStatement- 返回:
- this PreparedStatement represented as a string.
-
addBatch
public void addBatch() throws SQLException- 指定者:
addBatch在接口中PreparedStatement- 覆盖:
addBatch在类中ClientPreparedStatement- 抛出:
SQLException
-
checkClosed
protected JdbcConnection checkClosed()
从类复制的说明:StatementImplChecks if closed() has been called, and throws an exception if so- 覆盖:
checkClosed在类中StatementImpl- 返回:
- connection
-
clearParameters
public void clearParameters()
- 指定者:
clearParameters在接口中PreparedStatement- 覆盖:
clearParameters在类中ClientPreparedStatement
-
setClosed
protected void setClosed(boolean flag)
-
close
public void close() throws SQLException从类复制的说明:StatementImplIn 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. The close method provides this immediate release.Note: 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在接口中AutoCloseable- 指定者:
close在接口中Statement- 覆盖:
close在类中StatementImpl- 抛出:
SQLException- if a database access error occurs
-
executeBatchSerially
protected long[] executeBatchSerially(int batchTimeout) throws SQLException从类复制的说明:ClientPreparedStatementExecutes the current batch of statements by executing them one-by-one.- 覆盖:
executeBatchSerially在类中ClientPreparedStatement- 参数:
batchTimeout- timeout for the batch execution- 返回:
- a list of update counts
- 抛出:
SQLException- if an error occurs
-
executeInternal
protected <M extends Message> ResultSetInternalMethods executeInternal(int maxRowsToRetrieve, M sendPacket, boolean createStreamingResultSet, boolean queryIsSelectOnly, ColumnDefinition metadata, boolean isBatch) throws SQLException
从类复制的说明:ClientPreparedStatementActually execute the prepared statement. This is here so server-side PreparedStatements can re-use most of the code from this class.- 覆盖:
executeInternal在类中ClientPreparedStatement- 类型参数:
M- extendsMessage- 参数:
maxRowsToRetrieve- 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?- 返回:
- the results as a ResultSet
- 抛出:
SQLException- if an error occurs.
-
getBinding
protected BindValue getBinding(int parameterIndex, boolean forLongData) throws SQLException
Returns the structure representing the value that (can be)/(is) bound at the given parameter index.- 参数:
parameterIndex- 1-basedforLongData- is this for a stream?- 返回:
BindValue- 抛出:
SQLException- if a database access error occurs or this method is called on a closed PreparedStatement
-
getMetaData
public ResultSetMetaData getMetaData() throws SQLException
- 指定者:
getMetaData在接口中PreparedStatement- 覆盖:
getMetaData在类中ClientPreparedStatement- 抛出:
SQLException
-
getParameterMetaData
public ParameterMetaData getParameterMetaData() throws SQLException
- 指定者:
getParameterMetaData在接口中PreparedStatement- 覆盖:
getParameterMetaData在类中ClientPreparedStatement- 抛出:
SQLException
-
isNull
public boolean isNull(int paramIndex)
- 指定者:
isNull在接口中JdbcPreparedStatement- 覆盖:
isNull在类中ClientPreparedStatement
-
realClose
public void realClose(boolean calledExplicitly, boolean closeOpenResults) throws SQLException从类复制的说明:StatementImplCloses this statement, and frees resources.- 指定者:
realClose在接口中JdbcPreparedStatement- 覆盖:
realClose在类中ClientPreparedStatement- 参数:
calledExplicitly- was this called from close()?closeOpenResults- should open result sets be closed?- 抛出:
SQLException- if an error occurs
-
rePrepare
protected void rePrepare()
Used by Connection when auto-reconnecting to retrieve 'lost' prepared statements.- 抛出:
CJException- if an error occurs.
-
serverExecute
protected ResultSetInternalMethods serverExecute(int maxRowsToRetrieve, boolean createStreamingResultSet, ColumnDefinition metadata) throws SQLException
Tells the server to execute this prepared statement with the current parameter bindings.- 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 wire- 返回:
- result set
- 抛出:
SQLException- if a database access error occurs or this method is called on a closed PreparedStatement
-
serverPrepare
protected void serverPrepare(String sql) throws SQLException
- 抛出:
SQLException
-
checkBounds
protected void checkBounds(int parameterIndex, int parameterIndexOffset) throws SQLException- 覆盖:
checkBounds在类中ClientPreparedStatement- 抛出:
SQLException
-
setUnicodeStream
@Deprecated public void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException
已过时。- 指定者:
setUnicodeStream在接口中PreparedStatement- 覆盖:
setUnicodeStream在类中ClientPreparedStatement- 抛出:
SQLException
-
setURL
public void setURL(int parameterIndex, URL x) throws SQLException- 指定者:
setURL在接口中PreparedStatement- 覆盖:
setURL在类中ClientPreparedStatement- 抛出:
SQLException
-
getServerStatementId
public long getServerStatementId()
- 覆盖:
getServerStatementId在类中StatementImpl
-
containsOnDuplicateKeyUpdate
protected boolean containsOnDuplicateKeyUpdate()
-
prepareBatchedInsertSQL
protected ClientPreparedStatement prepareBatchedInsertSQL(JdbcConnection localConn, int numBatches) throws SQLException
从类复制的说明:ClientPreparedStatementReturns a prepared statement for the number of batched parameters, used when re-writing batch INSERTs.- 覆盖:
prepareBatchedInsertSQL在类中ClientPreparedStatement- 参数:
localConn- the connection creating this statementnumBatches- number of entries in a batch- 返回:
- new ClientPreparedStatement
- 抛出:
SQLException- if a database access error occurs or this method is called on a closed PreparedStatement
-
setPoolable
public void setPoolable(boolean poolable) throws SQLException- 指定者:
setPoolable在接口中Statement- 覆盖:
setPoolable在类中StatementImpl- 抛出:
SQLException
-
-