Class PreparedStatement

java.lang.Object
io.vertx.mutiny.sqlclient.PreparedStatement
All Implemented Interfaces:
MutinyDelegate

public class PreparedStatement extends Object implements MutinyDelegate
A prepared statement, the statement is pre-compiled and it's more efficient to execute the statement for multiple times. In addition, this kind of statement provides protection against SQL injection attacks.

From a prepared statement you can

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

Author:
Julien Viet
See Also:
  • PreparedStatement
  • Field Details

  • Constructor Details

    • PreparedStatement

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

      public PreparedStatement(Object delegate)
  • Method Details

    • getDelegate

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

      @CheckReturnValue public io.smallrye.mutiny.Uni<Void> close()
      Close the prepared query and release its 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.

      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • PreparedStatement.close()
    • closeAndAwait

      public void closeAndAwait()
      Close the prepared query and release its 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).

      See Also:
      • PreparedStatement.close()
    • closeAndForget

      public PreparedStatement closeAndForget()
      Close the prepared query and release its resources.

      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:
      • PreparedStatement.close()
    • query

      public PreparedQuery<RowSet<Row>> query()
      Create a prepared query for this statement.
      Returns:
      the prepared query
    • cursor

      public Cursor cursor()
      Like cursor(Tuple) but with empty arguments.
    • cursor

      public Cursor cursor(Tuple args)
      Create a cursor with the provided arguments.
      Parameters:
      args - the list of arguments
      Returns:
      the query
    • createStream

      public RowStream<Row> createStream(int fetch)
      Like createStream(int, Tuple) but with empty arguments.
    • createStream

      public RowStream<Row> createStream(int fetch, Tuple args)
      Execute the prepared query with a cursor and createStream the result. The createStream opens a cursor with a fetch size to fetch the results.

      Note: this requires to be in a transaction, since cursors require it.

      Parameters:
      fetch - the cursor fetch size
      args - the prepared query arguments
      Returns:
      the createStream
    • newInstance

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

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

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

      public String toString()
      Overrides:
      toString in class Object