程序包 com.mysql.cj
类 NativeSession
- java.lang.Object
-
- com.mysql.cj.CoreSession
-
- com.mysql.cj.NativeSession
-
- 所有已实现的接口:
Session,Serializable
public class NativeSession extends CoreSession implements Serializable
- 另请参阅:
- 序列化表格
-
-
嵌套类概要
-
从接口继承的嵌套类/接口 com.mysql.cj.Session
Session.SessionEventListener
-
-
字段概要
-
从类继承的字段 com.mysql.cj.CoreSession
autoReconnect, autoReconnectForPools, cacheServerConfiguration, characterEncoding, connectionCreationTimeMillis, disconnectOnExpiredPasswords, exceptionInterceptor, gatherPerfMetrics, hostInfo, log, maintainTimeStats, messageBuilder, NULL_LOGGER, propertySet, protocol, sessionMaxRows
-
-
构造器概要
构造器 构造器 说明 NativeSession(HostInfo hostInfo, PropertySet propSet)
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 voidaddListener(Session.SessionEventListener l)Add listener for this session status changes.voidcheckClosed()voidclearInputStream()voidconnect(HostInfo hi, String user, String password, String database, int loginTimeout, TransactionEventHandler transactionManager)voiddisableMultiQueries()voiddumpPacketRingBuffer()voidenableMultiQueries()<T extends Resultset>
TexecSQL(Query callingQuery, String query, int maxRows, NativePacketPayload packet, boolean streamResults, ProtocolEntityFactory<T,NativePacketPayload> resultSetFactory, ColumnDefinition cachedMetadata, boolean isBatch)Send a query to the server.voidforceClose()Clobbers the physical network connection and marks this session as closed.TimergetCancelTimer()intgetCommandCount()longgetConnectionCreationTimeMillis()longgetCurrentTimeNanosOrMillis()ThrowablegetForceClosedReason()StringgetIdentifierQuoteString()longgetIdleFor()InputStreamgetLocalInfileInputStream()NetworkResourcesgetNetworkResources()StringgetProcessHost()NativeProtocolgetProtocol()SocketAddressgetRemoteSocketAddress()intgetSessionMaxRows()NativePacketPayloadgetSharedSendPacket()Returns the packet used for sending data (used by PreparedStatement) with position set to 0.longgetSlowQueryThreshold()intgetSocketTimeout()booleanhadWarnings()voidinvokeCleanupListeners(Throwable whyCleanedUp)protected voidinvokeNormalCloseListeners()<T extends Resultset>
TinvokeQueryInterceptorsPost(java.util.function.Supplier<String> sql, Query interceptedQuery, T originalResultSet, boolean forceExecute)<T extends Resultset>
TinvokeQueryInterceptorsPre(java.util.function.Supplier<String> sql, Query interceptedQuery, boolean forceExecute)protected voidinvokeReconnectListeners()booleanisClosed()booleanisNeedsPing()booleanisServerLocal(Session sess)booleanisSetNeededForAutoCommitMode(boolean autoCommitFlag)booleanisSSLEstablished()voidloadServerVariables(Object syncMutex, String version)Loads the result of 'SHOW VARIABLES' into the serverVariables field so that the driver can configure itself.voidping(boolean checkForClosedConnection, int timeoutMillis)StringqueryServerVariable(String varName)Get the variable value from server.voidquit()Log-off of the MySQL server and close the socket.voidremoveListener(Session.SessionEventListener listener)Remove session listener.voidsetConnectionCreationTimeMillis(long connectionCreationTimeMillis)voidsetForceClosedReason(Throwable forceClosedReason)voidsetLocalInfileInputStream(InputStream stream)voidsetNeedsPing(boolean needsPing)voidsetQueryInterceptors(List<QueryInterceptor> queryInterceptors)voidsetSessionMaxRows(int sessionMaxRows)voidsetSessionVariables()voidsetSocketTimeout(int milliseconds)booleanshouldIntercept()voidshutdownServer()Used by MiniAdmin to shutdown a MySQL server-
从类继承的方法 com.mysql.cj.CoreSession
changeUser, getDataStoreMetadata, getExceptionInterceptor, getHostInfo, getLog, getMessageBuilder, getProfilerEventHandler, getPropertySet, getQueryTimingUnits, getServerSession, getThreadId, setExceptionInterceptor, versionMeetsMinimum
-
从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
从接口继承的方法 com.mysql.cj.Session
query, query, queryAsync
-
-
-
-
构造器详细资料
-
NativeSession
public NativeSession(HostInfo hostInfo, PropertySet propSet)
-
-
方法详细资料
-
connect
public void connect(HostInfo hi, String user, String password, String database, int loginTimeout, TransactionEventHandler transactionManager) throws IOException
- 抛出:
IOException
-
getProtocol
public NativeProtocol getProtocol()
-
quit
public void quit()
从接口复制的说明:SessionLog-off of the MySQL server and close the socket.- 指定者:
quit在接口中Session- 覆盖:
quit在类中CoreSession
-
forceClose
public void forceClose()
从接口复制的说明:SessionClobbers the physical network connection and marks this session as closed.- 指定者:
forceClose在接口中Session- 覆盖:
forceClose在类中CoreSession
-
enableMultiQueries
public void enableMultiQueries()
-
disableMultiQueries
public void disableMultiQueries()
-
isSetNeededForAutoCommitMode
public boolean isSetNeededForAutoCommitMode(boolean autoCommitFlag)
- 指定者:
isSetNeededForAutoCommitMode在接口中Session- 覆盖:
isSetNeededForAutoCommitMode在类中CoreSession
-
getSessionMaxRows
public int getSessionMaxRows()
-
setSessionMaxRows
public void setSessionMaxRows(int sessionMaxRows)
-
setQueryInterceptors
public void setQueryInterceptors(List<QueryInterceptor> queryInterceptors)
-
isServerLocal
public boolean isServerLocal(Session sess)
-
shutdownServer
public void shutdownServer()
Used by MiniAdmin to shutdown a MySQL server
-
setSocketTimeout
public void setSocketTimeout(int milliseconds)
-
getSocketTimeout
public int getSocketTimeout()
-
getSharedSendPacket
public NativePacketPayload getSharedSendPacket()
Returns the packet used for sending data (used by PreparedStatement) with position set to 0. Guarded by external synchronization on a mutex.- 返回:
- A packet to send data with
-
dumpPacketRingBuffer
public void dumpPacketRingBuffer()
-
invokeQueryInterceptorsPre
public <T extends Resultset> T invokeQueryInterceptorsPre(java.util.function.Supplier<String> sql, Query interceptedQuery, boolean forceExecute)
-
invokeQueryInterceptorsPost
public <T extends Resultset> T invokeQueryInterceptorsPost(java.util.function.Supplier<String> sql, Query interceptedQuery, T originalResultSet, boolean forceExecute)
-
shouldIntercept
public boolean shouldIntercept()
-
getCurrentTimeNanosOrMillis
public long getCurrentTimeNanosOrMillis()
-
getSlowQueryThreshold
public long getSlowQueryThreshold()
-
hadWarnings
public boolean hadWarnings()
-
clearInputStream
public void clearInputStream()
-
getNetworkResources
public NetworkResources getNetworkResources()
-
isSSLEstablished
public boolean isSSLEstablished()
- 指定者:
isSSLEstablished在接口中Session- 覆盖:
isSSLEstablished在类中CoreSession
-
getCommandCount
public int getCommandCount()
-
getRemoteSocketAddress
public SocketAddress getRemoteSocketAddress()
- 指定者:
getRemoteSocketAddress在接口中Session- 覆盖:
getRemoteSocketAddress在类中CoreSession
-
getLocalInfileInputStream
public InputStream getLocalInfileInputStream()
-
setLocalInfileInputStream
public void setLocalInfileInputStream(InputStream stream)
-
loadServerVariables
public void loadServerVariables(Object syncMutex, String version)
Loads the result of 'SHOW VARIABLES' into the serverVariables field so that the driver can configure itself.- 参数:
syncMutex- synchronization mutexversion- driver version string
-
setSessionVariables
public void setSessionVariables()
-
getProcessHost
public String getProcessHost()
- 指定者:
getProcessHost在接口中Session
-
queryServerVariable
public String queryServerVariable(String varName)
Get the variable value from server.- 参数:
varName- server variable name- 返回:
- server variable value
-
execSQL
public <T extends Resultset> T execSQL(Query callingQuery, String query, int maxRows, NativePacketPayload packet, boolean streamResults, ProtocolEntityFactory<T,NativePacketPayload> resultSetFactory, ColumnDefinition cachedMetadata, boolean isBatch)
Send a query to the server. Returns one of the ResultSet objects. To ensure that Statement's queries are serialized, calls to this method should be enclosed in a connection mutex synchronized block.- 类型参数:
T- extendsResultset- 参数:
callingQuery-Queryobjectquery- the SQL statement to be executedmaxRows- rows limitpacket-NativePacketPayloadstreamResults- whether a stream result should be createdresultSetFactory-ProtocolEntityFactorycachedMetadata- use this metadata instead of the one provided on wireisBatch- is it a batch query- 返回:
- a ResultSet holding the results
-
getIdleFor
public long getIdleFor()
-
isNeedsPing
public boolean isNeedsPing()
-
setNeedsPing
public void setNeedsPing(boolean needsPing)
-
ping
public void ping(boolean checkForClosedConnection, int timeoutMillis)
-
getConnectionCreationTimeMillis
public long getConnectionCreationTimeMillis()
-
setConnectionCreationTimeMillis
public void setConnectionCreationTimeMillis(long connectionCreationTimeMillis)
-
checkClosed
public void checkClosed()
-
getForceClosedReason
public Throwable getForceClosedReason()
-
setForceClosedReason
public void setForceClosedReason(Throwable forceClosedReason)
-
addListener
public void addListener(Session.SessionEventListener l)
从接口复制的说明:SessionAdd listener for this session status changes.- 指定者:
addListener在接口中Session- 覆盖:
addListener在类中CoreSession- 参数:
l-Session.SessionEventListenerinstance.
-
removeListener
public void removeListener(Session.SessionEventListener listener)
从接口复制的说明:SessionRemove session listener.- 指定者:
removeListener在接口中Session- 覆盖:
removeListener在类中CoreSession- 参数:
listener-Session.SessionEventListenerinstance.
-
invokeNormalCloseListeners
protected void invokeNormalCloseListeners()
-
invokeReconnectListeners
protected void invokeReconnectListeners()
-
invokeCleanupListeners
public void invokeCleanupListeners(Throwable whyCleanedUp)
-
getIdentifierQuoteString
public String getIdentifierQuoteString()
- 指定者:
getIdentifierQuoteString在接口中Session- 覆盖:
getIdentifierQuoteString在类中CoreSession
-
getCancelTimer
public Timer getCancelTimer()
-
-