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 |
getMinorServerVersion() |
QueryResult |
getMoreResults(boolean streaming) |
String |
getPassword() |
int |
getPort() |
boolean |
getReadonly() |
QueryResult |
getResult(Query dQuery,
boolean streaming) |
String |
getServerVariable(String variable) |
String |
getServerVersion() |
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 |
ping() |
MySQLProtocol.PrepareResult |
prepare(String sql) |
void |
reconnectToMaster() |
void |
selectDB(String database) |
void |
setHostFailed() |
void |
setLocalInfileInputStream(InputStream inputStream) |
void |
setMaxRows(int max) |
void |
setReadonly(boolean readOnly) |
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
url - connection URLusername - the usernamepassword - the passwordinfo - QueryException - if there is a problem reading / sending the packetspublic MySQLProtocol.PrepareResult prepare(String sql) throws QueryException
QueryExceptionpublic void closePreparedStatement(int statementId)
throws QueryException
QueryExceptionpublic void setHostFailed()
public boolean shouldReconnect()
public boolean getAutocommit()
public void reconnectToMaster()
throws IOException,
QueryException
IOExceptionQueryExceptionpublic void connect()
throws QueryException
QueryExceptionpublic boolean isMasterConnection()
public boolean shouldTryFailback()
public boolean inTransaction()
public Properties getInfo()
public boolean hasMoreResults()
public void close()
QueryException - if the socket or readers/writes cannot be closedpublic boolean isClosed()
public void selectDB(String database) throws QueryException
QueryExceptionpublic 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
QueryExceptionpublic QueryResult executeQuery(Query dQuery) throws QueryException
QueryExceptionpublic QueryResult getResult(Query dQuery, boolean streaming) throws QueryException
QueryExceptionpublic QueryResult executeQuery(Query dQuery, boolean streaming) throws QueryException
QueryExceptionpublic String getServerVariable(String variable) throws QueryException
QueryExceptionpublic void cancelCurrentQuery()
throws QueryException,
IOException
QueryExceptionIOExceptionpublic boolean createDB()
public QueryResult getMoreResults(boolean streaming) throws QueryException
QueryExceptionpublic 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
QueryExceptionpublic int getMajorServerVersion()
public int getMinorServerVersion()
public boolean versionGreaterOrEqual(int major,
int minor,
int patch)
public void setLocalInfileInputStream(InputStream inputStream)
Copyright © 2014. All rights reserved.