Class SqlConnection

    • Constructor Detail

      • SqlConnection

        public SqlConnection​(io.vertx.sqlclient.SqlConnection delegate)
      • SqlConnection

        public SqlConnection​(Object delegate)
    • Method Detail

      • getDelegate

        public io.vertx.sqlclient.SqlConnection getDelegate()
        Overrides:
        getDelegate in class SqlClient
      • 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. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        sql - the sql
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • prepareAndAwait

        public PreparedStatement prepareAndAwait​(String sql)
        Blocking variant of prepare(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:
        sql - the sql
        Returns:
        the PreparedStatement instance produced by the operation.
      • prepareAndForget

        public SqlConnection prepareAndForget​(String sql)
        Variant of prepare(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 from prepare(String) but you don't need to compose it with other operations.

        Parameters:
        sql - the sql
        Returns:
        the instance of SqlConnection to chain method calls.
      • 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. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        sql - the sql
        options -
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • prepareAndAwait

        public PreparedStatement prepareAndAwait​(String sql,
                                                 io.vertx.sqlclient.PrepareOptions options)
        Blocking variant of prepare(String,PrepareOptions).

        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:
        sql - the sql
        options -
        Returns:
        the PreparedStatement instance produced by the operation.
      • prepareAndForget

        public SqlConnection prepareAndForget​(String sql,
                                              io.vertx.sqlclient.PrepareOptions options)
        Variant of prepare(String,PrepareOptions) that ignores the result of the operation.

        This method subscribes on the result of prepare(String,PrepareOptions), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from prepare(String,PrepareOptions) but you don't need to compose it with other operations.

        Parameters:
        sql - the sql
        options -
        Returns:
        the instance of SqlConnection to chain method calls.
      • closeHandler

        public SqlConnection closeHandler​(Runnable handler)
        Parameters:
        handler - the handler
        Returns:
      • 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. Don't forget to subscribe on it to trigger the operation.

        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • beginAndAwait

        public Transaction beginAndAwait()
        Blocking variant of begin().

        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 Transaction instance produced by the operation.
      • beginAndForget

        public void beginAndForget()
        Variant of begin() that ignores the result of the operation.

        This method subscribes on the result of begin(), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from begin() but you don't need to compose it with other operations.

      • transaction

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

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

        @CheckReturnValue
        public io.smallrye.mutiny.Uni<Void> close()
        Close the current connection after all the pending commands have been processed.

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Overrides:
        close in class SqlClient
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • closeAndAwait

        public Void closeAndAwait()
        Blocking variant of SqlClient.close().

        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:
        closeAndAwait in class SqlClient
        Returns:
        the Void instance produced by the operation.
      • closeAndForget

        public void closeAndForget()
        Variant of SqlClient.close() that ignores the result of the operation.

        This method subscribes on the result of SqlClient.close(), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from SqlClient.close() but you don't need to compose it with other operations.

        Overrides:
        closeAndForget in class SqlClient
      • 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 arg)