M - Message typepublic interface Protocol<M extends Message>
| Modifier and Type | Interface and Description |
|---|---|
static interface |
Protocol.ProtocolEventHandler |
static interface |
Protocol.ProtocolEventListener |
| Modifier and Type | Method and Description |
|---|---|
void |
afterHandshake() |
void |
beforeHandshake() |
void |
changeDatabase(String database) |
void |
changeUser(String user,
String password,
String database)
Re-authenticates as the given user and password
|
M |
checkErrorMessage()
Read one message from the MySQL server, checks for errors in it, and if none,
returns the message, ready for reading
|
void |
close() |
void |
configureTimeZone() |
void |
connect(String user,
String password,
String database)
Create a new session.
|
AuthenticationProvider<M> |
getAuthenticationProvider() |
ExceptionInterceptor |
getExceptionInterceptor() |
InputStream |
getLocalInfileInputStream()
Returns the InputStream instance that will be used to send
data in response to a "LOAD DATA LOCAL INFILE" statement.
|
MessageBuilder<M> |
getMessageBuilder() |
PacketReceivedTimeHolder |
getPacketReceivedTimeHolder() |
PacketSentTimeHolder |
getPacketSentTimeHolder() |
PropertySet |
getPropertySet() |
String |
getQueryComment()
Returns the comment that will be prepended to all statements
sent to the server.
|
String |
getQueryTimingUnits() |
ServerSession |
getServerSession() |
SocketConnection |
getSocketConnection() |
Supplier<ValueEncoder> |
getValueEncoderSupplier(Object obj) |
void |
init(Session session,
SocketConnection socketConnection,
PropertySet propertySet,
TransactionEventHandler transactionManager)
Init method takes the place of constructor.
|
void |
initServerSession() |
void |
negotiateSSLConnection() |
<T extends ProtocolEntity> |
read(Class<Resultset> requiredClass,
int maxRows,
boolean streamResults,
M resultPacket,
boolean isBinaryEncoded,
ColumnDefinition metadata,
ProtocolEntityFactory<T,M> protocolEntityFactory)
Read protocol entity.
|
<T extends ProtocolEntity> |
read(Class<T> requiredClass,
ProtocolEntityFactory<T,M> protocolEntityFactory) |
M |
readMessage(M reuse)
Read one message from the MySQL server into the reusable buffer if provided or into the new one.
|
ColumnDefinition |
readMetadata() |
<T extends QueryResult> |
readQueryResult(ResultBuilder<T> resultBuilder)
Read messages from server and deliver them to resultBuilder.
|
ServerCapabilities |
readServerCapabilities()
Retrieve ServerCapabilities from server.
|
void |
reset()
Return Protocol to its initial state right after successful connect.
|
void |
send(Message message,
int packetLen) |
M |
sendCommand(Message queryPacket,
boolean skipCheck,
int timeoutMillis)
Send a command to the MySQL server.
|
void |
setLocalInfileInputStream(InputStream stream)
Sets an InputStream instance that will be used to send data
to the MySQL server for a "LOAD DATA LOCAL INFILE" statement
rather than a FileInputStream or URLInputStream that represents
the path given as an argument to the statement.
|
void |
setPacketReceivedTimeHolder(PacketReceivedTimeHolder packetReceivedTimeHolder) |
void |
setPacketSentTimeHolder(PacketSentTimeHolder packetSentTimeHolder) |
void |
setPropertySet(PropertySet propertySet) |
void |
setQueryComment(String comment)
Sets the comment that will be prepended to all statements
sent to the server.
|
boolean |
versionMeetsMinimum(int major,
int minor,
int subminor) |
void init(Session session, SocketConnection socketConnection, PropertySet propertySet, TransactionEventHandler transactionManager)
session - SessionsocketConnection - SocketConnectionpropertySet - PropertySettransactionManager - TransactionEventHandlerPropertySet getPropertySet()
void setPropertySet(PropertySet propertySet)
MessageBuilder<M> getMessageBuilder()
ServerCapabilities readServerCapabilities()
ServerCapabilitiesServerSession getServerSession()
SocketConnection getSocketConnection()
AuthenticationProvider<M> getAuthenticationProvider()
ExceptionInterceptor getExceptionInterceptor()
PacketSentTimeHolder getPacketSentTimeHolder()
void setPacketSentTimeHolder(PacketSentTimeHolder packetSentTimeHolder)
PacketReceivedTimeHolder getPacketReceivedTimeHolder()
void setPacketReceivedTimeHolder(PacketReceivedTimeHolder packetReceivedTimeHolder)
void connect(String user, String password, String database)
user - DB user namepassword - DB user passworddatabase - database namevoid negotiateSSLConnection()
void beforeHandshake()
void afterHandshake()
void changeDatabase(String database)
void changeUser(String user, String password, String database)
user - DB user namepassword - DB user passworddatabase - database nameboolean versionMeetsMinimum(int major,
int minor,
int subminor)
M readMessage(M reuse)
reuse - Message instance to read into, may be nullM checkErrorMessage()
void send(Message message, int packetLen)
message - Message instancepacketLen - length of header + payloadColumnDefinition readMetadata()
M sendCommand(Message queryPacket, boolean skipCheck, int timeoutMillis)
queryPacket - a packet pre-loaded with data for the protocol (eg.
from a client-side prepared statement). The first byte of
this packet is the MySQL protocol 'command' from MysqlDefsskipCheck - do not call checkErrorPacket() if truetimeoutMillis - timeoutCJException - if an I/O error or SQL error occurs<T extends ProtocolEntity> T read(Class<T> requiredClass, ProtocolEntityFactory<T,M> protocolEntityFactory) throws IOException
IOException<T extends ProtocolEntity> T read(Class<Resultset> requiredClass, int maxRows, boolean streamResults, M resultPacket, boolean isBinaryEncoded, ColumnDefinition metadata, ProtocolEntityFactory<T,M> protocolEntityFactory) throws IOException
T - object extending the ProtocolEntityrequiredClass - required Resultset classmaxRows - the maximum number of rows to read (-1 means all rows)streamResults - should the driver leave the results on the wire,
and read them only when needed?resultPacket - the first packet of information in the result setisBinaryEncoded - true if the binary protocol is used (for server prepared statements)metadata - use this metadata instead of the one provided on wireprotocolEntityFactory - ProtocolEntityFactory instanceProtocolEntity instanceIOException - if an error occursvoid setLocalInfileInputStream(InputStream stream)
stream - input streamInputStream getLocalInfileInputStream()
String getQueryComment()
void setQueryComment(String comment)
comment - query comment string<T extends QueryResult> T readQueryResult(ResultBuilder<T> resultBuilder)
T - result typeresultBuilder - ResultBuilder instanceQueryResultvoid close()
throws IOException
IOExceptionvoid configureTimeZone()
void initServerSession()
void reset()
String getQueryTimingUnits()
Supplier<ValueEncoder> getValueEncoderSupplier(Object obj)