public class MySQLProtocol extends Object
Modifier and Type | Class and Description |
---|---|
class |
MySQLProtocol.PrepareResult |
Modifier and Type | Field and Description |
---|---|
StreamingSelectResult |
activeResult |
int |
datatypeMappingFlags |
boolean |
hasWarnings |
boolean |
moreResults |
short |
serverStatus |
Constructor and Description |
---|
MySQLProtocol(JDBCUrl url,
String username,
String password,
Properties info)
Get a protocol instance
|
Modifier and Type | Method and Description |
---|---|
void |
cancelCurrentQuery()
cancels the current query - clones the current protocol and executes a query using the new connection
thread safe
|
void |
close()
Closes socket and stream readers/writers
Attempts graceful shutdown.
|
void |
closePreparedStatement(int statementId) |
void |
connect() |
boolean |
createDB() |
QueryResult |
executeQuery(Query dQuery) |
QueryResult |
executeQuery(Query dQuery,
boolean streaming) |
boolean |
getAutocommit() |
String |
getDatabase() |
String |
getHost() |
Properties |
getInfo() |
int |
getMajorServerVersion() |
int |
getMaxAllowedPacket() |
int |
getMinorServerVersion() |
QueryResult |
getMoreResults(boolean streaming) |
String |
getPassword() |
String |
getPinGlobalTxToPhysicalConnection() |
int |
getPort() |
boolean |
getReadonly() |
QueryResult |
getResult(Query dQuery,
boolean streaming) |
String |
getServerVariable(String variable) |
String |
getServerVersion() |
int |
getTimeout()
Returns the connection timeout in milliseconds.
|
String |
getUsername() |
boolean |
hasMoreResults() |
boolean |
hasUnreadData() |
static String |
hexdump(byte[] buffer,
int offset) |
static String |
hexdump(ByteBuffer bb,
int offset) |
boolean |
inTransaction() |
boolean |
isClosed() |
boolean |
isMasterConnection() |
boolean |
noBackslashEscapes() |
boolean |
ping() |
MySQLProtocol.PrepareResult |
prepare(String sql) |
void |
reconnectToMaster() |
void |
selectDB(String database) |
void |
setHostFailed() |
void |
setLocalInfileInputStream(InputStream inputStream) |
void |
setMaxAllowedPacket(int maxAllowedPacket) |
void |
setMaxRows(int max) |
void |
setReadonly(boolean readOnly) |
void |
setTimeout(int timeout)
Sets the connection timeout.
|
boolean |
shouldReconnect() |
boolean |
shouldTryFailback()
Check if fail back to master connection is desired,
|
boolean |
versionGreaterOrEqual(int major,
int minor,
int patch) |
public boolean moreResults
public boolean hasWarnings
public StreamingSelectResult activeResult
public int datatypeMappingFlags
public short serverStatus
public MySQLProtocol(JDBCUrl url, String username, String password, Properties info) throws QueryException, SQLException
url
- connection URLusername
- the usernamepassword
- the passwordinfo
- QueryException
- if there is a problem reading / sending the packetsSQLException
public MySQLProtocol.PrepareResult prepare(String sql) throws QueryException
QueryException
public void closePreparedStatement(int statementId) throws QueryException
QueryException
public void setHostFailed()
public boolean shouldReconnect()
public boolean getAutocommit()
public boolean noBackslashEscapes()
public void reconnectToMaster() throws IOException, QueryException, SQLException
IOException
QueryException
SQLException
public void connect() throws QueryException, SQLException
QueryException
SQLException
public boolean isMasterConnection()
public boolean shouldTryFailback()
public boolean inTransaction()
public Properties getInfo()
public boolean hasMoreResults()
public void close()
public boolean isClosed()
public void selectDB(String database) throws QueryException
QueryException
public String getServerVersion()
public void setReadonly(boolean readOnly)
public boolean getReadonly()
public String getHost()
public int getPort()
public String getDatabase()
public String getUsername()
public String getPassword()
public boolean ping() throws QueryException
QueryException
public QueryResult executeQuery(Query dQuery) throws QueryException, SQLException
QueryException
SQLException
public QueryResult getResult(Query dQuery, boolean streaming) throws QueryException
QueryException
public QueryResult executeQuery(Query dQuery, boolean streaming) throws QueryException, SQLException
QueryException
SQLException
public String getServerVariable(String variable) throws QueryException, SQLException
QueryException
SQLException
public void cancelCurrentQuery() throws QueryException, IOException, SQLException
QueryException
SQLException
IOException
public boolean createDB()
public QueryResult getMoreResults(boolean streaming) throws QueryException
QueryException
public static String hexdump(byte[] buffer, int offset)
public static String hexdump(ByteBuffer bb, int offset)
public boolean hasUnreadData()
public void setMaxRows(int max) throws QueryException, SQLException
QueryException
SQLException
public int getMajorServerVersion()
public int getMinorServerVersion()
public boolean versionGreaterOrEqual(int major, int minor, int patch)
public void setLocalInfileInputStream(InputStream inputStream)
public int getMaxAllowedPacket()
public void setMaxAllowedPacket(int maxAllowedPacket)
public void setTimeout(int timeout) throws SocketException
timeout
- the timeout, in millisecondsSocketException
public int getTimeout() throws SocketException
SocketException
public String getPinGlobalTxToPhysicalConnection()
Copyright © 2015. All rights reserved.