Modifier and Type | Method and Description |
---|---|
void |
close(Handler<AsyncResult<Void>> handler)
Close the pool and release the associated resources.
|
Future<SqlConnection> |
getConnection()
Like
getConnection(Handler) but returns a Future of the asynchronous result |
void |
getConnection(Handler<AsyncResult<SqlConnection>> handler)
Get a connection from the pool.
|
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)
Create a prepared query, one of the
PreparedQuery.execute(io.vertx.sqlclient.Tuple, io.vertx.core.Handler<io.vertx.core.AsyncResult<T>>) or PreparedQuery.executeBatch(java.util.List<io.vertx.sqlclient.Tuple>, io.vertx.core.Handler<io.vertx.core.AsyncResult<T>>)
methods must be called to execute the query. |
Query<RowSet<Row>> |
query(String sql)
Create a query, the
Query.execute(io.vertx.core.Handler<io.vertx.core.AsyncResult<T>>) method must be called to execute the query. |
default <T> Future<T> |
withConnection(java.util.function.Function<SqlConnection,Future<T>> function)
Like
withTransaction(Function, Handler) but returns a Future of the asynchronous result |
default <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 . |
default <T> Future<T> |
withTransaction(java.util.function.Function<SqlConnection,Future<T>> function)
Like
withTransaction(Function, Handler) but returns a Future of the asynchronous result |
default <T> void |
withTransaction(java.util.function.Function<SqlConnection,Future<T>> function,
Handler<AsyncResult<T>> handler)
Execute the given
function within a transaction. |
static Pool pool(SqlConnectOptions connectOptions)
connectOptions
and default PoolOptions
connectOptions
- the options used to create the connection pool, such as database hostnameServiceConfigurationError
- if no compatible drivers are found, or if multiple compatible drivers are foundstatic 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 poolServiceConfigurationError
- if no compatible drivers are found, or if multiple compatible drivers are foundstatic 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 poolServiceConfigurationError
- if no compatible drivers are found, or if multiple compatible drivers are foundvoid getConnection(Handler<AsyncResult<SqlConnection>> handler)
handler
- the handler that will get the connection resultFuture<SqlConnection> getConnection()
getConnection(Handler)
but returns a Future
of the asynchronous resultQuery<RowSet<Row>> query(String sql)
Query.execute(io.vertx.core.Handler<io.vertx.core.AsyncResult<T>>)
method must be called to execute the query.
A connection is borrowed from the connection pool when the query is executed and then immediately returned
to the pool after it completes.PreparedQuery<RowSet<Row>> preparedQuery(String sql)
PreparedQuery.execute(io.vertx.sqlclient.Tuple, io.vertx.core.Handler<io.vertx.core.AsyncResult<T>>)
or PreparedQuery.executeBatch(java.util.List<io.vertx.sqlclient.Tuple>, io.vertx.core.Handler<io.vertx.core.AsyncResult<T>>)
methods must be called to execute the query.
A connection is borrowed from the connection pool when the query is executed and then immediately returned
to the pool after it completes.preparedQuery
in interface SqlClient
default <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 handlerdefault <T> Future<T> withTransaction(java.util.function.Function<SqlConnection,Future<T>> function)
withTransaction(Function, Handler)
but returns a Future
of the asynchronous resultdefault <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 handlerdefault <T> Future<T> withConnection(java.util.function.Function<SqlConnection,Future<T>> function)
withTransaction(Function, Handler)
but returns a Future
of the asynchronous resultvoid close(Handler<AsyncResult<Void>> handler)
Copyright © 2021 Eclipse. All rights reserved.