Class MySQLConnection

All Implemented Interfaces:
MutinyDelegate

public class MySQLConnection extends SqlConnection implements MutinyDelegate
An interface which represents a connection to MySQL server.

The connection object supports all the operations defined in the SqlConnection 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

NOTE: This class has been automatically generated from the original non Mutiny-ified interface.

See Also:
  • MySQLConnection
  • Field Details

  • Constructor Details

    • MySQLConnection

      public MySQLConnection(io.vertx.mysqlclient.MySQLConnection delegate)
      Create a new instance of MySQLConnection delegating to the given (non-null) instance of MySQLConnection.
    • MySQLConnection

      public MySQLConnection(Object delegate)
  • Method Details

    • getDelegate

      public io.vertx.mysqlclient.MySQLConnection getDelegate()
      Get the delegate instance.

      This method returns the instance on which this shim is delegating the calls. And so, give you access to the bare API.

      Specified by:
      getDelegate in interface MutinyDelegate
      Overrides:
      getDelegate in class SqlConnection
      Returns:
      the delegate instance
    • 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 given connectOptions.

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Parameters:
      vertx - the vertx instance
      connectOptions - the options for the connection
      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • io.vertx.mysqlclient.MySQLConnection#connect(Vertx, MySQLConnectOptions)
    • connectAndAwait

      public static MySQLConnection connectAndAwait(Vertx vertx, io.vertx.mysqlclient.MySQLConnectOptions connectOptions)
      Create a connection to MySQL server with the given connectOptions.

      Unlike the bare Vert.x variant, this method returns a MySQLConnection. This method awaits indefinitely 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 instance
      connectOptions - the options for the connection
      Returns:
      The operation result
      See Also:
      • io.vertx.mysqlclient.MySQLConnection#connect(Vertx, MySQLConnectOptions)
    • connectAndForget

      public static void connectAndForget(Vertx vertx, io.vertx.mysqlclient.MySQLConnectOptions connectOptions)
      Create a connection to MySQL server with the given connectOptions.

      Unlike the bare Vert.x variant, this method ignores the MySQLConnection result or any failure.

      Parameters:
      vertx - the vertx instance
      connectOptions - the options for the connection
      See Also:
      • io.vertx.mysqlclient.MySQLConnection#connect(Vertx, MySQLConnectOptions)
    • connect

      @CheckReturnValue public static io.smallrye.mutiny.Uni<MySQLConnection> connect(Vertx vertx, String connectionUri)
      Like connect(Vertx, MySQLConnectOptions) with options built from connectionUri.

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • io.vertx.mysqlclient.MySQLConnection#connect(Vertx, String)
    • connectAndAwait

      public static MySQLConnection connectAndAwait(Vertx vertx, String connectionUri)
      Like connect(Vertx, MySQLConnectOptions) with options built from connectionUri.

      Unlike the bare Vert.x variant, this method returns a MySQLConnection. This method awaits indefinitely 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 operation result
      See Also:
      • io.vertx.mysqlclient.MySQLConnection#connect(Vertx, String)
    • connectAndForget

      public static void connectAndForget(Vertx vertx, String connectionUri)
      Like connect(Vertx, MySQLConnectOptions) with options built from connectionUri.

      Unlike the bare Vert.x variant, this method ignores the MySQLConnection result or any failure.

      See Also:
      • io.vertx.mysqlclient.MySQLConnection#connect(Vertx, String)
    • 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. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • MySQLConnection.ping()
    • pingAndAwait

      public void pingAndAwait()
      Send a PING command to check if the server is alive.

      Unlike the bare Vert.x variant, this method returns a Void. This method awaits indefinitely 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).

      See Also:
      • MySQLConnection.ping()
    • pingAndForget

      public MySQLConnection pingAndForget()
      Send a PING command to check if the server is alive.

      Unlike the bare Vert.x variant, this method ignores the Void result or any failure.

      Returns:
      The current instance to chain operations if needed.
      See Also:
      • MySQLConnection.ping()
    • 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. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Parameters:
      schemaName - name of the schema to change to
      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • MySQLConnection.specifySchema(String)
    • specifySchemaAndAwait

      public void specifySchemaAndAwait(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 Void. This method awaits indefinitely 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
      See Also:
      • MySQLConnection.specifySchema(String)
    • specifySchemaAndForget

      public MySQLConnection specifySchemaAndForget(String schemaName)
      Send a INIT_DB command to change the default schema of the connection.

      Unlike the bare Vert.x variant, this method ignores the Void result or any failure.

      Parameters:
      schemaName - name of the schema to change to
      Returns:
      The current instance to chain operations if needed.
      See Also:
      • MySQLConnection.specifySchema(String)
    • 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. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • MySQLConnection.getInternalStatistics()
    • getInternalStatisticsAndAwait

      public String getInternalStatisticsAndAwait()
      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 String. This method awaits indefinitely 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 operation result
      See Also:
      • MySQLConnection.getInternalStatistics()
    • getInternalStatisticsAndForget

      public MySQLConnection getInternalStatisticsAndForget()
      Send a STATISTICS command to get a human readable string of the server internal status.

      Unlike the bare Vert.x variant, this method ignores the String result or any failure.

      Returns:
      The current instance to chain operations if needed.
      See Also:
      • MySQLConnection.getInternalStatistics()
    • 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. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Parameters:
      option - the options to set
      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • MySQLConnection.setOption(MySQLSetOption)
    • setOptionAndAwait

      public void setOptionAndAwait(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 Void. This method awaits indefinitely 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
      See Also:
      • MySQLConnection.setOption(MySQLSetOption)
    • setOptionAndForget

      public MySQLConnection setOptionAndForget(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 ignores the Void result or any failure.

      Parameters:
      option - the options to set
      Returns:
      The current instance to chain operations if needed.
      See Also:
      • MySQLConnection.setOption(MySQLSetOption)
    • 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. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • MySQLConnection.resetConnection()
    • resetConnectionAndAwait

      public void resetConnectionAndAwait()
      Send a RESET_CONNECTION command to reset the session state.

      Unlike the bare Vert.x variant, this method returns a Void. This method awaits indefinitely 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).

      See Also:
      • MySQLConnection.resetConnection()
    • resetConnectionAndForget

      public MySQLConnection resetConnectionAndForget()
      Send a RESET_CONNECTION command to reset the session state.

      Unlike the bare Vert.x variant, this method ignores the Void result or any failure.

      Returns:
      The current instance to chain operations if needed.
      See Also:
      • MySQLConnection.resetConnection()
    • 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. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • MySQLConnection.debug()
    • debugAndAwait

      public void debugAndAwait()
      Send a DEBUG command to dump debug information to the server's stdout.

      Unlike the bare Vert.x variant, this method returns a Void. This method awaits indefinitely 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).

      See Also:
      • MySQLConnection.debug()
    • debugAndForget

      public MySQLConnection debugAndForget()
      Send a DEBUG command to dump debug information to the server's stdout.

      Unlike the bare Vert.x variant, this method ignores the Void result or any failure.

      Returns:
      The current instance to chain operations if needed.
      See Also:
      • MySQLConnection.debug()
    • 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. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • MySQLConnection.changeUser(MySQLAuthOptions)
    • changeUserAndAwait

      public void changeUserAndAwait(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 Void. This method awaits indefinitely 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).

      See Also:
      • MySQLConnection.changeUser(MySQLAuthOptions)
    • changeUserAndForget

      public MySQLConnection changeUserAndForget(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 ignores the Void result or any failure.

      Returns:
      The current instance to chain operations if needed.
      See Also:
      • MySQLConnection.changeUser(MySQLAuthOptions)
    • begin

      @CheckReturnValue public io.smallrye.mutiny.Uni<Transaction> begin()
      Begin a transaction and returns a Transaction for controlling and tracking this transaction.

      When the connection is explicitely closed, any inflight transaction is rollbacked.

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Overrides:
      begin in class SqlConnection
      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • SqlConnection.begin()
    • beginAndAwait

      public Transaction beginAndAwait()
      Begin a transaction and returns a Transaction for controlling and tracking this transaction.

      When the connection is explicitely closed, any inflight transaction is rollbacked.

      Unlike the bare Vert.x variant, this method returns a Transaction. This method awaits indefinitely 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:
      beginAndAwait in class SqlConnection
      Returns:
      The operation result
      See Also:
      • SqlConnection.begin()
    • beginAndForget

      public MySQLConnection beginAndForget()
      Begin a transaction and returns a Transaction for controlling and tracking this transaction.

      When the connection is explicitely closed, any inflight transaction is rollbacked.

      Unlike the bare Vert.x variant, this method ignores the Transaction result or any failure.

      Overrides:
      beginAndForget in class SqlConnection
      Returns:
      The current instance to chain operations if needed.
      See Also:
      • SqlConnection.begin()
    • prepare

      @CheckReturnValue public io.smallrye.mutiny.Uni<PreparedStatement> prepare(String sql, io.vertx.sqlclient.PrepareOptions options)
      Create a prepared statement using the given sql string.

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Overrides:
      prepare in class SqlConnection
      Parameters:
      sql - the sql
      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • SqlConnection.prepare(String, PrepareOptions)
    • prepareAndAwait

      public PreparedStatement prepareAndAwait(String sql, io.vertx.sqlclient.PrepareOptions options)
      Create a prepared statement using the given sql string.

      Unlike the bare Vert.x variant, this method returns a PreparedStatement. This method awaits indefinitely 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:
      prepareAndAwait in class SqlConnection
      Parameters:
      sql - the sql
      Returns:
      The operation result
      See Also:
      • SqlConnection.prepare(String, PrepareOptions)
    • prepareAndForget

      public MySQLConnection prepareAndForget(String sql, io.vertx.sqlclient.PrepareOptions options)
      Create a prepared statement using the given sql string.

      Unlike the bare Vert.x variant, this method ignores the PreparedStatement result or any failure.

      Overrides:
      prepareAndForget in class SqlConnection
      Parameters:
      sql - the sql
      Returns:
      The current instance to chain operations if needed.
      See Also:
      • SqlConnection.prepare(String, PrepareOptions)
    • close

      @CheckReturnValue public io.smallrye.mutiny.Uni<Void> close()
      Close the client and release the associated resources.

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Overrides:
      close in class SqlConnection
      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • SqlClient.close()
    • closeAndAwait

      public void closeAndAwait()
      Close the client and release the associated resources.

      Unlike the bare Vert.x variant, this method returns a Void. This method awaits indefinitely 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:
      closeAndAwait in class SqlConnection
      See Also:
      • SqlClient.close()
    • closeAndForget

      public MySQLConnection closeAndForget()
      Close the client and release the associated resources.

      Unlike the bare Vert.x variant, this method ignores the Void result or any failure.

      Overrides:
      closeAndForget in class SqlConnection
      Returns:
      The current instance to chain operations if needed.
      See Also:
      • SqlClient.close()
    • prepare

      @CheckReturnValue public io.smallrye.mutiny.Uni<PreparedStatement> prepare(String sql)
      Create a prepared statement using the given sql string.

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Overrides:
      prepare in class SqlConnection
      Parameters:
      sql - the sql
      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • SqlConnection.prepare(String)
    • prepareAndAwait

      public PreparedStatement prepareAndAwait(String sql)
      Create a prepared statement using the given sql string.

      Unlike the bare Vert.x variant, this method returns a PreparedStatement. This method awaits indefinitely 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:
      prepareAndAwait in class SqlConnection
      Parameters:
      sql - the sql
      Returns:
      The operation result
      See Also:
      • SqlConnection.prepare(String)
    • prepareAndForget

      public MySQLConnection prepareAndForget(String sql)
      Create a prepared statement using the given sql string.

      Unlike the bare Vert.x variant, this method ignores the PreparedStatement result or any failure.

      Overrides:
      prepareAndForget in class SqlConnection
      Parameters:
      sql - the sql
      Returns:
      The current instance to chain operations if needed.
      See Also:
      • SqlConnection.prepare(String)
    • exceptionHandler

      public MySQLConnection exceptionHandler(Consumer<Throwable> handler)
      Set an handler called with connection errors.
      Overrides:
      exceptionHandler in class SqlConnection
      Parameters:
      handler - the handler
      Returns:
      a reference to this, so the API can be used fluently
    • closeHandler

      public MySQLConnection closeHandler(Runnable handler)
      Set an handler called when the connection is closed.
      Overrides:
      closeHandler in class SqlConnection
      Parameters:
      handler - the handler
      Returns:
      a reference to this, so the API can be used fluently
    • cast

      public static MySQLConnection cast(SqlConnection sqlConnection)
      Cast a SqlConnection to MySQLConnection. This is mostly useful for Vert.x generated APIs like RxJava/Mutiny.
      Parameters:
      sqlConnection - the connection to cast
      Returns:
      a instance
    • newInstance

      public static MySQLConnection newInstance(io.vertx.mysqlclient.MySQLConnection delegate)
      Creates a new instance of the MySQLConnection.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class SqlConnection
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class SqlConnection
    • toString

      public String toString()
      Overrides:
      toString in class SqlConnection