Class SqlConnection

java.lang.Object
io.vertx.mutiny.sqlclient.SqlClient
io.vertx.mutiny.sqlclient.SqlConnection
All Implemented Interfaces:
MutinyDelegate
Direct Known Subclasses:
DB2Connection, MSSQLConnection, MySQLConnection, OracleConnection, PgConnection

public class SqlConnection extends SqlClient implements MutinyDelegate
A connection to the database server.

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

Author:
Julien Viet, Emad Alblueshi
See Also:
  • SqlConnection
  • Field Details

  • Constructor Details

    • SqlConnection

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

      public SqlConnection(Object delegate)
  • Method Details

    • getDelegate

      public io.vertx.sqlclient.SqlConnection 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 SqlClient
      Returns:
      the delegate instance
    • 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.

      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).

      Parameters:
      sql - the sql
      Returns:
      The operation result
      See Also:
      • SqlConnection.prepare(String)
    • prepareAndForget

      public SqlConnection 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.

      Parameters:
      sql - the sql
      Returns:
      The current instance to chain operations if needed.
      See Also:
      • SqlConnection.prepare(String)
    • 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.

      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).

      Parameters:
      sql - the sql
      Returns:
      The operation result
      See Also:
      • SqlConnection.prepare(String, PrepareOptions)
    • prepareAndForget

      public SqlConnection 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.

      Parameters:
      sql - the sql
      Returns:
      The current instance to chain operations if needed.
      See Also:
      • SqlConnection.prepare(String, PrepareOptions)
    • 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.

      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).

      Returns:
      The operation result
      See Also:
      • SqlConnection.begin()
    • beginAndForget

      public SqlConnection 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.

      Returns:
      The current instance to chain operations if needed.
      See Also:
      • SqlConnection.begin()
    • 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 SqlClient
      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 SqlClient
      See Also:
      • SqlClient.close()
    • closeAndForget

      public SqlConnection 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 SqlClient
      Returns:
      The current instance to chain operations if needed.
      See Also:
      • SqlClient.close()
    • exceptionHandler

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

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

      public Transaction transaction()
      Returns:
      the current transaction if it exists, otherwise null
    • isSSL

      public boolean isSSL()
      Returns:
      whether the connection uses SSL
    • databaseMetadata

      public DatabaseMetadata databaseMetadata()
      Returns:
      The static metadata about the backend database server for this connection
    • newInstance

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

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

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

      public String toString()
      Overrides:
      toString in class SqlClient