io.vertx.sqlclient

## Interface PreparedStatement

-     public interface PreparedStatement

  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

  - use `query()` to create and execute a `PreparedQuery`
  - use `cursor()` to create a `Cursor`
  - use `createStream(int)` to create a `RowStream`
  Author:
    Julien Viet

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `Future<Void>` | `close()` Close the prepared query and release its resources.
    `void` | `close(Handler<AsyncResult<Void>> completionHandler)` Like `close()` but notifies the `completionHandler` when it's closed.
    `default RowStream<Row>` | `createStream(int fetch)` Like `createStream(int, Tuple)` but with empty arguments.
    `RowStream<Row>` | `createStream(int fetch, Tuple args)` Execute the prepared query with a cursor and createStream the result.
    `default Cursor` | `cursor()` Like `cursor(Tuple)` but with empty arguments.
    `Cursor` | `cursor(Tuple args)` Create a cursor with the provided `arguments`.
    `PreparedQuery<RowSet<Row>>` | `query()` Create a prepared query for this statement.

- - ### Method Detail

    - #### query

          PreparedQuery<RowSet<Row>> query()

      Create a prepared query for this statement.
      Returns:
        the prepared query

    - #### cursor

          default Cursor cursor()

      Like `cursor(Tuple)` but with empty arguments.

    - #### cursor

          Cursor cursor(Tuple args)

      Create a cursor with the provided `arguments`.
      Parameters:
        `args` - the list of arguments
      Returns:
        the query

    - #### createStream

          default RowStream<Row> createStream(int fetch)

      Like `createStream(int, Tuple)` but with empty arguments.

    - #### createStream

          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

    - #### close

          Future<Void> close()

      Close the prepared query and release its resources.

    - #### close

          void close(Handler<AsyncResult<Void>> completionHandler)

      Like `close()` but notifies the `completionHandler` when it's closed.

Copyright © 2021 Eclipse. All rights reserved.