Package io.vertx.mysqlclient
Interface MySQLConnection
-
- All Superinterfaces:
SqlClient,SqlConnection
public interface MySQLConnection extends SqlConnection
An interface which represents a connection to MySQL server.The connection object supports all the operations defined in the
SqlConnectioninterface, in addition it provides MySQL utility command support:- COM_PING
- COM_CHANGE_USER
- COM_RESET_CONNECTION
- COM_DEBUG
- COM_INIT_DB
- COM_STATISTICS
- COM_SET_OPTION
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static MySQLConnectioncast(SqlConnection sqlConnection)Cast aSqlConnectiontoMySQLConnection.Future<Void>changeUser(MySQLAuthOptions options)Send a CHANGE_USER command to change the user of the current connection, this operation will also reset connection state.MySQLConnectioncloseHandler(Handler<Void> handler)Set an handler called when the connection is closed.static Future<MySQLConnection>connect(Vertx vertx, MySQLConnectOptions connectOptions)Create a connection to MySQL server with the givenconnectOptions.static Future<MySQLConnection>connect(Vertx vertx, String connectionUri)Likeconnect(Vertx, MySQLConnectOptions)with options built fromconnectionUri.Future<Void>debug()Send a DEBUG command to dump debug information to the server's stdout.MySQLConnectionexceptionHandler(Handler<Throwable> handler)Set an handler called with connection errors.Future<String>getInternalStatistics()Send a STATISTICS command to get a human readable string of the server internal status.Future<Void>ping()Send a PING command to check if the server is alive.Future<Void>resetConnection()Send a RESET_CONNECTION command to reset the session state.Future<Void>setOption(MySQLSetOption option)Send a SET_OPTION command to set options for the current connection.Future<Void>specifySchema(String schemaName)Send a INIT_DB command to change the default schema of the connection.-
Methods inherited from interface io.vertx.sqlclient.SqlClient
close, preparedQuery, preparedQuery, query
-
Methods inherited from interface io.vertx.sqlclient.SqlConnection
begin, databaseMetadata, isSSL, prepare, prepare, transaction
-
-
-
-
Method Detail
-
connect
static Future<MySQLConnection> connect(Vertx vertx, MySQLConnectOptions connectOptions)
Create a connection to MySQL server with the givenconnectOptions.- Parameters:
vertx- the vertx instanceconnectOptions- the options for the connection- Returns:
- a future notified with the connection or the failure
-
connect
static Future<MySQLConnection> connect(Vertx vertx, String connectionUri)
Likeconnect(Vertx, MySQLConnectOptions)with options built fromconnectionUri.
-
exceptionHandler
MySQLConnection exceptionHandler(Handler<Throwable> handler)
Set an handler called with connection errors.- Specified by:
exceptionHandlerin interfaceSqlConnection- Parameters:
handler- the handler- Returns:
- a reference to this, so the API can be used fluently
-
closeHandler
MySQLConnection closeHandler(Handler<Void> handler)
Set an handler called when the connection is closed.- Specified by:
closeHandlerin interfaceSqlConnection- Parameters:
handler- the handler- Returns:
- a reference to this, so the API can be used fluently
-
ping
Future<Void> ping()
Send a PING command to check if the server is alive.- Returns:
- a future notified with the server response
-
specifySchema
Future<Void> specifySchema(String schemaName)
Send a INIT_DB command to change the default schema of the connection.- Parameters:
schemaName- name of the schema to change to- Returns:
- a future notified with the execution result
-
getInternalStatistics
Future<String> getInternalStatistics()
Send a STATISTICS command to get a human readable string of the server internal status.- Returns:
- a future notified with the execution result
-
setOption
Future<Void> setOption(MySQLSetOption option)
Send a SET_OPTION command to set options for the current connection.- Parameters:
option- the options to set- Returns:
- a future notified with the execution result
-
resetConnection
Future<Void> resetConnection()
Send a RESET_CONNECTION command to reset the session state.- Returns:
- a future notified with the execution result
-
debug
Future<Void> debug()
Send a DEBUG command to dump debug information to the server's stdout.- Returns:
- a future notified with the execution result
-
changeUser
Future<Void> changeUser(MySQLAuthOptions options)
Send a CHANGE_USER command to change the user of the current connection, this operation will also reset connection state.- Returns:
- a future notified with the execution result
-
cast
static MySQLConnection cast(SqlConnection sqlConnection)
Cast aSqlConnectiontoMySQLConnection. This is mostly useful for Vert.x generated APIs like RxJava/Mutiny.- Parameters:
sqlConnection- the connection to cast- Returns:
- a
instance
-
-