Package org.mariadb.jdbc.client
Interface Client
-
- All Superinterfaces:
java.lang.AutoCloseable
- All Known Implementing Classes:
MultiPrimaryClient
,MultiPrimaryReplicaClient
,ReplayClient
,StandardClient
public interface Client extends java.lang.AutoCloseable
Client interface
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
abort(java.util.concurrent.Executor executor)
Abort current connectionvoid
close()
Close clientvoid
closePrepare(Prepare prepare)
Close prepare commandjava.util.List<Completion>
execute(ClientMessage message, boolean canRedo)
Send client message and read resultjava.util.List<Completion>
execute(ClientMessage message, Statement stmt, boolean canRedo)
Send client message and read resultjava.util.List<Completion>
execute(ClientMessage message, Statement stmt, int fetchSize, long maxRows, int resultSetConcurrency, int resultSetType, boolean closeOnCompletion, boolean canRedo)
Send client message and read resultjava.util.List<Completion>
executePipeline(ClientMessage[] messages, Statement stmt, int fetchSize, long maxRows, int resultSetConcurrency, int resultSetType, boolean closeOnCompletion, boolean canRedo)
Send client messages pipelining and read resultContext
getContext()
Get connection contextExceptionFactory
getExceptionFactory()
Get connection exception factoryHostAddress
getHostAddress()
Get connection hostjava.lang.String
getSocketIp()
Get current socket IP or null (for Pipe / unix socket)int
getSocketTimeout()
get socket timeoutboolean
isClosed()
Is client closedboolean
isPrimary()
is current client writer or read-onlyvoid
readStreamingResults(java.util.List<Completion> completions, int fetchSize, long maxRows, int resultSetConcurrency, int resultSetType, boolean closeOnCompletion)
Read resultsvoid
reset()
Reset connectionvoid
setReadOnly(boolean readOnly)
Switch to a writer/read-only connection, no effet on mono-connectionvoid
setSocketTimeout(int milliseconds)
Set socket timeout
-
-
-
Method Detail
-
execute
java.util.List<Completion> execute(ClientMessage message, boolean canRedo) throws java.sql.SQLException
Send client message and read result- Parameters:
message
- client messagecanRedo
- can client message be redone in case of failover- Returns:
- results
- Throws:
java.sql.SQLException
- if execution fails
-
execute
java.util.List<Completion> execute(ClientMessage message, Statement stmt, boolean canRedo) throws java.sql.SQLException
Send client message and read result- Parameters:
message
- client messagestmt
- statementcanRedo
- can client message be redone in case of failover- Returns:
- results
- Throws:
java.sql.SQLException
- if execution fails
-
execute
java.util.List<Completion> execute(ClientMessage message, Statement stmt, int fetchSize, long maxRows, int resultSetConcurrency, int resultSetType, boolean closeOnCompletion, boolean canRedo) throws java.sql.SQLException
Send client message and read result- Parameters:
message
- client messagestmt
- statementfetchSize
- fetch sizemaxRows
- maximum number of rows. 0 = allresultSetConcurrency
- concurrencyresultSetType
- result-set typecloseOnCompletion
- close statement on completioncanRedo
- can client message be redone in case of failover- Returns:
- results
- Throws:
java.sql.SQLException
- if any error occurs
-
executePipeline
java.util.List<Completion> executePipeline(ClientMessage[] messages, Statement stmt, int fetchSize, long maxRows, int resultSetConcurrency, int resultSetType, boolean closeOnCompletion, boolean canRedo) throws java.sql.SQLException
Send client messages pipelining and read result- Parameters:
messages
- client messagestmt
- statementfetchSize
- fetch sizemaxRows
- maximum number of rows. 0 = allresultSetConcurrency
- concurrencyresultSetType
- result-set typecloseOnCompletion
- close statement on completioncanRedo
- can client message be redone in case of failover- Returns:
- results
- Throws:
java.sql.SQLException
- if any error occurs
-
readStreamingResults
void readStreamingResults(java.util.List<Completion> completions, int fetchSize, long maxRows, int resultSetConcurrency, int resultSetType, boolean closeOnCompletion) throws java.sql.SQLException
Read results- Parameters:
completions
- List that will have the new resultsfetchSize
- fetch sizemaxRows
- maximum number of rows. 0 = allresultSetConcurrency
- concurrencyresultSetType
- result-set typecloseOnCompletion
- close statement on completion- Throws:
java.sql.SQLException
- if any error occurs
-
closePrepare
void closePrepare(Prepare prepare) throws java.sql.SQLException
Close prepare command- Parameters:
prepare
- prepare command- Throws:
java.sql.SQLException
- if any error occurs
-
abort
void abort(java.util.concurrent.Executor executor) throws java.sql.SQLException
Abort current connection- Parameters:
executor
- executor- Throws:
java.sql.SQLException
- if any error occurs
-
close
void close() throws java.sql.SQLException
Close client- Specified by:
close
in interfacejava.lang.AutoCloseable
- Throws:
java.sql.SQLException
- if any error occurs
-
setReadOnly
void setReadOnly(boolean readOnly) throws java.sql.SQLException
Switch to a writer/read-only connection, no effet on mono-connection- Parameters:
readOnly
- must use read-only connection- Throws:
java.sql.SQLException
- if any error occurs
-
getSocketTimeout
int getSocketTimeout()
get socket timeout- Returns:
- socket timeout
-
setSocketTimeout
void setSocketTimeout(int milliseconds) throws java.sql.SQLException
Set socket timeout- Parameters:
milliseconds
- timeout- Throws:
java.sql.SQLException
- if any error occurs
-
isClosed
boolean isClosed()
Is client closed- Returns:
- close flag
-
reset
void reset()
Reset connection
-
isPrimary
boolean isPrimary()
is current client writer or read-only- Returns:
- is primary
-
getContext
Context getContext()
Get connection context- Returns:
- connection context
-
getExceptionFactory
ExceptionFactory getExceptionFactory()
Get connection exception factory- Returns:
- connection exception factory
-
getHostAddress
HostAddress getHostAddress()
Get connection host- Returns:
- connection host
-
getSocketIp
java.lang.String getSocketIp()
Get current socket IP or null (for Pipe / unix socket)- Returns:
- Socket current IP
-
-