public class StandardClient extends Object implements com.singlestore.jdbc.client.Client, AutoCloseable
| Modifier and Type | Field and Description |
|---|---|
protected com.singlestore.jdbc.client.Context |
context |
protected ExceptionFactory |
exceptionFactory |
protected Writer |
writer |
| Constructor and Description |
|---|
StandardClient(Configuration conf,
HostAddress hostAddress,
ClosableLock lock,
boolean skipPostCommands)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
abort(Executor executor)
Abort current connection
|
protected void |
checkNotClosed()
Throw an exception if client is closed
|
void |
close()
Close client
|
void |
closePrepare(Prepare prepare)
Close prepare command
|
protected void |
destroySocket()
Closing socket in case of Connection error after socket creation.
|
List<com.singlestore.jdbc.client.Completion> |
execute(com.singlestore.jdbc.message.ClientMessage message,
boolean canRedo)
Send client message and read result
|
List<com.singlestore.jdbc.client.Completion> |
execute(com.singlestore.jdbc.message.ClientMessage message,
Statement stmt,
boolean canRedo)
Send client message and read result
|
List<com.singlestore.jdbc.client.Completion> |
execute(com.singlestore.jdbc.message.ClientMessage message,
Statement stmt,
int fetchSize,
long maxRows,
int resultSetConcurrency,
int resultSetType,
boolean closeOnCompletion,
boolean canRedo)
Send client message and read result
|
List<com.singlestore.jdbc.client.Completion> |
executePipeline(com.singlestore.jdbc.message.ClientMessage[] messages,
Statement stmt,
int fetchSize,
long maxRows,
int resultSetConcurrency,
int resultSetType,
boolean closeOnCompletion,
boolean canRedo)
Send client messages pipelining and read result
|
BigInteger |
getAggregatorId()
Get aggregator id
|
com.singlestore.jdbc.client.Context |
getContext()
Get connection context
|
ExceptionFactory |
getExceptionFactory()
Get connection exception factory
|
HostAddress |
getHostAddress()
Get connection host
|
BigInteger |
getInitialSqlSelectLimit()
Get the maximum number of rows returned by a SELECT query.
|
com.singlestore.jdbc.util.Version |
getSingleStoreVersion()
Get SingleStore version.
|
String |
getSocketIp()
Get current socket IP or null (for Pipe / unix socket)
|
int |
getSocketTimeout()
get socket timeout
|
boolean |
isClosed()
Is client closed
|
com.singlestore.jdbc.client.Completion |
readPacket(com.singlestore.jdbc.message.ClientMessage message)
Read a MySQL packet from socket
|
com.singlestore.jdbc.client.Completion |
readPacket(Statement stmt,
com.singlestore.jdbc.message.ClientMessage message,
int fetchSize,
long maxRows,
int resultSetConcurrency,
int resultSetType,
boolean closeOnCompletion)
Read server response packet.
|
void |
readResponse(com.singlestore.jdbc.message.ClientMessage message)
Read server response
|
List<com.singlestore.jdbc.client.Completion> |
readResponse(Statement stmt,
com.singlestore.jdbc.message.ClientMessage message,
int fetchSize,
long maxRows,
int resultSetConcurrency,
int resultSetType,
boolean closeOnCompletion)
Read server responses for a client message
|
void |
readStreamingResults(List<com.singlestore.jdbc.client.Completion> completions,
int fetchSize,
long maxRows,
int resultSetConcurrency,
int resultSetType,
boolean closeOnCompletion)
Read results
|
void |
reset()
Reset connection
|
int |
sendQuery(com.singlestore.jdbc.message.ClientMessage message)
Send client message to server
|
void |
setReadOnly(boolean readOnly)
Switch to a writer/read-only connection, no effet on mono-connection
|
void |
setSocketTimeout(int milliseconds)
Set socket timeout
|
protected final ExceptionFactory exceptionFactory
protected Writer writer
protected com.singlestore.jdbc.client.Context context
public StandardClient(Configuration conf, HostAddress hostAddress, ClosableLock lock, boolean skipPostCommands) throws SQLException
conf - configurationhostAddress - hostlock - thread lockerskipPostCommands - must connection post command be skippedSQLException - if connection failsprotected void destroySocket()
public void setReadOnly(boolean readOnly)
throws SQLException
com.singlestore.jdbc.client.ClientsetReadOnly in interface com.singlestore.jdbc.client.ClientreadOnly - must use read-only connectionSQLException - if any error occurspublic int sendQuery(com.singlestore.jdbc.message.ClientMessage message)
throws SQLException
message - client messageSQLException - if socket error occurspublic List<com.singlestore.jdbc.client.Completion> execute(com.singlestore.jdbc.message.ClientMessage message, boolean canRedo) throws SQLException
com.singlestore.jdbc.client.Clientexecute in interface com.singlestore.jdbc.client.Clientmessage - client messagecanRedo - can client message be redone in case of failoverSQLException - if execution failspublic List<com.singlestore.jdbc.client.Completion> execute(com.singlestore.jdbc.message.ClientMessage message, Statement stmt, boolean canRedo) throws SQLException
com.singlestore.jdbc.client.Clientexecute in interface com.singlestore.jdbc.client.Clientmessage - client messagestmt - statementcanRedo - can client message be redone in case of failoverSQLException - if execution failspublic List<com.singlestore.jdbc.client.Completion> executePipeline(com.singlestore.jdbc.message.ClientMessage[] messages, Statement stmt, int fetchSize, long maxRows, int resultSetConcurrency, int resultSetType, boolean closeOnCompletion, boolean canRedo) throws SQLException
com.singlestore.jdbc.client.ClientexecutePipeline in interface com.singlestore.jdbc.client.Clientmessages - 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 failoverSQLException - if any error occurspublic List<com.singlestore.jdbc.client.Completion> execute(com.singlestore.jdbc.message.ClientMessage message, Statement stmt, int fetchSize, long maxRows, int resultSetConcurrency, int resultSetType, boolean closeOnCompletion, boolean canRedo) throws SQLException
com.singlestore.jdbc.client.Clientexecute in interface com.singlestore.jdbc.client.Clientmessage - 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 failoverSQLException - if any error occurspublic List<com.singlestore.jdbc.client.Completion> readResponse(Statement stmt, com.singlestore.jdbc.message.ClientMessage message, int fetchSize, long maxRows, int resultSetConcurrency, int resultSetType, boolean closeOnCompletion) throws SQLException
stmt - statement that issue the messagemessage - client message sentfetchSize - fetch sizemaxRows - maximum number of rowsresultSetConcurrency - concurrencyresultSetType - result-set typecloseOnCompletion - close statement on resultset completionSQLException - if any error occurspublic void readResponse(com.singlestore.jdbc.message.ClientMessage message)
throws SQLException
message - client message that was sentSQLException - if any error occurspublic void closePrepare(Prepare prepare) throws SQLException
com.singlestore.jdbc.client.ClientclosePrepare in interface com.singlestore.jdbc.client.Clientprepare - prepare commandSQLException - if any error occurspublic void readStreamingResults(List<com.singlestore.jdbc.client.Completion> completions, int fetchSize, long maxRows, int resultSetConcurrency, int resultSetType, boolean closeOnCompletion) throws SQLException
com.singlestore.jdbc.client.ClientreadStreamingResults in interface com.singlestore.jdbc.client.Clientcompletions - List that will have the new resultsfetchSize - fetch sizemaxRows - maximum number of rows. 0 = allresultSetConcurrency - concurrencyresultSetType - result-set typecloseOnCompletion - close statement on completionSQLException - if any error occurspublic com.singlestore.jdbc.client.Completion readPacket(com.singlestore.jdbc.message.ClientMessage message)
throws SQLException
message - client message issuing the resultSQLException - if any error occurspublic com.singlestore.jdbc.client.Completion readPacket(Statement stmt, com.singlestore.jdbc.message.ClientMessage message, int fetchSize, long maxRows, int resultSetConcurrency, int resultSetType, boolean closeOnCompletion) throws SQLException
stmt - current statement (null if internal)message - current messagefetchSize - default fetch sizeresultSetConcurrency - concurrencyresultSetType - typemaxRows - max rowscloseOnCompletion - must resultset close statement on completionSQLException - if any exceptionprotected void checkNotClosed()
throws SQLException
SQLException - if closedpublic boolean isClosed()
com.singlestore.jdbc.client.ClientisClosed in interface com.singlestore.jdbc.client.Clientpublic com.singlestore.jdbc.client.Context getContext()
com.singlestore.jdbc.client.ClientgetContext in interface com.singlestore.jdbc.client.Clientpublic void abort(Executor executor) throws SQLException
com.singlestore.jdbc.client.Clientabort in interface com.singlestore.jdbc.client.Clientexecutor - executorSQLException - if any error occurspublic int getSocketTimeout()
com.singlestore.jdbc.client.ClientgetSocketTimeout in interface com.singlestore.jdbc.client.Clientpublic void setSocketTimeout(int milliseconds)
throws SQLException
com.singlestore.jdbc.client.ClientsetSocketTimeout in interface com.singlestore.jdbc.client.Clientmilliseconds - timeoutSQLException - if any error occurspublic void close()
throws SQLException
com.singlestore.jdbc.client.Clientclose in interface com.singlestore.jdbc.client.Clientclose in interface AutoCloseableSQLException - if any error occurspublic String getSocketIp()
com.singlestore.jdbc.client.ClientgetSocketIp in interface com.singlestore.jdbc.client.Clientpublic ExceptionFactory getExceptionFactory()
com.singlestore.jdbc.client.ClientgetExceptionFactory in interface com.singlestore.jdbc.client.Clientpublic HostAddress getHostAddress()
com.singlestore.jdbc.client.ClientgetHostAddress in interface com.singlestore.jdbc.client.Clientpublic BigInteger getAggregatorId()
com.singlestore.jdbc.client.ClientgetAggregatorId in interface com.singlestore.jdbc.client.Clientpublic BigInteger getInitialSqlSelectLimit()
com.singlestore.jdbc.client.ClientgetInitialSqlSelectLimit in interface com.singlestore.jdbc.client.Clientpublic com.singlestore.jdbc.util.Version getSingleStoreVersion()
com.singlestore.jdbc.client.ClientgetSingleStoreVersion in interface com.singlestore.jdbc.client.Clientpublic void reset()
com.singlestore.jdbc.client.Clientreset in interface com.singlestore.jdbc.client.ClientCopyright © 2025 SingleStore. All rights reserved.