Class MySQLConnection
- java.lang.Object
-
- io.vertx.mutiny.sqlclient.SqlClient
-
- io.vertx.mutiny.sqlclient.SqlConnection
-
- io.vertx.mutiny.mysqlclient.MySQLConnection
-
public class MySQLConnection extends SqlConnection
An interface which represents a connection to MySQL server.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
originalnon Mutiny-ified interface using Vert.x codegen.
-
-
Field Summary
Fields Modifier and Type Field Description static TypeArg<MySQLConnection>__TYPE_ARG
-
Constructor Summary
Constructors Constructor Description MySQLConnection(io.vertx.mysqlclient.MySQLConnection delegate)MySQLConnection(Object delegate)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static 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.VoidchangeUserAndAwait(io.vertx.mysqlclient.MySQLAuthOptions options)Blocking variant ofchangeUser(MySQLAuthOptions).MySQLConnectionchangeUserAndForget(io.vertx.mysqlclient.MySQLAuthOptions options)Variant ofchangeUser(MySQLAuthOptions)that ignores the result of the operation.MySQLConnectioncloseHandler(Runnable handler)static io.smallrye.mutiny.Uni<MySQLConnection>connect(Vertx vertx, io.vertx.mysqlclient.MySQLConnectOptions connectOptions)Create a connection to MySQL server with the givenconnectOptions.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.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.VoiddebugAndAwait()Blocking variant ofdebug().MySQLConnectiondebugAndForget()Variant ofdebug()that ignores the result of the operation.booleanequals(Object o)MySQLConnectionexceptionHandler(Consumer<Throwable> handler)io.vertx.mysqlclient.MySQLConnectiongetDelegate()io.smallrye.mutiny.Uni<String>getInternalStatistics()Send a STATISTICS command to get a human readable string of the server internal status.StringgetInternalStatisticsAndAwait()Blocking variant ofgetInternalStatistics().MySQLConnectiongetInternalStatisticsAndForget()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.VoidpingAndAwait()Blocking variant ofping().MySQLConnectionpingAndForget()Variant ofping()that ignores the result of the operation.io.smallrye.mutiny.Uni<PreparedStatement>prepare(String sql)Unlike the bare Vert.x variant, this method returns aUni.PreparedStatementprepareAndAwait(String sql)Blocking variant ofprepare(String).MySQLConnectionprepareAndForget(String sql)Variant ofprepare(String)that ignores the result of the operation.io.smallrye.mutiny.Uni<Void>resetConnection()Send a RESET_CONNECTION command to reset the session state.VoidresetConnectionAndAwait()Blocking variant ofresetConnection().MySQLConnectionresetConnectionAndForget()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.VoidsetOptionAndAwait(io.vertx.mysqlclient.MySQLSetOption option)Blocking variant ofsetOption(MySQLSetOption).MySQLConnectionsetOptionAndForget(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.VoidspecifySchemaAndAwait(String schemaName)Blocking variant ofspecifySchema(String).MySQLConnectionspecifySchemaAndForget(String schemaName)Variant ofspecifySchema(String)that ignores the result of the operation.StringtoString()-
Methods inherited from class io.vertx.mutiny.sqlclient.SqlConnection
begin, beginAndAwait, beginAndForget, close, closeAndAwait, closeAndForget, databaseMetadata, isSSL, newInstance, prepare, prepareAndAwait, prepareAndForget, transaction
-
Methods inherited from class io.vertx.mutiny.sqlclient.SqlClient
newInstance, preparedQuery, preparedQuery, query
-
-
-
-
Field Detail
-
__TYPE_ARG
public static final TypeArg<MySQLConnection> __TYPE_ARG
-
-
Constructor Detail
-
MySQLConnection
public MySQLConnection(io.vertx.mysqlclient.MySQLConnection delegate)
-
MySQLConnection
public MySQLConnection(Object delegate)
-
-
Method Detail
-
getDelegate
public io.vertx.mysqlclient.MySQLConnection getDelegate()
- Overrides:
getDelegatein classSqlConnection
-
toString
public String toString()
- Overrides:
toStringin classSqlConnection
-
equals
public boolean equals(Object o)
- 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
public static MySQLConnection connectAndAwait(Vertx vertx, String connectionUri)
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
public static void connectAndForget(Vertx vertx, String connectionUri)
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
@CheckReturnValue public io.smallrye.mutiny.Uni<PreparedStatement> prepare(String sql)
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
public PreparedStatement prepareAndAwait(String sql)
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
public MySQLConnection prepareAndForget(String sql)
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
public MySQLConnection exceptionHandler(Consumer<Throwable> handler)
- Overrides:
exceptionHandlerin classSqlConnection- Parameters:
handler-- Returns:
-
closeHandler
public MySQLConnection closeHandler(Runnable handler)
- Overrides:
closeHandlerin classSqlConnection- Parameters:
handler-- Returns:
-
ping
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> 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
public Void 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
public MySQLConnection 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
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> specifySchema(String schemaName)
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
public Void specifySchemaAndAwait(String schemaName)
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
public MySQLConnection specifySchemaAndForget(String schemaName)
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
@CheckReturnValue public io.smallrye.mutiny.Uni<String> 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
public String 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
public MySQLConnection 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
public Void setOptionAndAwait(io.vertx.mysqlclient.MySQLSetOption option)
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
public MySQLConnection setOptionAndForget(io.vertx.mysqlclient.MySQLSetOption option)
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
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> 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
public Void 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
public MySQLConnection 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
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> 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
public Void 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
public MySQLConnection 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
public Void changeUserAndAwait(io.vertx.mysqlclient.MySQLAuthOptions options)
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
public MySQLConnection changeUserAndForget(io.vertx.mysqlclient.MySQLAuthOptions options)
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
public static MySQLConnection cast(SqlConnection sqlConnection)
- Parameters:
sqlConnection- the connection to cast- Returns:
- a
instance
-
newInstance
public static MySQLConnection newInstance(io.vertx.mysqlclient.MySQLConnection arg)
-
-