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.Context
context
protected ExceptionFactory
exceptionFactory
protected Writer
writer
-
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 void
abort(Executor executor)
protected void
checkNotClosed()
void
close()
void
closePrepare(Prepare prepare)
String
createSessionVariableQuery(String serverTz)
protected void
destroySocket()
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.Context
getContext()
ExceptionFactory
getExceptionFactory()
HostAddress
getHostAddress()
int
getSocketTimeout()
int
getWaitTimeout()
boolean
isClosed()
boolean
isPrimary()
org.mariadb.jdbc.client.Completion
readPacket(org.mariadb.jdbc.message.ClientMessage message)
org.mariadb.jdbc.client.Completion
readPacket(Statement stmt, org.mariadb.jdbc.message.ClientMessage message, int fetchSize, long maxRows, int resultSetConcurrency, int resultSetType, boolean closeOnCompletion)
Read server response packet.void
readResponse(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)
void
readStreamingResults(List<org.mariadb.jdbc.client.Completion> completions, int fetchSize, long maxRows, int resultSetConcurrency, int resultSetType, boolean closeOnCompletion)
void
reset()
int
sendQuery(org.mariadb.jdbc.message.ClientMessage message)
void
setReadOnly(boolean readOnly)
void
setSocketTimeout(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:
setReadOnly
in 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:
execute
in 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:
execute
in 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:
executePipeline
in 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:
execute
in 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:
closePrepare
in 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:
readStreamingResults
in 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:
getWaitTimeout
in interfaceorg.mariadb.jdbc.client.Client
-
isClosed
public boolean isClosed()
- Specified by:
isClosed
in interfaceorg.mariadb.jdbc.client.Client
-
getContext
public org.mariadb.jdbc.client.Context getContext()
- Specified by:
getContext
in interfaceorg.mariadb.jdbc.client.Client
-
abort
public void abort(Executor executor) throws SQLException
- Specified by:
abort
in interfaceorg.mariadb.jdbc.client.Client
- Throws:
SQLException
-
getSocketTimeout
public int getSocketTimeout()
- Specified by:
getSocketTimeout
in interfaceorg.mariadb.jdbc.client.Client
-
setSocketTimeout
public void setSocketTimeout(int milliseconds) throws SQLException
- Specified by:
setSocketTimeout
in interfaceorg.mariadb.jdbc.client.Client
- Throws:
SQLException
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceorg.mariadb.jdbc.client.Client
-
isPrimary
public boolean isPrimary()
- Specified by:
isPrimary
in interfaceorg.mariadb.jdbc.client.Client
-
getExceptionFactory
public ExceptionFactory getExceptionFactory()
- Specified by:
getExceptionFactory
in interfaceorg.mariadb.jdbc.client.Client
-
getHostAddress
public HostAddress getHostAddress()
- Specified by:
getHostAddress
in interfaceorg.mariadb.jdbc.client.Client
-
reset
public void reset()
- Specified by:
reset
in interfaceorg.mariadb.jdbc.client.Client
-
-