public abstract class AbstractConnectProtocol extends Object implements Protocol
Modifier and Type | Field and Description |
---|---|
Results |
activeStreamingResult |
protected int |
autoIncrementIncrement |
protected boolean |
connected |
protected String |
database |
protected boolean |
eofDeprecated |
protected boolean |
explicitClosed |
boolean |
hasWarnings |
protected ReentrantLock |
lock |
protected Options |
options |
protected FailoverProxy |
proxy |
protected PacketInputStream |
reader |
protected boolean |
readOnly |
protected long |
serverCapabilities |
protected ServerPrepareStatementCache |
serverPrepareStatementCache |
short |
serverStatus |
protected long |
serverThreadId |
protected Socket |
socket |
protected int |
socketTimeout |
protected UrlParser |
urlParser |
protected PacketOutputStream |
writer |
Constructor and Description |
---|
AbstractConnectProtocol(UrlParser urlParser,
GlobalStateInfo globalInfo,
ReentrantLock lock)
Get a protocol instance.
|
Modifier and Type | Method and Description |
---|---|
void |
abort()
Force closes socket and stream readers/writers.
|
void |
changeSocketSoTimeout(int setSoTimeout) |
void |
changeSocketTcpNoDelay(boolean setTcpNoDelay)
Change Socket TcpNoDelay option.
|
boolean |
checkIfMaster()
Check that current connection is a master connection (not read-only).
|
void |
close()
Closes socket and stream readers/writers Attempts graceful shutdown.
|
void |
connect()
Connect to currentHost.
|
void |
connectWithoutProxy()
Connect without proxy.
|
void |
destroySocket()
Closing socket in case of Connection error after socket creation.
|
abstract void |
executeQuery(String sql) |
Results |
getActiveStreamingResult() |
String |
getDatabase() |
String |
getHost() |
HostAddress |
getHostAddress() |
ReentrantLock |
getLock() |
int |
getMajorServerVersion() |
int |
getMinorServerVersion() |
Options |
getOptions() |
boolean |
getPinGlobalTxToPhysicalConnection() |
int |
getPort() |
FailoverProxy |
getProxy() |
PacketInputStream |
getReader() |
boolean |
getReadonly() |
long |
getServerThreadId() |
String |
getServerVersion() |
Socket |
getSocket() |
TimeZone |
getTimeZone() |
String |
getTraces()
Get a String containing readable information about last 10 send/received packets.
|
UrlParser |
getUrlParser() |
String |
getUsername() |
PacketOutputStream |
getWriter() |
boolean |
hasMoreResults() |
boolean |
hasWarnings()
Has warnings.
|
boolean |
isClosed()
Is the connection closed.
|
boolean |
isConnected()
Is connected.
|
boolean |
isEofDeprecated() |
boolean |
isExplicitClosed() |
boolean |
isMasterConnection()
Indicate if current protocol is a master protocol.
|
boolean |
isServerMariaDb() |
boolean |
mustBeMasterConnection() |
boolean |
noBackslashEscapes() |
ServerPrepareStatementCache |
prepareStatementCache() |
void |
readEofPacket()
Check that next read packet is a End-of-file packet.
|
void |
readPipelineCheckMaster() |
void |
removeActiveStreamingResult()
Remove exception result and since totally fetched, set fetch size to 0.
|
void |
removeHasMoreResults()
Remove flag has more results.
|
boolean |
sessionStateAware() |
void |
setActiveStreamingResult(Results activeStreamingResult) |
void |
setHasWarnings(boolean hasWarnings) |
void |
setHostAddress(HostAddress host) |
void |
setHostFailedWithoutProxy() |
void |
setProxy(FailoverProxy proxy) |
void |
setReadonly(boolean readOnly) |
void |
setServerStatus(short serverStatus) |
boolean |
shouldReconnectWithoutProxy()
Indicate for Old reconnection if can reconnect without throwing exception.
|
void |
skip()
Skip packets not read that are not needed.
|
void |
skipEofPacket()
Check that next read packet is a End-of-file packet.
|
boolean |
versionGreaterOrEqual(int major,
int minor,
int patch)
Utility method to check if database version is greater than parameters.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addPrepareInCache, cancelCurrentQuery, closeExplicit, executeBatchClient, executeBatchServer, executeBatchStmt, executePreparedQuery, executeQuery, executeQuery, executeQuery, executeQuery, forceReleasePrepareStatement, forceReleaseWaitingPrepareStatement, getAutocommit, getAutoIncrementIncrement, getCatalog, getMaxRows, getResult, getTimeout, getTransactionIsolationLevel, handleIoException, interrupt, inTransaction, isInterrupted, isValid, ping, prepare, prolog, prologProxy, releasePrepareStatement, reset, resetDatabase, resetStateAfterFailover, rollback, setActiveFutureTask, setCatalog, setLocalInfileInputStream, setMaxRows, setTimeout, setTransactionIsolation, stopIfInterrupted
protected final ReentrantLock lock
protected final UrlParser urlParser
protected final Options options
public boolean hasWarnings
public Results activeStreamingResult
public short serverStatus
protected int autoIncrementIncrement
protected Socket socket
protected PacketOutputStream writer
protected boolean readOnly
protected PacketInputStream reader
protected FailoverProxy proxy
protected volatile boolean connected
protected boolean explicitClosed
protected String database
protected long serverThreadId
protected ServerPrepareStatementCache serverPrepareStatementCache
protected boolean eofDeprecated
protected long serverCapabilities
protected int socketTimeout
public AbstractConnectProtocol(UrlParser urlParser, GlobalStateInfo globalInfo, ReentrantLock lock)
urlParser
- connection URL informationglobalInfo
- server global variables informationlock
- the lock for thread synchronisationpublic void close()
public void abort()
public void skip() throws SQLException
skip
in interface Protocol
SQLException
- exceptionpublic void setServerStatus(short serverStatus)
setServerStatus
in interface Protocol
public void removeHasMoreResults()
removeHasMoreResults
in interface Protocol
public void connect() throws SQLException
connect
in interface Protocol
SQLException
- exceptionpublic void destroySocket()
public boolean isClosed()
public boolean checkIfMaster() throws SQLException
checkIfMaster
in interface Protocol
SQLException
- if requesting infos for server fail.public void readEofPacket() throws SQLException, IOException
readEofPacket
in interface Protocol
SQLException
- if not a End-of-file packetIOException
- if connection error occurpublic void skipEofPacket() throws SQLException, IOException
skipEofPacket
in interface Protocol
SQLException
- if not a End-of-file packetIOException
- if connection error occurpublic void setHostFailedWithoutProxy()
setHostFailedWithoutProxy
in interface Protocol
public UrlParser getUrlParser()
getUrlParser
in interface Protocol
public boolean isMasterConnection()
isMasterConnection
in interface Protocol
public void readPipelineCheckMaster() throws SQLException
SQLException
public boolean mustBeMasterConnection()
mustBeMasterConnection
in interface Protocol
public boolean noBackslashEscapes()
noBackslashEscapes
in interface Protocol
public void connectWithoutProxy() throws SQLException
connectWithoutProxy
in interface Protocol
SQLException
- exceptionpublic boolean shouldReconnectWithoutProxy()
shouldReconnectWithoutProxy
in interface Protocol
public String getServerVersion()
getServerVersion
in interface Protocol
public boolean getReadonly()
getReadonly
in interface Protocol
public void setReadonly(boolean readOnly)
setReadonly
in interface Protocol
public HostAddress getHostAddress()
getHostAddress
in interface Protocol
public void setHostAddress(HostAddress host)
setHostAddress
in interface Protocol
public FailoverProxy getProxy()
public void setProxy(FailoverProxy proxy)
public String getDatabase()
getDatabase
in interface Protocol
public String getUsername()
getUsername
in interface Protocol
public int getMajorServerVersion()
getMajorServerVersion
in interface Protocol
public int getMinorServerVersion()
getMinorServerVersion
in interface Protocol
public boolean versionGreaterOrEqual(int major, int minor, int patch)
versionGreaterOrEqual
in interface Protocol
major
- major versionminor
- minor versionpatch
- patch versionpublic boolean getPinGlobalTxToPhysicalConnection()
getPinGlobalTxToPhysicalConnection
in interface Protocol
public boolean hasWarnings()
hasWarnings
in interface Protocol
public boolean isConnected()
isConnected
in interface Protocol
public long getServerThreadId()
getServerThreadId
in interface Protocol
public boolean isExplicitClosed()
isExplicitClosed
in interface Protocol
public TimeZone getTimeZone()
getTimeZone
in interface Protocol
public Options getOptions()
getOptions
in interface Protocol
public void setHasWarnings(boolean hasWarnings)
setHasWarnings
in interface Protocol
public Results getActiveStreamingResult()
getActiveStreamingResult
in interface Protocol
public void setActiveStreamingResult(Results activeStreamingResult)
setActiveStreamingResult
in interface Protocol
public void removeActiveStreamingResult()
removeActiveStreamingResult
in interface Protocol
public ReentrantLock getLock()
public boolean hasMoreResults()
hasMoreResults
in interface Protocol
public ServerPrepareStatementCache prepareStatementCache()
prepareStatementCache
in interface Protocol
public abstract void executeQuery(String sql) throws SQLException
executeQuery
in interface Protocol
SQLException
public void changeSocketTcpNoDelay(boolean setTcpNoDelay)
changeSocketTcpNoDelay
in interface Protocol
setTcpNoDelay
- value to set.public void changeSocketSoTimeout(int setSoTimeout) throws SocketException
changeSocketSoTimeout
in interface Protocol
SocketException
public boolean isServerMariaDb()
isServerMariaDb
in interface Protocol
public PacketInputStream getReader()
public PacketOutputStream getWriter()
public boolean isEofDeprecated()
isEofDeprecated
in interface Protocol
public boolean sessionStateAware()
sessionStateAware
in interface Protocol
Copyright © 2019 mariadb.org. All rights reserved.