public abstract class AbstractConnectProtocol extends Object implements Protocol
Modifier and Type | Field and Description |
---|---|
MariaSelectResultSet |
activeResult |
protected MariaDbCharset |
charset |
protected boolean |
connected |
protected HostAddress |
currentHost |
protected String |
database |
int |
dataTypeMappingFlags |
protected boolean |
explicitClosed |
boolean |
hasWarnings |
protected ReentrantLock |
lock |
boolean |
moreResultsTypeBinary |
protected ReadPacketFetcher |
packetFetcher |
protected PrepareStatementCache |
prepareStatementCache |
protected FailoverProxy |
proxy |
protected boolean |
readOnly |
short |
serverStatus |
protected long |
serverThreadId |
protected Socket |
socket |
protected UrlParser |
urlParser |
protected PacketOutputStream |
writer |
Constructor and Description |
---|
AbstractConnectProtocol(UrlParser urlParser,
ReentrantLock lock)
Get a protocol instance.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
cancelCurrentQuery, closeExplicit, closeIfActiveResult, closePreparedStatement, executeMultiQueries, executePreparedQuery, executePreparedQueryAfterFailover, executeQueries, executeQuery, forceReleasePrepareStatement, getAutocommit, getMaxRows, getResult, getTimeout, getTransactionIsolationLevel, hasUnreadData, inTransaction, ping, prepare, prepareStatementCache, releasePrepareStatement, rollback, setCatalog, setInternalMaxRows, setLocalInfileInputStream, setMaxRows, setTimeout, setTransactionIsolation
protected final ReentrantLock lock
protected final UrlParser urlParser
protected Socket socket
protected PacketOutputStream writer
protected boolean readOnly
protected ReadPacketFetcher packetFetcher
protected HostAddress currentHost
protected FailoverProxy proxy
protected volatile boolean connected
protected boolean explicitClosed
protected String database
protected long serverThreadId
protected MariaDbCharset charset
protected PrepareStatementCache prepareStatementCache
public boolean moreResultsTypeBinary
public boolean hasWarnings
public MariaSelectResultSet activeResult
public int dataTypeMappingFlags
public short serverStatus
public AbstractConnectProtocol(UrlParser urlParser, ReentrantLock lock)
urlParser
- connection URL infoslock
- the lock for thread synchronisationpublic void skip() throws SQLException, QueryException
skip
in interface Protocol
QueryException
- exceptionSQLException
public abstract void getMoreResults(ExecutionResult executionResult) throws QueryException
getMoreResults
in interface Protocol
QueryException
public void setMoreResults(boolean moreResults, boolean isBinary)
setMoreResults
in interface Protocol
public void resetMoreResults()
public void close()
protected static void close(ReadPacketFetcher fetcher, PacketOutputStream packetOutputStream, Socket socket) throws QueryException
QueryException
public void connect() throws QueryException
connect
in interface Protocol
QueryException
- exceptionpublic boolean isClosed()
public String getServerData(String code)
getServerData
in interface Protocol
public boolean checkIfMaster() throws QueryException
checkIfMaster
in interface Protocol
QueryException
public void readEofPacket() throws QueryException, IOException
QueryException
- 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 boolean mustBeMasterConnection()
mustBeMasterConnection
in interface Protocol
public boolean noBackslashEscapes()
noBackslashEscapes
in interface Protocol
public void connectWithoutProxy() throws QueryException
connectWithoutProxy
in interface Protocol
QueryException
- 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 String getPassword()
getPassword
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 int getDataTypeMappingFlags()
getDataTypeMappingFlags
in interface Protocol
public boolean isExplicitClosed()
isExplicitClosed
in interface Protocol
public Calendar getCalendar()
getCalendar
in interface Protocol
public Options getOptions()
getOptions
in interface Protocol
public abstract ExecutionResult executeQuery(Query query) throws QueryException
executeQuery
in interface Protocol
QueryException
public void setHasWarnings(boolean hasWarnings)
setHasWarnings
in interface Protocol
public MariaSelectResultSet getActiveResult()
getActiveResult
in interface Protocol
public void setActiveResult(MariaSelectResultSet activeResult)
setActiveResult
in interface Protocol
public ReentrantLock getLock()
public boolean hasMoreResults()
hasMoreResults
in interface Protocol
public PrepareStatementCache getPrepareStatementCache()
Copyright © 2016. All rights reserved.