Package org.mariadb.jdbc.client.impl
Class StandardClient
- java.lang.Object
-
- org.mariadb.jdbc.client.impl.StandardClient
-
- All Implemented Interfaces:
AutoCloseable,org.mariadb.jdbc.client.Client
- Direct Known Subclasses:
ReplayClient
public class StandardClient extends Object implements org.mariadb.jdbc.client.Client, AutoCloseable
-
-
Field Summary
Fields Modifier and Type Field Description protected org.mariadb.jdbc.client.Contextcontextprotected ExceptionFactoryexceptionFactoryprotected Writerwriter
-
Constructor Summary
Constructors Constructor Description StandardClient(Configuration conf, HostAddress hostAddress, ReentrantLock lock, boolean skipPostCommands)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidabort(Executor executor)protected voidcheckNotClosed()voidclose()voidclosePrepare(Prepare prepare)StringcreateSessionVariableQuery(String serverTz)protected voiddestroySocket()Closing socket in case of Connection error after socket creation.List<org.mariadb.jdbc.client.Completion>execute(org.mariadb.jdbc.message.ClientMessage message)List<org.mariadb.jdbc.client.Completion>execute(org.mariadb.jdbc.message.ClientMessage message, Statement stmt)List<org.mariadb.jdbc.client.Completion>execute(org.mariadb.jdbc.message.ClientMessage message, Statement stmt, int fetchSize, long maxRows, int resultSetConcurrency, int resultSetType, boolean closeOnCompletion)List<org.mariadb.jdbc.client.Completion>executePipeline(org.mariadb.jdbc.message.ClientMessage[] messages, Statement stmt, int fetchSize, long maxRows, int resultSetConcurrency, int resultSetType, boolean closeOnCompletion)org.mariadb.jdbc.client.ContextgetContext()ExceptionFactorygetExceptionFactory()HostAddressgetHostAddress()intgetSocketTimeout()intgetWaitTimeout()booleanisClosed()booleanisPrimary()org.mariadb.jdbc.client.CompletionreadPacket(org.mariadb.jdbc.message.ClientMessage message)org.mariadb.jdbc.client.CompletionreadPacket(Statement stmt, org.mariadb.jdbc.message.ClientMessage message, int fetchSize, long maxRows, int resultSetConcurrency, int resultSetType, boolean closeOnCompletion)Read server response packet.voidreadResponse(org.mariadb.jdbc.message.ClientMessage message)List<org.mariadb.jdbc.client.Completion>readResponse(Statement stmt, org.mariadb.jdbc.message.ClientMessage message, int fetchSize, long maxRows, int resultSetConcurrency, int resultSetType, boolean closeOnCompletion)voidreadStreamingResults(List<org.mariadb.jdbc.client.Completion> completions, int fetchSize, long maxRows, int resultSetConcurrency, int resultSetType, boolean closeOnCompletion)voidreset()intsendQuery(org.mariadb.jdbc.message.ClientMessage message)voidsetReadOnly(boolean readOnly)voidsetSocketTimeout(int milliseconds)
-
-
-
Field Detail
-
exceptionFactory
protected final ExceptionFactory exceptionFactory
-
writer
protected Writer writer
-
context
protected org.mariadb.jdbc.client.Context context
-
-
Constructor Detail
-
StandardClient
public StandardClient(Configuration conf, HostAddress hostAddress, ReentrantLock lock, boolean skipPostCommands) throws SQLException
- Throws:
SQLException
-
-
Method Detail
-
destroySocket
protected void destroySocket()
Closing socket in case of Connection error after socket creation.
-
setReadOnly
public void setReadOnly(boolean readOnly) throws SQLException- Specified by:
setReadOnlyin interfaceorg.mariadb.jdbc.client.Client- Throws:
SQLException
-
sendQuery
public int sendQuery(org.mariadb.jdbc.message.ClientMessage message) throws SQLException- Throws:
SQLException
-
execute
public List<org.mariadb.jdbc.client.Completion> execute(org.mariadb.jdbc.message.ClientMessage message) throws SQLException
- Specified by:
executein interfaceorg.mariadb.jdbc.client.Client- Throws:
SQLException
-
execute
public List<org.mariadb.jdbc.client.Completion> execute(org.mariadb.jdbc.message.ClientMessage message, Statement stmt) throws SQLException
- Specified by:
executein interfaceorg.mariadb.jdbc.client.Client- Throws:
SQLException
-
executePipeline
public List<org.mariadb.jdbc.client.Completion> executePipeline(org.mariadb.jdbc.message.ClientMessage[] messages, Statement stmt, int fetchSize, long maxRows, int resultSetConcurrency, int resultSetType, boolean closeOnCompletion) throws SQLException
- Specified by:
executePipelinein interfaceorg.mariadb.jdbc.client.Client- Throws:
SQLException
-
execute
public List<org.mariadb.jdbc.client.Completion> execute(org.mariadb.jdbc.message.ClientMessage message, Statement stmt, int fetchSize, long maxRows, int resultSetConcurrency, int resultSetType, boolean closeOnCompletion) throws SQLException
- Specified by:
executein interfaceorg.mariadb.jdbc.client.Client- Throws:
SQLException
-
readResponse
public List<org.mariadb.jdbc.client.Completion> readResponse(Statement stmt, org.mariadb.jdbc.message.ClientMessage message, int fetchSize, long maxRows, int resultSetConcurrency, int resultSetType, boolean closeOnCompletion) throws SQLException
- Throws:
SQLException
-
readResponse
public void readResponse(org.mariadb.jdbc.message.ClientMessage message) throws SQLException- Throws:
SQLException
-
closePrepare
public void closePrepare(Prepare prepare) throws SQLException
- Specified by:
closePreparein interfaceorg.mariadb.jdbc.client.Client- Throws:
SQLException
-
readStreamingResults
public void readStreamingResults(List<org.mariadb.jdbc.client.Completion> completions, int fetchSize, long maxRows, int resultSetConcurrency, int resultSetType, boolean closeOnCompletion) throws SQLException
- Specified by:
readStreamingResultsin interfaceorg.mariadb.jdbc.client.Client- Throws:
SQLException
-
readPacket
public org.mariadb.jdbc.client.Completion readPacket(org.mariadb.jdbc.message.ClientMessage message) throws SQLException- Throws:
SQLException
-
readPacket
public org.mariadb.jdbc.client.Completion readPacket(Statement stmt, org.mariadb.jdbc.message.ClientMessage message, int fetchSize, long maxRows, int resultSetConcurrency, int resultSetType, boolean closeOnCompletion) throws SQLException
Read server response packet.- Parameters:
stmt- current statement (null if internal)message- current messagefetchSize- default fetch sizemaxRows- maximum row numberresultSetConcurrency- concurrencyresultSetType- typecloseOnCompletion- must resultset close statement on completion- Returns:
- Completion
- Throws:
SQLException- if any exception- See Also:
- server response packets
-
checkNotClosed
protected void checkNotClosed() throws SQLException- Throws:
SQLException
-
getWaitTimeout
public int getWaitTimeout()
- Specified by:
getWaitTimeoutin interfaceorg.mariadb.jdbc.client.Client
-
isClosed
public boolean isClosed()
- Specified by:
isClosedin interfaceorg.mariadb.jdbc.client.Client
-
getContext
public org.mariadb.jdbc.client.Context getContext()
- Specified by:
getContextin interfaceorg.mariadb.jdbc.client.Client
-
abort
public void abort(Executor executor) throws SQLException
- Specified by:
abortin interfaceorg.mariadb.jdbc.client.Client- Throws:
SQLException
-
getSocketTimeout
public int getSocketTimeout()
- Specified by:
getSocketTimeoutin interfaceorg.mariadb.jdbc.client.Client
-
setSocketTimeout
public void setSocketTimeout(int milliseconds) throws SQLException- Specified by:
setSocketTimeoutin interfaceorg.mariadb.jdbc.client.Client- Throws:
SQLException
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceorg.mariadb.jdbc.client.Client
-
isPrimary
public boolean isPrimary()
- Specified by:
isPrimaryin interfaceorg.mariadb.jdbc.client.Client
-
getExceptionFactory
public ExceptionFactory getExceptionFactory()
- Specified by:
getExceptionFactoryin interfaceorg.mariadb.jdbc.client.Client
-
getHostAddress
public HostAddress getHostAddress()
- Specified by:
getHostAddressin interfaceorg.mariadb.jdbc.client.Client
-
reset
public void reset()
- Specified by:
resetin interfaceorg.mariadb.jdbc.client.Client
-
-