public class AbstractQueryProtocol extends AbstractConnectProtocol implements Protocol
activeStreamingResult, connected, currentHost, database, dataTypeMappingFlags, explicitClosed, hasWarnings, lock, moreResults, moreResultsTypeBinary, options, 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 |
executePreparedQuery(PrepareResult prepareResult,
ExecutionResult executionResult,
String sql,
ParameterHolder[] parameters,
MariaDbType[] parameterTypeHeader,
int resultSetScrollType) |
void |
executePreparedQueryAfterFailover(PrepareResult oldPrepareResult,
ExecutionResult executionResult,
String sql,
ParameterHolder[] parameters,
MariaDbType[] parameterTypeHeader,
int resultSetScrollType) |
void |
executeQueries(ExecutionResult executionResult,
List<String> queries,
int resultSetScrollType)
Execute list of queries not rewritable.
|
void |
executeQueries(ExecutionResult executionResult,
List<String> queryParts,
List<ParameterHolder[]> parameterList,
int resultSetScrollType,
boolean isRewritable)
Specific execution for batch rewrite that has specific query for memory.
|
void |
executeQueriesRewrite(ExecutionResult executionResult,
List<String> queries,
int resultSetScrollType,
boolean isRewritable,
int rewriteOffset)
Execute list of queries.
|
void |
executeQuery(ExecutionResult executionResult,
String sql,
int resultSetScrollType)
Execute query.
|
void |
executeQuery(String sql) |
void |
fetchActiveStreamingResult()
Close active result.
|
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) |
int |
getTimeout()
Returns the connection timeout in milliseconds.
|
int |
getTransactionIsolationLevel() |
boolean |
hasMoreResults() |
static String |
hexdump(byte[] buffer,
int offset)
Hexdump.
|
boolean |
inTransaction() |
boolean |
ping() |
PrepareResult |
prepare(String sql)
Prepare query on server side.
|
PrepareResult |
prepare(String sql,
boolean forceNew,
boolean executeOnMaster)
Prepare query on server side.
|
PrepareStatementCache |
prepareStatementCache() |
void |
prolog(ExecutionResult executionResult,
int maxRows,
boolean hasProxy,
MariaDbConnection connection,
Statement statement)
Preparation before command.
|
void |
prologProxy(PrepareResult prepareResult,
ExecutionResult executionResult,
int maxRows,
boolean hasProxy,
MariaDbConnection connection,
Statement statement) |
void |
releasePrepareStatement(PrepareResult prepareResult,
String sql)
Deallocate prepare statement if not used anymore.
|
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, getActiveStreamingResult, getCalendar, getDatabase, getDataTypeMappingFlags, getHost, getHostAddress, getLock, getMajorServerVersion, getMinorServerVersion, getOptions, getPassword, getPinGlobalTxToPhysicalConnection, getPort, getPrepareStatementCache, getProxy, getReadonly, getServerData, getServerThreadId, getServerVersion, getUrlParser, getUsername, hasWarnings, isClosed, isConnected, isExplicitClosed, isMasterConnection, mustBeMasterConnection, noBackslashEscapes, readEofPacket, setActiveStreamingResult, setHasWarnings, setHostAddress, setHostFailedWithoutProxy, setMoreResults, setProxy, setReadonly, shouldReconnectWithoutProxy, skip, versionGreaterOrEqualclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcheckIfMaster, close, connect, connectWithoutProxy, getActiveStreamingResult, getCalendar, getDatabase, getDataTypeMappingFlags, getHost, getHostAddress, getLock, getMajorServerVersion, getMinorServerVersion, getOptions, getPassword, getPinGlobalTxToPhysicalConnection, getPort, getProxy, getReadonly, getServerData, getServerThreadId, getServerVersion, getUrlParser, getUsername, hasWarnings, isClosed, isConnected, isExplicitClosed, isMasterConnection, mustBeMasterConnection, noBackslashEscapes, setActiveStreamingResult, 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 PrepareResult prepare(String sql) throws QueryException
prepare in interface Protocolsql - the queryQueryException - if any error occur on connection.public PrepareResult prepare(String sql, boolean forceNew, boolean executeOnMaster) throws QueryException
prepare in interface Protocolsql - the queryforceNew - do not use prepared in cache in present.executeOnMaster - state of current connection when creating this prepareStatementQueryException - if any error occur on connection.public boolean getAutocommit()
getAutocommit in interface Protocolpublic boolean inTransaction()
inTransaction in interface Protocolpublic boolean hasMoreResults()
hasMoreResults in interface ProtocolhasMoreResults in class AbstractConnectProtocolpublic void closeExplicit()
closeExplicit in interface Protocolpublic void setCatalog(String database) throws QueryException
setCatalog in interface ProtocolQueryExceptionpublic boolean ping()
throws QueryException
ping in interface ProtocolQueryExceptionpublic void executePreparedQueryAfterFailover(PrepareResult oldPrepareResult, ExecutionResult executionResult, String sql, ParameterHolder[] parameters, MariaDbType[] parameterTypeHeader, int resultSetScrollType) throws QueryException
executePreparedQueryAfterFailover in interface ProtocolQueryExceptionpublic void executePreparedQuery(PrepareResult prepareResult, ExecutionResult executionResult, String sql, ParameterHolder[] parameters, MariaDbType[] parameterTypeHeader, int resultSetScrollType) throws QueryException
executePreparedQuery in interface ProtocolQueryExceptionpublic void releasePrepareStatement(PrepareResult prepareResult, String sql) throws QueryException
releasePrepareStatement in interface ProtocolprepareResult - allocation resultsql - sql queryQueryException - if deallocation failed.public 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 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 fetchActiveStreamingResult()
throws SQLException
SQLException - if socket error.public PrepareStatementCache prepareStatementCache()
prepareStatementCache in interface Protocolpublic void executeQuery(String sql) throws QueryException
executeQuery in interface ProtocolexecuteQuery in class AbstractConnectProtocolQueryExceptionpublic void executeQuery(ExecutionResult executionResult, String sql, int resultSetScrollType) throws QueryException
executeQuery in interface Protocolsql - the query to executeInternalresultSetScrollType - resultSetScrollTypeQueryException - exceptionpublic void executeQueries(ExecutionResult executionResult, List<String> queries, int resultSetScrollType) throws QueryException
executeQueries in interface Protocolqueries - list of queryesresultSetScrollType - resultSetScrollTypeQueryException - exceptionpublic void executeQueries(ExecutionResult executionResult, List<String> queryParts, List<ParameterHolder[]> parameterList, int resultSetScrollType, boolean isRewritable) throws QueryException
executeQueries in interface ProtocolexecutionResult - resultqueryParts - query partparameterList - parametersresultSetScrollType - resultsetScroll typeisRewritable - is rewritable flagQueryException - exceptionpublic void executeQueriesRewrite(ExecutionResult executionResult, List<String> queries, int resultSetScrollType, boolean isRewritable, int rewriteOffset) throws QueryException
executeQueriesRewrite in interface Protocolqueries - list of queryesresultSetScrollType - resultSetScrollTypeisRewritable - is rewritable flagrewriteOffset - rewrite offsetQueryException - exceptionpublic void getResult(ExecutionResult executionResult, int resultSetScrollType, boolean binaryProtocol) throws QueryException
getResult in interface ProtocolQueryExceptionpublic void prologProxy(PrepareResult prepareResult, ExecutionResult executionResult, int maxRows, boolean hasProxy, MariaDbConnection connection, Statement statement) throws SQLException
prologProxy in interface ProtocolSQLExceptionpublic void prolog(ExecutionResult executionResult, int maxRows, boolean hasProxy, MariaDbConnection connection, Statement statement) throws SQLException
prolog in interface ProtocolexecutionResult - resultmaxRows - query max rowshasProxy - has proxyconnection - current connectionstatement - current statementSQLException - if any error occur.Copyright © 2016. All rights reserved.