Class MySQLConnection
- All Implemented Interfaces:
MutinyDelegate
The connection object supports all the operations defined in the interface, 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
original non Mutiny-ified interface using Vert.x codegen.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMySQLConnection(io.vertx.mysqlclient.MySQLConnection delegate) MySQLConnection(Object delegate) -
Method Summary
Modifier and TypeMethodDescriptionstatic MySQLConnectioncast(SqlConnection sqlConnection) io.smallrye.mutiny.Uni<Void>changeUser(io.vertx.mysqlclient.MySQLAuthOptions options) Send a CHANGE_USER command to change the user of the current connection, this operation will also reset connection state.changeUserAndAwait(io.vertx.mysqlclient.MySQLAuthOptions options) Blocking variant ofchangeUser(MySQLAuthOptions).changeUserAndForget(io.vertx.mysqlclient.MySQLAuthOptions options) Variant ofchangeUser(MySQLAuthOptions)that ignores the result of the operation.closeHandler(Runnable handler) static io.smallrye.mutiny.Uni<MySQLConnection>Create a connection to MySQL server with the givenconnectOptions.static io.smallrye.mutiny.Uni<MySQLConnection>Likeconnect(io.vertx.mutiny.core.Vertx, io.vertx.mysqlclient.MySQLConnectOptions)with options built fromconnectionUri.static MySQLConnectionconnectAndAwait(Vertx vertx, io.vertx.mysqlclient.MySQLConnectOptions connectOptions) Blocking variant ofconnect(io.vertx.mutiny.core.Vertx,MySQLConnectOptions).static MySQLConnectionconnectAndAwait(Vertx vertx, String connectionUri) Blocking variant ofconnect(io.vertx.mutiny.core.Vertx,String).static voidconnectAndForget(Vertx vertx, io.vertx.mysqlclient.MySQLConnectOptions connectOptions) Variant ofconnect(io.vertx.mutiny.core.Vertx,MySQLConnectOptions)that ignores the result of the operation.static voidconnectAndForget(Vertx vertx, String connectionUri) Variant ofconnect(io.vertx.mutiny.core.Vertx,String)that ignores the result of the operation.io.smallrye.mutiny.Uni<Void>debug()Send a DEBUG command to dump debug information to the server's stdout.Blocking variant ofdebug().Variant ofdebug()that ignores the result of the operation.booleanexceptionHandler(Consumer<Throwable> handler) io.vertx.mysqlclient.MySQLConnectionio.smallrye.mutiny.Uni<String>Send a STATISTICS command to get a human readable string of the server internal status.Blocking variant ofgetInternalStatistics().Variant ofgetInternalStatistics()that ignores the result of the operation.inthashCode()static MySQLConnectionnewInstance(io.vertx.mysqlclient.MySQLConnection arg) io.smallrye.mutiny.Uni<Void>ping()Send a PING command to check if the server is alive.Blocking variant ofping().Variant ofping()that ignores the result of the operation.io.smallrye.mutiny.Uni<PreparedStatement>Unlike the bare Vert.x variant, this method returns aUni.prepareAndAwait(String sql) Blocking variant ofprepare(String).prepareAndForget(String sql) Variant ofprepare(String)that ignores the result of the operation.io.smallrye.mutiny.Uni<Void>Send a RESET_CONNECTION command to reset the session state.Blocking variant ofresetConnection().Variant ofresetConnection()that ignores the result of the operation.io.smallrye.mutiny.Uni<Void>setOption(io.vertx.mysqlclient.MySQLSetOption option) Send a SET_OPTION command to set options for the current connection.setOptionAndAwait(io.vertx.mysqlclient.MySQLSetOption option) Blocking variant ofsetOption(MySQLSetOption).setOptionAndForget(io.vertx.mysqlclient.MySQLSetOption option) Variant ofsetOption(MySQLSetOption)that ignores the result of the operation.io.smallrye.mutiny.Uni<Void>specifySchema(String schemaName) Send a INIT_DB command to change the default schema of the connection.specifySchemaAndAwait(String schemaName) Blocking variant ofspecifySchema(String).specifySchemaAndForget(String schemaName) Variant ofspecifySchema(String)that ignores the result of the operation.toString()Methods inherited from class io.vertx.mutiny.sqlclient.SqlConnection
begin, beginAndAwait, beginAndForget, close, closeAndAwait, closeAndForget, databaseMetadata, isSSL, newInstance, prepare, prepareAndAwait, prepareAndForget, transactionMethods inherited from class io.vertx.mutiny.sqlclient.SqlClient
newInstance, preparedQuery, preparedQuery, query
-
Field Details
-
__TYPE_ARG
-
-
Constructor Details
-
MySQLConnection
public MySQLConnection(io.vertx.mysqlclient.MySQLConnection delegate) -
MySQLConnection
-
-
Method Details
-
getDelegate
public io.vertx.mysqlclient.MySQLConnection getDelegate()- Specified by:
getDelegatein interfaceMutinyDelegate- Overrides:
getDelegatein classSqlConnection- Returns:
- the delegate used by this Mutiny object of generated type
-
toString
- Overrides:
toStringin classSqlConnection
-
equals
- Overrides:
equalsin classSqlConnection
-
hashCode
public int hashCode()- Overrides:
hashCodein classSqlConnection
-
connect
@CheckReturnValue public static io.smallrye.mutiny.Uni<MySQLConnection> connect(Vertx vertx, io.vertx.mysqlclient.MySQLConnectOptions connectOptions) Create a connection to MySQL server with the givenconnectOptions.Unlike the bare Vert.x variant, this method returns a
Uni. Don't forget to subscribe on it to trigger the operation.- Parameters:
vertx- the vertx instanceconnectOptions- the options for the connection- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
connectAndAwait
public static MySQLConnection connectAndAwait(Vertx vertx, io.vertx.mysqlclient.MySQLConnectOptions connectOptions) Blocking variant ofconnect(io.vertx.mutiny.core.Vertx,MySQLConnectOptions).This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
vertx- the vertx instanceconnectOptions- the options for the connection- Returns:
- the MySQLConnection instance produced by the operation.
-
connectAndForget
public static void connectAndForget(Vertx vertx, io.vertx.mysqlclient.MySQLConnectOptions connectOptions) Variant ofconnect(io.vertx.mutiny.core.Vertx,MySQLConnectOptions)that ignores the result of the operation.This method subscribes on the result of
connect(io.vertx.mutiny.core.Vertx,MySQLConnectOptions), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromconnect(io.vertx.mutiny.core.Vertx,MySQLConnectOptions)but you don't need to compose it with other operations.- Parameters:
vertx- the vertx instanceconnectOptions- the options for the connection
-
connect
@CheckReturnValue public static io.smallrye.mutiny.Uni<MySQLConnection> connect(Vertx vertx, String connectionUri) Likeconnect(io.vertx.mutiny.core.Vertx, io.vertx.mysqlclient.MySQLConnectOptions)with options built fromconnectionUri.Unlike the bare Vert.x variant, this method returns a
Uni. Don't forget to subscribe on it to trigger the operation.- Parameters:
vertx-connectionUri-- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
connectAndAwait
Blocking variant ofconnect(io.vertx.mutiny.core.Vertx,String).This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
vertx-connectionUri-- Returns:
- the MySQLConnection instance produced by the operation.
-
connectAndForget
Variant ofconnect(io.vertx.mutiny.core.Vertx,String)that ignores the result of the operation.This method subscribes on the result of
connect(io.vertx.mutiny.core.Vertx,String), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromconnect(io.vertx.mutiny.core.Vertx,String)but you don't need to compose it with other operations.- Parameters:
vertx-connectionUri-
-
prepare
Unlike the bare Vert.x variant, this method returns a
Uni. Don't forget to subscribe on it to trigger the operation.- Overrides:
preparein classSqlConnection- Parameters:
sql-- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
prepareAndAwait
Blocking variant ofprepare(String).This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Overrides:
prepareAndAwaitin classSqlConnection- Parameters:
sql-- Returns:
- the PreparedStatement instance produced by the operation.
-
prepareAndForget
Variant ofprepare(String)that ignores the result of the operation.This method subscribes on the result of
prepare(String), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromprepare(String)but you don't need to compose it with other operations.- Overrides:
prepareAndForgetin classSqlConnection- Parameters:
sql-- Returns:
- the instance of MySQLConnection to chain method calls.
-
exceptionHandler
- Overrides:
exceptionHandlerin classSqlConnection- Parameters:
handler-- Returns:
-
closeHandler
- Overrides:
closeHandlerin classSqlConnection- Parameters:
handler-- Returns:
-
ping
Send a PING command to check if the server is alive.Unlike the bare Vert.x variant, this method returns a
Uni. Don't forget to subscribe on it to trigger the operation.- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
pingAndAwait
Blocking variant ofping().This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Returns:
- the Void instance produced by the operation.
-
pingAndForget
Variant ofping()that ignores the result of the operation.This method subscribes on the result of
ping(), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromping()but you don't need to compose it with other operations.- Returns:
- the instance of MySQLConnection to chain method calls.
-
specifySchema
Send a INIT_DB command to change the default schema of the connection.Unlike the bare Vert.x variant, this method returns a
Uni. Don't forget to subscribe on it to trigger the operation.- Parameters:
schemaName- name of the schema to change to- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
specifySchemaAndAwait
Blocking variant ofspecifySchema(String).This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
schemaName- name of the schema to change to- Returns:
- the Void instance produced by the operation.
-
specifySchemaAndForget
Variant ofspecifySchema(String)that ignores the result of the operation.This method subscribes on the result of
specifySchema(String), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromspecifySchema(String)but you don't need to compose it with other operations.- Parameters:
schemaName- name of the schema to change to- Returns:
- the instance of MySQLConnection to chain method calls.
-
getInternalStatistics
Send a STATISTICS command to get a human readable string of the server internal status.Unlike the bare Vert.x variant, this method returns a
Uni. Don't forget to subscribe on it to trigger the operation.- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
getInternalStatisticsAndAwait
Blocking variant ofgetInternalStatistics().This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Returns:
- the String instance produced by the operation.
-
getInternalStatisticsAndForget
Variant ofgetInternalStatistics()that ignores the result of the operation.This method subscribes on the result of
getInternalStatistics(), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromgetInternalStatistics()but you don't need to compose it with other operations.- Returns:
- the instance of MySQLConnection to chain method calls.
-
setOption
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> setOption(io.vertx.mysqlclient.MySQLSetOption option) Send a SET_OPTION command to set options for the current connection.Unlike the bare Vert.x variant, this method returns a
Uni. Don't forget to subscribe on it to trigger the operation.- Parameters:
option- the options to set- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
setOptionAndAwait
Blocking variant ofsetOption(MySQLSetOption).This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
option- the options to set- Returns:
- the Void instance produced by the operation.
-
setOptionAndForget
Variant ofsetOption(MySQLSetOption)that ignores the result of the operation.This method subscribes on the result of
setOption(MySQLSetOption), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromsetOption(MySQLSetOption)but you don't need to compose it with other operations.- Parameters:
option- the options to set- Returns:
- the instance of MySQLConnection to chain method calls.
-
resetConnection
Send a RESET_CONNECTION command to reset the session state.Unlike the bare Vert.x variant, this method returns a
Uni. Don't forget to subscribe on it to trigger the operation.- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
resetConnectionAndAwait
Blocking variant ofresetConnection().This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Returns:
- the Void instance produced by the operation.
-
resetConnectionAndForget
Variant ofresetConnection()that ignores the result of the operation.This method subscribes on the result of
resetConnection(), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromresetConnection()but you don't need to compose it with other operations.- Returns:
- the instance of MySQLConnection to chain method calls.
-
debug
Send a DEBUG command to dump debug information to the server's stdout.Unlike the bare Vert.x variant, this method returns a
Uni. Don't forget to subscribe on it to trigger the operation.- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
debugAndAwait
Blocking variant ofdebug().This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Returns:
- the Void instance produced by the operation.
-
debugAndForget
Variant ofdebug()that ignores the result of the operation.This method subscribes on the result of
debug(), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromdebug()but you don't need to compose it with other operations.- Returns:
- the instance of MySQLConnection to chain method calls.
-
changeUser
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> changeUser(io.vertx.mysqlclient.MySQLAuthOptions options) Send a CHANGE_USER command to change the user of the current connection, this operation will also reset connection state.Unlike the bare Vert.x variant, this method returns a
Uni. Don't forget to subscribe on it to trigger the operation.- Parameters:
options- authentication options- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
changeUserAndAwait
Blocking variant ofchangeUser(MySQLAuthOptions).This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
options- authentication options- Returns:
- the Void instance produced by the operation.
-
changeUserAndForget
Variant ofchangeUser(MySQLAuthOptions)that ignores the result of the operation.This method subscribes on the result of
changeUser(MySQLAuthOptions), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromchangeUser(MySQLAuthOptions)but you don't need to compose it with other operations.- Parameters:
options- authentication options- Returns:
- the instance of MySQLConnection to chain method calls.
-
cast
- Parameters:
sqlConnection- the connection to cast- Returns:
- a
instance
-
newInstance
-