Package io.vertx.reactivex.sqlclient

## Class Pool

- java.lang.Object
- - io.vertx.reactivex.sqlclient.SqlClient
  - - io.vertx.reactivex.sqlclient.Pool

- All Implemented Interfaces:
    `io.vertx.lang.rx.RxDelegate`
  Direct Known Subclasses:
    `JDBCPool`

      public class Pool
      extends SqlClient
      implements io.vertx.lang.rx.RxDelegate

  A connection pool which reuses a number of SQL connections.

  NOTE: This class has been automatically generated from the `original` non RX-ified interface using Vert.x codegen.

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static io.vertx.lang.rx.TypeArg<Pool>` | `__TYPE_ARG` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `Pool​(Pool delegate)` |
    `Pool​(Object delegate)` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `boolean` | `equals​(Object o)` |
    `Future<SqlConnection>` | `getConnection()` | Get a connection from the pool.
    `Pool` | `getDelegate()` |
    `int` | `hashCode()` |
    `static Pool` | `newInstance​(Pool arg)` |
    `static Pool` | `pool​(Vertx vertx, SqlConnectOptions database, PoolOptions options)` | Create a connection pool to the `database` with the given `options`.
    `static Pool` | `pool​(SqlConnectOptions connectOptions)` | Like `pool(io.vertx.sqlclient.SqlConnectOptions)` with default options.
    `static Pool` | `pool​(SqlConnectOptions database, PoolOptions options)` | Like `pool(io.vertx.sqlclient.SqlConnectOptions)` with a Vert.x instance created automatically.
    `PreparedQuery<RowSet<Row>>` | `preparedQuery​(String sql)` | A connection is borrowed from the connection pool when the query is executed and then immediately returned to the pool after it completes.
    `Query<RowSet<Row>>` | `query​(String sql)` | A connection is borrowed from the connection pool when the query is executed and then immediately returned to the pool after it completes.
    `Single<SqlConnection>` | `rxGetConnection()` | Get a connection from the pool.
    `<T> Maybe<T>` | `rxWithConnection​(Function<SqlConnection,​Maybe<T>> function)` | Get a connection from the pool and execute the given `function`.
    `<T> Maybe<T>` | `rxWithConnection​(Function<SqlConnection,​Future<T>> function)` | Get a connection from the pool and execute the given `function`.
    `<T> Maybe<T>` | `rxWithTransaction​(Function<SqlConnection,​Maybe<T>> function)` | Execute the given `function` within a transaction.
    `<T> Maybe<T>` | `rxWithTransaction​(TransactionPropagation txPropagation, Function<SqlConnection,​Maybe<T>> function)` | Like `withTransaction(java.util.function.Function<io.vertx.reactivex.sqlclient.SqlConnection, io.vertx.core.Future<T>>)` but allows for setting the mode, defining how the acquired connection is managed during the execution of the function.
    `<T> Maybe<T>` | `rxWithTransaction​(TransactionPropagation txPropagation, Function<SqlConnection,​Future<T>> function)` | Like `withTransaction(java.util.function.Function<io.vertx.reactivex.sqlclient.SqlConnection, io.vertx.core.Future<T>>)` but allows for setting the mode, defining how the acquired connection is managed during the execution of the function.
    `<T> Maybe<T>` | `rxWithTransaction​(Function<SqlConnection,​Future<T>> function)` | Execute the given `function` within a transaction.
    `int` | `size()` |
    `String` | `toString()` |
    `<T> Future<T>` | `withConnection​(Function<SqlConnection,​Maybe<T>> function)` | Get a connection from the pool and execute the given `function`.
    `<T> Future<T>` | `withConnection​(Function<SqlConnection,​Future<T>> function)` | Get a connection from the pool and execute the given `function`.
    `<T> Future<T>` | `withTransaction​(Function<SqlConnection,​Maybe<T>> function)` | Execute the given `function` within a transaction.
    `<T> Future<T>` | `withTransaction​(TransactionPropagation txPropagation, Function<SqlConnection,​Maybe<T>> function)` | Like `withTransaction(java.util.function.Function<io.vertx.reactivex.sqlclient.SqlConnection, io.vertx.core.Future<T>>)` but allows for setting the mode, defining how the acquired connection is managed during the execution of the function.
    `<T> Future<T>` | `withTransaction​(TransactionPropagation txPropagation, Function<SqlConnection,​Future<T>> function)` | Like `withTransaction(java.util.function.Function<io.vertx.reactivex.sqlclient.SqlConnection, io.vertx.core.Future<T>>)` but allows for setting the mode, defining how the acquired connection is managed during the execution of the function.
    `<T> Future<T>` | `withTransaction​(Function<SqlConnection,​Future<T>> function)` | Execute the given `function` within a transaction.

    - ### Methods inherited from class io.vertx.reactivex.sqlclient.SqlClient

      `close, newInstance, preparedQuery, rxClose`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### __TYPE_ARG

          public static final io.vertx.lang.rx.TypeArg<Pool> __TYPE_ARG

  - ### Constructor Detail

    - #### Pool

          public Pool​(Pool delegate)

    - #### Pool

          public Pool​(Object delegate)

  - ### Method Detail

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `SqlClient`

    - #### equals

          public boolean equals​(Object o)

      Overrides:
        `equals` in class `SqlClient`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `SqlClient`

    - #### getDelegate

          public Pool getDelegate()

      Specified by:
        `getDelegate` in interface `io.vertx.lang.rx.RxDelegate`
      Overrides:
        `getDelegate` in class `SqlClient`

    - #### pool

          public static Pool pool​(SqlConnectOptions connectOptions)

      Like `pool(io.vertx.sqlclient.SqlConnectOptions)` with default options.
      Parameters:
        `connectOptions` -
      Returns:

    - #### pool

          public static Pool pool​(SqlConnectOptions database,
                                  PoolOptions options)

      Like `pool(io.vertx.sqlclient.SqlConnectOptions)` with a Vert.x instance created automatically.
      Parameters:
        `database` -
        `options` -
      Returns:

    - #### pool

          public static Pool pool​(Vertx vertx,
                                  SqlConnectOptions database,
                                  PoolOptions options)

      Create a connection pool to the `database` with the given `options`.

      A will be selected among the drivers found on the classpath returning `true` when applied to the first options of the list.

      Parameters:
        `vertx` - the Vertx instance to be used with the connection pool
        `database` - the options used to create the connection pool, such as database hostname
        `options` - the options for creating the pool
      Returns:
        the connection pool

    - #### getConnection

          public Future<SqlConnection> getConnection()

      Get a connection from the pool.
      Returns:
        a future notified with the `SqlConnection`

    - #### rxGetConnection

          public Single<SqlConnection> rxGetConnection()

      Get a connection from the pool.
      Returns:
        a future notified with the `SqlConnection`

    - #### query

          public Query<RowSet<Row>> query​(String sql)

      A connection is borrowed from the connection pool when the query is executed and then immediately returned to the pool after it completes.
      Overrides:
        `query` in class `SqlClient`
      Parameters:
        `sql` -
      Returns:

    - #### preparedQuery

          public PreparedQuery<RowSet<Row>> preparedQuery​(String sql)

      A connection is borrowed from the connection pool when the query is executed and then immediately returned to the pool after it completes.
      Overrides:
        `preparedQuery` in class `SqlClient`
      Parameters:
        `sql` -
      Returns:

    - #### withTransaction

          public <T> Future<T> withTransaction​(Function<SqlConnection,​Future<T>> function)

      Execute the given `function` within a transaction.

      The `function` is passed a client executing all operations within a transaction. When the future returned by the function

      - succeeds the transaction commits
      - fails the transaction rollbacks

      The `handler` is given a success result when the function returns a succeeded futures and the transaction commits. Otherwise it is given a failure result.

      Parameters:
        `function` - the code to execute
      Returns:
        a future notified with the result

    - #### rxWithTransaction

          public <T> Maybe<T> rxWithTransaction​(Function<SqlConnection,​Future<T>> function)

      Execute the given `function` within a transaction.

      The `function` is passed a client executing all operations within a transaction. When the future returned by the function

      - succeeds the transaction commits
      - fails the transaction rollbacks

      The `handler` is given a success result when the function returns a succeeded futures and the transaction commits. Otherwise it is given a failure result.

      Parameters:
        `function` - the code to execute
      Returns:
        a future notified with the result

    - #### withTransaction

          public <T> Future<T> withTransaction​(Function<SqlConnection,​Maybe<T>> function)

      Execute the given `function` within a transaction.

      The `function` is passed a client executing all operations within a transaction. When the future returned by the function

      - succeeds the transaction commits
      - fails the transaction rollbacks

      The `handler` is given a success result when the function returns a succeeded futures and the transaction commits. Otherwise it is given a failure result.

      Parameters:
        `function` - the code to execute
      Returns:
        a future notified with the result

    - #### rxWithTransaction

          public <T> Maybe<T> rxWithTransaction​(Function<SqlConnection,​Maybe<T>> function)

      Execute the given `function` within a transaction.

      The `function` is passed a client executing all operations within a transaction. When the future returned by the function

      - succeeds the transaction commits
      - fails the transaction rollbacks

      The `handler` is given a success result when the function returns a succeeded futures and the transaction commits. Otherwise it is given a failure result.

      Parameters:
        `function` - the code to execute
      Returns:
        a future notified with the result

    - #### withTransaction

          public <T> Future<T> withTransaction​(TransactionPropagation txPropagation,
                                               Function<SqlConnection,​Future<T>> function)

      Like `withTransaction(java.util.function.Function<io.vertx.reactivex.sqlclient.SqlConnection, io.vertx.core.Future<T>>)` but allows for setting the mode, defining how the acquired connection is managed during the execution of the function.
      Parameters:
        `txPropagation` -
        `function` -
      Returns:

    - #### rxWithTransaction

          public <T> Maybe<T> rxWithTransaction​(TransactionPropagation txPropagation,
                                                Function<SqlConnection,​Future<T>> function)

      Like `withTransaction(java.util.function.Function<io.vertx.reactivex.sqlclient.SqlConnection, io.vertx.core.Future<T>>)` but allows for setting the mode, defining how the acquired connection is managed during the execution of the function.
      Parameters:
        `txPropagation` -
        `function` -
      Returns:

    - #### withTransaction

          public <T> Future<T> withTransaction​(TransactionPropagation txPropagation,
                                               Function<SqlConnection,​Maybe<T>> function)

      Like `withTransaction(java.util.function.Function<io.vertx.reactivex.sqlclient.SqlConnection, io.vertx.core.Future<T>>)` but allows for setting the mode, defining how the acquired connection is managed during the execution of the function.
      Parameters:
        `txPropagation` -
        `function` -
      Returns:

    - #### rxWithTransaction

          public <T> Maybe<T> rxWithTransaction​(TransactionPropagation txPropagation,
                                                Function<SqlConnection,​Maybe<T>> function)

      Like `withTransaction(java.util.function.Function<io.vertx.reactivex.sqlclient.SqlConnection, io.vertx.core.Future<T>>)` but allows for setting the mode, defining how the acquired connection is managed during the execution of the function.
      Parameters:
        `txPropagation` -
        `function` -
      Returns:

    - #### withConnection

          public <T> Future<T> withConnection​(Function<SqlConnection,​Future<T>> function)

      Get a connection from the pool and execute the given `function`.

      When the future returned by the `function` completes, the connection is returned to the pool.

      The `handler` is given a success result when the function returns a succeeded futures. Otherwise it is given a failure result.

      Parameters:
        `function` - the code to execute
      Returns:
        a future notified with the result

    - #### rxWithConnection

          public <T> Maybe<T> rxWithConnection​(Function<SqlConnection,​Future<T>> function)

      Get a connection from the pool and execute the given `function`.

      When the future returned by the `function` completes, the connection is returned to the pool.

      The `handler` is given a success result when the function returns a succeeded futures. Otherwise it is given a failure result.

      Parameters:
        `function` - the code to execute
      Returns:
        a future notified with the result

    - #### withConnection

          public <T> Future<T> withConnection​(Function<SqlConnection,​Maybe<T>> function)

      Get a connection from the pool and execute the given `function`.

      When the future returned by the `function` completes, the connection is returned to the pool.

      The `handler` is given a success result when the function returns a succeeded futures. Otherwise it is given a failure result.

      Parameters:
        `function` - the code to execute
      Returns:
        a future notified with the result

    - #### rxWithConnection

          public <T> Maybe<T> rxWithConnection​(Function<SqlConnection,​Maybe<T>> function)

      Get a connection from the pool and execute the given `function`.

      When the future returned by the `function` completes, the connection is returned to the pool.

      The `handler` is given a success result when the function returns a succeeded futures. Otherwise it is given a failure result.

      Parameters:
        `function` - the code to execute
      Returns:
        a future notified with the result

    - #### size

          public int size()

      Returns:
        the current pool size approximation

    - #### newInstance

          public static Pool newInstance​(Pool arg)