Modifier and Type | Field and Description |
---|---|
static io.vertx.lang.rx.TypeArg<Pool> |
__TYPE_ARG |
Constructor and Description |
---|
Pool(Object delegate) |
Pool(Pool delegate) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the pool and release the associated resources.
|
void |
close(Handler<AsyncResult<Void>> handler)
Close the pool and release the associated resources.
|
boolean |
equals(Object o) |
void |
getConnection()
Get a connection from the pool.
|
void |
getConnection(Handler<AsyncResult<SqlConnection>> handler)
Get a connection from the pool.
|
Pool |
getDelegate() |
int |
hashCode() |
static Pool |
newInstance(Pool arg) |
static Pool |
pool(SqlConnectOptions connectOptions)
Create a connection pool to the database configured with the given
connectOptions and default PoolOptions |
static Pool |
pool(SqlConnectOptions connectOptions,
PoolOptions poolOptions)
Create a connection pool to the database configured with the given
connectOptions and poolOptions . |
static Pool |
pool(Vertx vertx,
SqlConnectOptions connectOptions,
PoolOptions poolOptions)
Create a connection pool to the database configured with the given
connectOptions and poolOptions . |
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<Void> |
rxClose()
Close the pool and release the associated resources.
|
Single<SqlConnection> |
rxGetConnection()
Get a connection from the pool.
|
<T> Single<T> |
rxWithConnection(java.util.function.Function<SqlConnection,Future<T>> function)
Get a connection from the pool and execute the given
function . |
<T> Single<T> |
rxWithTransaction(java.util.function.Function<SqlConnection,Future<T>> function)
Execute the given
function within a transaction. |
String |
toString() |
<T> void |
withConnection(java.util.function.Function<SqlConnection,Future<T>> function)
Get a connection from the pool and execute the given
function . |
<T> void |
withConnection(java.util.function.Function<SqlConnection,Future<T>> function,
Handler<AsyncResult<T>> handler)
Get a connection from the pool and execute the given
function . |
<T> void |
withTransaction(java.util.function.Function<SqlConnection,Future<T>> function)
Execute the given
function within a transaction. |
<T> void |
withTransaction(java.util.function.Function<SqlConnection,Future<T>> function,
Handler<AsyncResult<T>> handler)
Execute the given
function within a transaction. |
newInstance
public static final io.vertx.lang.rx.TypeArg<Pool> __TYPE_ARG
public Pool getDelegate()
getDelegate
in class SqlClient
public static Pool pool(SqlConnectOptions connectOptions)
connectOptions
and default PoolOptions
connectOptions
- the options used to create the connection pool, such as database hostnamepublic static Pool pool(SqlConnectOptions connectOptions, PoolOptions poolOptions)
connectOptions
and poolOptions
.connectOptions
- the options used to create the connection pool, such as database hostnamepoolOptions
- the options for creating the poolpublic static Pool pool(Vertx vertx, SqlConnectOptions connectOptions, PoolOptions poolOptions)
connectOptions
and poolOptions
.vertx
- the Vertx instance to be used with the connection poolconnectOptions
- the options used to create the connection pool, such as database hostnamepoolOptions
- the options for creating the poolpublic void getConnection(Handler<AsyncResult<SqlConnection>> handler)
handler
- the handler that will get the connection resultpublic void getConnection()
public Single<SqlConnection> rxGetConnection()
public Query<RowSet<Row>> query(String sql)
public PreparedQuery<RowSet<Row>> preparedQuery(String sql)
preparedQuery
in class SqlClient
sql
- public <T> void withTransaction(java.util.function.Function<SqlConnection,Future<T>> function, Handler<AsyncResult<T>> handler)
function
within a transaction.
The function
is passed a client executing all operations within a transaction.
When the future returned by the function
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.
function
- the code to executehandler
- the result handlerpublic <T> void withTransaction(java.util.function.Function<SqlConnection,Future<T>> function)
function
within a transaction.
The function
is passed a client executing all operations within a transaction.
When the future returned by the function
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.
function
- the code to executepublic <T> Single<T> rxWithTransaction(java.util.function.Function<SqlConnection,Future<T>> function)
function
within a transaction.
The function
is passed a client executing all operations within a transaction.
When the future returned by the function
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.
function
- the code to executepublic <T> void withConnection(java.util.function.Function<SqlConnection,Future<T>> function, Handler<AsyncResult<T>> handler)
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.
function
- the code to executehandler
- the result handlerpublic <T> void withConnection(java.util.function.Function<SqlConnection,Future<T>> function)
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.
function
- the code to executepublic <T> Single<T> rxWithConnection(java.util.function.Function<SqlConnection,Future<T>> function)
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.
function
- the code to executepublic void close(Handler<AsyncResult<Void>> handler)
public void close()
Copyright © 2021 Eclipse. All rights reserved.