public class AbstractQueryProtocol extends AbstractConnectProtocol implements Protocol
activeResult, charset, connected, currentHost, database, dataTypeMappingFlags, explicitClosed, hasWarnings, lock, moreResultsTypeBinary, packetFetcher, prepareStatementCache, proxy, readOnly, serverStatus, serverThreadId, socket, urlParser, writer| Constructor and Description |
|---|
AbstractQueryProtocol(UrlParser urlParser,
ReentrantLock lock)
Get a protocol instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
cancelCurrentQuery()
Cancels the current query - clones the current protocol and executes a query using the new connection.
|
void |
closeExplicit() |
void |
closeIfActiveResult()
Close active result.
|
void |
closePreparedStatement(int statementId) |
void |
executeMultiQueries(Deque<Query> queries,
ExecutionResult executionResult,
int resultSetScrollType,
boolean isRewritable,
int rewriteOffset)
Execute list of queries.
|
void |
executePreparedQuery(String sql,
ExecutionResult executionResult,
ParameterHolder[] parameters,
PrepareResult prepareResult,
MariaDbType[] parameterTypeHeader,
int resultSetScrollType) |
void |
executePreparedQueryAfterFailover(String sql,
ExecutionResult executionResult,
ParameterHolder[] parameters,
PrepareResult prepareResult,
MariaDbType[] parameterTypeHeader,
int resultSetScrollType) |
void |
executeQueries(Deque<Query> queries,
ExecutionResult executionResult,
int resultSetScrollType)
Execute list of queries one by one
This method is used when using text batch statement and using rewriting (allowMultiQueries || rewriteBatchedStatements).
|
ExecutionResult |
executeQuery(Query query)
Execute query.
|
void |
executeQuery(Query query,
ExecutionResult executionResult,
int resultSetScrollType,
int fetchSize)
Execute Query.
|
void |
forceReleasePrepareStatement(int statementId)
Force release of prepare statement that are not used.
|
boolean |
getAutocommit() |
int |
getMaxRows() |
void |
getMoreResults(ExecutionResult executionResult) |
void |
getResult(ExecutionResult executionResult,
int resultSetScrollType,
boolean binaryProtocol)
Fetch result.
|
int |
getTimeout()
Returns the connection timeout in milliseconds.
|
int |
getTransactionIsolationLevel() |
boolean |
hasUnreadData() |
static String |
hexdump(byte[] buffer,
int offset)
Hexdump.
|
static String |
hexdump(ByteBuffer bb,
int offset)
Hexdump.
|
boolean |
inTransaction() |
boolean |
ping() |
PrepareResult |
prepare(String sql) |
PrepareStatementCache |
prepareStatementCache() |
void |
releasePrepareStatement(String sql,
int statementId) |
void |
rollback()
Rollback transaction.
|
void |
setCatalog(String database) |
void |
setInternalMaxRows(int max)
Set max row retuen by a statement.
|
void |
setLocalInfileInputStream(InputStream inputStream) |
void |
setMaxRows(int max) |
void |
setTimeout(int timeout)
Sets the connection timeout.
|
void |
setTransactionIsolation(int level)
Set transaction isolation.
|
checkIfMaster, close, close, connect, connectWithoutProxy, getActiveResult, getCalendar, getDatabase, getDataTypeMappingFlags, getHost, getHostAddress, getLock, getMajorServerVersion, getMinorServerVersion, getOptions, getPassword, getPinGlobalTxToPhysicalConnection, getPort, getPrepareStatementCache, getProxy, getReadonly, getServerData, getServerThreadId, getServerVersion, getUrlParser, getUsername, hasMoreResults, hasWarnings, isClosed, isConnected, isExplicitClosed, isMasterConnection, mustBeMasterConnection, noBackslashEscapes, readEofPacket, resetMoreResults, setActiveResult, setHasWarnings, setHostAddress, setHostFailedWithoutProxy, setMoreResults, setProxy, setReadonly, shouldReconnectWithoutProxy, skip, versionGreaterOrEqualclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcheckIfMaster, close, connect, connectWithoutProxy, getActiveResult, getCalendar, getDatabase, getDataTypeMappingFlags, getHost, getHostAddress, getLock, getMajorServerVersion, getMinorServerVersion, getOptions, getPassword, getPinGlobalTxToPhysicalConnection, getPort, getProxy, getReadonly, getServerData, getServerThreadId, getServerVersion, getUrlParser, getUsername, hasMoreResults, hasWarnings, isClosed, isConnected, isExplicitClosed, isMasterConnection, mustBeMasterConnection, noBackslashEscapes, setActiveResult, setHasWarnings, setHostAddress, setHostFailedWithoutProxy, setMoreResults, setProxy, setReadonly, shouldReconnectWithoutProxy, skip, versionGreaterOrEqualpublic AbstractQueryProtocol(UrlParser urlParser, ReentrantLock lock)
urlParser - connection URL infoslock - the lock for thread synchronisationpublic static String hexdump(byte[] buffer, int offset)
buffer - byte arrayoffset - offsetpublic static String hexdump(ByteBuffer bb, int offset)
bb - bytebufferoffset - offsetpublic PrepareResult prepare(String sql) throws QueryException
prepare in interface ProtocolQueryExceptionpublic void closePreparedStatement(int statementId)
throws QueryException
closePreparedStatement in interface ProtocolQueryExceptionpublic boolean getAutocommit()
getAutocommit in interface Protocolpublic boolean inTransaction()
inTransaction in interface Protocolpublic void closeExplicit()
closeExplicit in interface Protocolpublic void setCatalog(String database) throws QueryException
setCatalog in interface ProtocolQueryExceptionpublic boolean ping()
throws QueryException
ping in interface ProtocolQueryExceptionpublic ExecutionResult executeQuery(Query query) throws QueryException
executeQuery in interface ProtocolexecuteQuery in class AbstractConnectProtocolquery - the query to executeQueryException - exceptionpublic void executeQuery(Query query, ExecutionResult executionResult, int resultSetScrollType, int fetchSize) throws QueryException
executeQuery in interface Protocolquery - queryexecutionResult - resultresultSetScrollType - one of the following ResultSet constants: ResultSet.TYPE_FORWARD_ONLY,
ResultSet.TYPE_SCROLL_INSENSITIVE, or ResultSet.TYPE_SCROLL_SENSITIVEQueryException - if error occurpublic void executeMultiQueries(Deque<Query> queries, ExecutionResult executionResult, int resultSetScrollType, boolean isRewritable, int rewriteOffset) throws QueryException
executeMultiQueries in interface Protocolqueries - list of queryesexecutionResult - resultresultSetScrollType - one of the following ResultSet constants: ResultSet.TYPE_FORWARD_ONLY,
ResultSet.TYPE_SCROLL_INSENSITIVE, or ResultSet.TYPE_SCROLL_SENSITIVEisRewritable - is rewritable flagrewriteOffset - rewrite offsetQueryException - exceptionpublic void executeQueries(Deque<Query> queries, ExecutionResult executionResult, int resultSetScrollType) throws QueryException
executeQueries in interface Protocolqueries - list of queriesexecutionResult - resultresultSetScrollType - one of the following ResultSet constants: ResultSet.TYPE_FORWARD_ONLY,
ResultSet.TYPE_SCROLL_INSENSITIVE, or ResultSet.TYPE_SCROLL_SENSITIVEQueryException - exceptionpublic void getResult(ExecutionResult executionResult, int resultSetScrollType, boolean binaryProtocol) throws QueryException
getResult in interface ProtocolexecutionResult - resultresultSetScrollType - one of the following ResultSet constants: ResultSet.TYPE_FORWARD_ONLY,
ResultSet.TYPE_SCROLL_INSENSITIVE, or ResultSet.TYPE_SCROLL_SENSITIVEbinaryProtocol - is binary protocolQueryException - id any exception occurpublic void executePreparedQueryAfterFailover(String sql, ExecutionResult executionResult, ParameterHolder[] parameters, PrepareResult prepareResult, MariaDbType[] parameterTypeHeader, int resultSetScrollType) throws QueryException
executePreparedQueryAfterFailover in interface ProtocolQueryExceptionpublic void executePreparedQuery(String sql, ExecutionResult executionResult, ParameterHolder[] parameters, PrepareResult prepareResult, MariaDbType[] parameterTypeHeader, int resultSetScrollType) throws QueryException
executePreparedQuery in interface ProtocolQueryExceptionpublic void releasePrepareStatement(String sql, int statementId) throws QueryException
releasePrepareStatement in interface ProtocolQueryExceptionpublic void forceReleasePrepareStatement(int statementId)
throws QueryException
forceReleasePrepareStatement in interface ProtocolstatementId - prepared statement Id to remove.QueryException - if connection exception.public void cancelCurrentQuery()
throws QueryException,
IOException
cancelCurrentQuery in interface ProtocolQueryException - never thrownIOException - if Host is not respondingpublic void getMoreResults(ExecutionResult executionResult) throws QueryException
getMoreResults in interface ProtocolgetMoreResults in class AbstractConnectProtocolQueryExceptionpublic boolean hasUnreadData()
hasUnreadData in interface Protocolpublic void setInternalMaxRows(int max)
setInternalMaxRows in interface Protocolmax - row number max valuepublic int getMaxRows()
getMaxRows in interface Protocolpublic void setMaxRows(int max)
throws QueryException
setMaxRows in interface ProtocolQueryExceptionpublic void setLocalInfileInputStream(InputStream inputStream)
setLocalInfileInputStream in interface Protocolpublic int getTimeout()
throws SocketException
getTimeout in interface ProtocolSocketException - if there is an error in the underlying protocol, such as a TCP error.public void setTimeout(int timeout)
throws SocketException
setTimeout in interface Protocoltimeout - the timeout, in millisecondsSocketException - if there is an error in the underlying protocol, such as a TCP error.public void setTransactionIsolation(int level)
throws QueryException
setTransactionIsolation in interface Protocollevel - transaction level.QueryException - if transaction level is unknownpublic int getTransactionIsolationLevel()
getTransactionIsolationLevel in interface Protocolpublic void closeIfActiveResult()
throws SQLException
closeIfActiveResult in interface ProtocolSQLExceptionpublic PrepareStatementCache prepareStatementCache()
prepareStatementCache in interface ProtocolCopyright © 2016. All rights reserved.