|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.drizzle.jdbc.internal.mysql.MySQLProtocol
public class MySQLProtocol
TODO: refactor, clean up TODO: when should i read up the resultset? TODO: thread safety? TODO: exception handling User: marcuse Date: Jan 14, 2009 Time: 4:06:26 PM
| Constructor Summary | |
|---|---|
MySQLProtocol(java.lang.String host,
int port,
java.lang.String database,
java.lang.String username,
java.lang.String password,
java.util.Properties info)
Get a protocol instance |
|
| Method Summary | |
|---|---|
void |
addToBatch(Query dQuery)
adds a query to the batch |
void |
cancelCurrentQuery()
cancels the current query - clones the current protocol and executes a query using the new connection thread safe |
void |
clearBatch()
clears the current batch |
void |
close()
Closes socket and stream readers/writers |
void |
commit()
commits the current transaction |
boolean |
createDB()
should a database be created if it does not exist ? |
java.util.List<QueryResult> |
executeBatch()
executes the batch of queries |
QueryResult |
executeQuery(Query dQuery)
executes a query |
QueryResult |
executeQuery(Query dQuery,
java.io.InputStream inputStream)
|
java.lang.String |
getDatabase()
returns the current used database |
SupportedDatabases |
getDatabaseType()
|
java.lang.String |
getHost()
returns the host |
QueryResult |
getMoreResults()
|
java.lang.String |
getPassword()
the current password |
int |
getPort()
returns the port we are connected to |
boolean |
getReadonly()
check if it is possble to execute writing operations on this connection |
java.lang.String |
getServerVariable(java.lang.String variable)
|
java.lang.String |
getServerVersion()
returns the server version string |
java.lang.String |
getUsername()
returns the current connected username |
static java.lang.String |
hexdump(byte[] buffer,
int offset)
|
static java.lang.String |
hexdump(java.nio.ByteBuffer bb,
int offset)
|
boolean |
isClosed()
returns true if the connection has been closed |
boolean |
ping()
checks whether the connectiion is still valid |
void |
releaseSavepoint(java.lang.String savepoint)
releases the savepoint |
void |
rollback()
rolls back the current transaction |
void |
rollback(java.lang.String savepoint)
rolls back to the given save point |
void |
selectDB(java.lang.String database)
selects what database to use |
void |
setReadonly(boolean readOnly)
sets whether this connection should be read only TODO: actually enforce this |
void |
setSavepoint(java.lang.String savepoint)
sets a save point |
java.util.List<RawPacket> |
startBinlogDump(int startPos,
java.lang.String filename)
|
boolean |
supportsPBMS()
|
void |
timeOut()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MySQLProtocol(java.lang.String host,
int port,
java.lang.String database,
java.lang.String username,
java.lang.String password,
java.util.Properties info)
throws QueryException
host - the host to connect toport - the port to connect todatabase - the initial databaseusername - the usernamepassword - the passwordinfo -
QueryException - if there is a problem reading / sending the packets| Method Detail |
|---|
public void close()
throws QueryException
close in interface ProtocolQueryException - if the socket or readers/writes cannot be closedpublic boolean isClosed()
Protocol
isClosed in interface Protocol
public void selectDB(java.lang.String database)
throws QueryException
Protocol
selectDB in interface Protocoldatabase - the database
QueryException - if there is a problem selecting the databasepublic java.lang.String getServerVersion()
Protocol
getServerVersion in interface Protocolpublic void setReadonly(boolean readOnly)
Protocol
setReadonly in interface ProtocolreadOnly - if the connection should be read onlypublic boolean getReadonly()
Protocol
getReadonly in interface Protocol
public void commit()
throws QueryException
Protocol
commit in interface ProtocolQueryException - if there is a problem committing the txn
public void rollback()
throws QueryException
Protocol
rollback in interface ProtocolQueryException - if there is a problem rolling back
public void rollback(java.lang.String savepoint)
throws QueryException
Protocol
rollback in interface Protocolsavepoint - the save point to roll back to
QueryException - if there is a problem rolling back
public void setSavepoint(java.lang.String savepoint)
throws QueryException
Protocol
setSavepoint in interface Protocolsavepoint - the save point name
QueryException - if there is a problem setting the save point
public void releaseSavepoint(java.lang.String savepoint)
throws QueryException
Protocol
releaseSavepoint in interface Protocolsavepoint - the name of the savepoint to release
QueryException - if there is a problem releasing the save pointpublic java.lang.String getHost()
Protocol
getHost in interface Protocolpublic int getPort()
Protocol
getPort in interface Protocolpublic java.lang.String getDatabase()
Protocol
getDatabase in interface Protocolpublic java.lang.String getUsername()
Protocol
getUsername in interface Protocolpublic java.lang.String getPassword()
Protocol
getPassword in interface Protocol
public boolean ping()
throws QueryException
Protocol
ping in interface ProtocolQueryException - if there is a problem communicating
public QueryResult executeQuery(Query dQuery)
throws QueryException
Protocol
executeQuery in interface ProtocoldQuery - the query to execute
QueryException - if there is a problem with the querypublic void addToBatch(Query dQuery)
Protocol
addToBatch in interface ProtocoldQuery - the query to add
public java.util.List<QueryResult> executeBatch()
throws QueryException
Protocol
executeBatch in interface ProtocolQueryException - if there is a problempublic void clearBatch()
Protocol
clearBatch in interface Protocol
public java.util.List<RawPacket> startBinlogDump(int startPos,
java.lang.String filename)
throws BinlogDumpException
startBinlogDump in interface ProtocolBinlogDumpExceptionpublic SupportedDatabases getDatabaseType()
getDatabaseType in interface Protocolpublic boolean supportsPBMS()
supportsPBMS in interface Protocol
public java.lang.String getServerVariable(java.lang.String variable)
throws QueryException
getServerVariable in interface ProtocolQueryException
public QueryResult executeQuery(Query dQuery,
java.io.InputStream inputStream)
throws QueryException
executeQuery in interface ProtocolQueryException
public void cancelCurrentQuery()
throws QueryException
cancelCurrentQuery in interface ProtocolQueryException
public void timeOut()
throws QueryException
timeOut in interface ProtocolQueryExceptionpublic boolean createDB()
Protocol
createDB in interface Protocol
public QueryResult getMoreResults()
throws QueryException
getMoreResults in interface ProtocolQueryException
public static java.lang.String hexdump(byte[] buffer,
int offset)
public static java.lang.String hexdump(java.nio.ByteBuffer bb,
int offset)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||