public class NativeSession extends CoreSession implements java.io.Serializable
Session.SessionEventListenerautoReconnect, autoReconnectForPools, cacheServerConfiguration, characterEncoding, connectionCreationTimeMillis, disconnectOnExpiredPasswords, exceptionInterceptor, gatherPerfMetrics, hostInfo, log, maintainTimeStats, messageBuilder, NULL_LOGGER, propertySet, protocol, sessionMaxRows| Constructor and Description |
|---|
NativeSession(HostInfo hostInfo,
PropertySet propSet) |
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(Session.SessionEventListener l)
Add listener for this session status changes.
|
void |
buildCollationMapping()
Builds the map needed for 4.1.0 and newer servers that maps field-level
charset/collation info to a java character encoding name.
|
void |
checkClosed() |
void |
checkForCharsetMismatch()
Determines if the database charset is the same as the platform charset
|
void |
clearInputStream() |
boolean |
configureClientCharacterSet(boolean dontCheckServerMatch)
Sets up client character set.
|
void |
connect(HostInfo hi,
java.lang.String user,
java.lang.String password,
java.lang.String database,
int loginTimeout,
TransactionEventHandler transactionManager) |
void |
disableMultiQueries() |
void |
dumpPacketRingBuffer() |
void |
enableMultiQueries() |
<T extends Resultset> |
execSQL(Query callingQuery,
java.lang.String query,
int maxRows,
NativePacketPayload packet,
boolean streamResults,
ProtocolEntityFactory<T,NativePacketPayload> resultSetFactory,
ColumnDefinition cachedMetadata,
boolean isBatch)
Send a query to the server.
|
void |
forceClose()
Clobbers the physical network connection and marks this session as closed.
|
java.util.Timer |
getCancelTimer() |
int |
getCommandCount() |
long |
getConnectionCreationTimeMillis() |
long |
getCurrentTimeNanosOrMillis() |
java.lang.Throwable |
getForceClosedReason() |
java.lang.String |
getIdentifierQuoteString() |
long |
getIdleFor() |
java.io.InputStream |
getLocalInfileInputStream() |
NetworkResources |
getNetworkResources() |
java.lang.String |
getProcessHost() |
NativeProtocol |
getProtocol() |
java.net.SocketAddress |
getRemoteSocketAddress() |
boolean |
getRequiresEscapingEncoder() |
int |
getSessionMaxRows() |
NativePacketPayload |
getSharedSendPacket()
Returns the packet used for sending data (used by PreparedStatement) with position set to 0.
|
long |
getSlowQueryThreshold() |
int |
getSocketTimeout() |
boolean |
hadWarnings() |
void |
invokeCleanupListeners(java.lang.Throwable whyCleanedUp) |
protected void |
invokeNormalCloseListeners() |
<T extends Resultset> |
invokeQueryInterceptorsPost(java.util.function.Supplier<java.lang.String> sql,
Query interceptedQuery,
T originalResultSet,
boolean forceExecute) |
<T extends Resultset> |
invokeQueryInterceptorsPre(java.util.function.Supplier<java.lang.String> sql,
Query interceptedQuery,
boolean forceExecute) |
protected void |
invokeReconnectListeners() |
boolean |
isClosed() |
boolean |
isNeedsPing() |
boolean |
isServerLocal(Session sess) |
boolean |
isSetNeededForAutoCommitMode(boolean autoCommitFlag) |
boolean |
isSSLEstablished() |
void |
loadServerVariables(java.lang.Object syncMutex,
java.lang.String version)
Loads the result of 'SHOW VARIABLES' into the serverVariables field so
that the driver can configure itself.
|
void |
ping(boolean checkForClosedConnection,
int timeoutMillis) |
java.lang.String |
queryServerVariable(java.lang.String varName)
Get the variable value from server.
|
void |
quit()
Log-off of the MySQL server and close the socket.
|
void |
removeListener(Session.SessionEventListener listener)
Remove session listener.
|
NativePacketPayload |
sendCommand(NativePacketPayload queryPacket,
boolean skipCheck,
int timeoutMillis) |
void |
setConnectionCreationTimeMillis(long connectionCreationTimeMillis) |
void |
setForceClosedReason(java.lang.Throwable forceClosedReason) |
void |
setLocalInfileInputStream(java.io.InputStream stream) |
void |
setNeedsPing(boolean needsPing) |
void |
setQueryInterceptors(java.util.List<QueryInterceptor> queryInterceptors) |
void |
setSessionMaxRows(int sessionMaxRows) |
void |
setSessionVariables() |
void |
setSocketTimeout(int milliseconds) |
boolean |
shouldIntercept() |
void |
shutdownServer()
Used by MiniAdmin to shutdown a MySQL server
|
changeUser, getDataStoreMetadata, getExceptionInterceptor, getHostInfo, getLog, getMessageBuilder, getProfilerEventHandler, getPropertySet, getQueryTimingUnits, getServerSession, getThreadId, setExceptionInterceptor, versionMeetsMinimumclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitquery, query, queryAsyncpublic NativeSession(HostInfo hostInfo, PropertySet propSet)
public void connect(HostInfo hi, java.lang.String user, java.lang.String password, java.lang.String database, int loginTimeout, TransactionEventHandler transactionManager) throws java.io.IOException
java.io.IOExceptionpublic NativeProtocol getProtocol()
public void quit()
Sessionquit in interface Sessionquit in class CoreSessionpublic void forceClose()
SessionforceClose in interface SessionforceClose in class CoreSessionpublic void enableMultiQueries()
public void disableMultiQueries()
public boolean isSetNeededForAutoCommitMode(boolean autoCommitFlag)
isSetNeededForAutoCommitMode in interface SessionisSetNeededForAutoCommitMode in class CoreSessionpublic int getSessionMaxRows()
public void setSessionMaxRows(int sessionMaxRows)
public void setQueryInterceptors(java.util.List<QueryInterceptor> queryInterceptors)
public boolean isServerLocal(Session sess)
public void shutdownServer()
public void setSocketTimeout(int milliseconds)
public int getSocketTimeout()
public void checkForCharsetMismatch()
public NativePacketPayload getSharedSendPacket()
public void dumpPacketRingBuffer()
public <T extends Resultset> T invokeQueryInterceptorsPre(java.util.function.Supplier<java.lang.String> sql, Query interceptedQuery, boolean forceExecute)
public <T extends Resultset> T invokeQueryInterceptorsPost(java.util.function.Supplier<java.lang.String> sql, Query interceptedQuery, T originalResultSet, boolean forceExecute)
public boolean shouldIntercept()
public long getCurrentTimeNanosOrMillis()
public final NativePacketPayload sendCommand(NativePacketPayload queryPacket, boolean skipCheck, int timeoutMillis)
public long getSlowQueryThreshold()
public boolean hadWarnings()
public void clearInputStream()
public NetworkResources getNetworkResources()
public boolean isSSLEstablished()
isSSLEstablished in interface SessionisSSLEstablished in class CoreSessionpublic int getCommandCount()
public java.net.SocketAddress getRemoteSocketAddress()
getRemoteSocketAddress in interface SessiongetRemoteSocketAddress in class CoreSessionpublic java.io.InputStream getLocalInfileInputStream()
public void setLocalInfileInputStream(java.io.InputStream stream)
public boolean configureClientCharacterSet(boolean dontCheckServerMatch)
dontCheckServerMatch - if true then send the SET NAMES query even if server charset already matches the new valueCJException - if an exception happens while sending 'SET NAMES' to the
server, or the server sends character set information that
the client doesn't know about.public boolean getRequiresEscapingEncoder()
public void loadServerVariables(java.lang.Object syncMutex,
java.lang.String version)
syncMutex - synchronization mutexversion - driver version stringpublic void setSessionVariables()
public void buildCollationMapping()
public java.lang.String getProcessHost()
getProcessHost in interface Sessionpublic java.lang.String queryServerVariable(java.lang.String varName)
varName - server variable namepublic <T extends Resultset> T execSQL(Query callingQuery, java.lang.String query, int maxRows, NativePacketPayload packet, boolean streamResults, ProtocolEntityFactory<T,NativePacketPayload> resultSetFactory, ColumnDefinition cachedMetadata, boolean isBatch)
T - extends ResultsetcallingQuery - Query objectquery - 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 querypublic long getIdleFor()
public boolean isNeedsPing()
public void setNeedsPing(boolean needsPing)
public void ping(boolean checkForClosedConnection,
int timeoutMillis)
public long getConnectionCreationTimeMillis()
public void setConnectionCreationTimeMillis(long connectionCreationTimeMillis)
public void checkClosed()
public java.lang.Throwable getForceClosedReason()
public void setForceClosedReason(java.lang.Throwable forceClosedReason)
public void addListener(Session.SessionEventListener l)
SessionaddListener in interface SessionaddListener in class CoreSessionl - Session.SessionEventListener instance.public void removeListener(Session.SessionEventListener listener)
SessionremoveListener in interface SessionremoveListener in class CoreSessionlistener - Session.SessionEventListener instance.protected void invokeNormalCloseListeners()
protected void invokeReconnectListeners()
public void invokeCleanupListeners(java.lang.Throwable whyCleanedUp)
public java.lang.String getIdentifierQuoteString()
getIdentifierQuoteString in interface SessiongetIdentifierQuoteString in class CoreSessionpublic java.util.Timer getCancelTimer()