Class SqlConnection
- java.lang.Object
-
- io.vertx.mutiny.sqlclient.SqlClient
-
- io.vertx.mutiny.sqlclient.SqlConnection
-
- Direct Known Subclasses:
DB2Connection
,MSSQLConnection
,MySQLConnection
,OracleConnection
,PgConnection
public class SqlConnection extends SqlClient
A connection to the database server. NOTE: This class has been automatically generated from theoriginal
non Mutiny-ified interface using Vert.x codegen.
-
-
Field Summary
Fields Modifier and Type Field Description static TypeArg<SqlConnection>
__TYPE_ARG
-
Constructor Summary
Constructors Constructor Description SqlConnection(io.vertx.sqlclient.SqlConnection delegate)
SqlConnection(Object delegate)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description io.smallrye.mutiny.Uni<Transaction>
begin()
Begin a transaction and returns aTransaction
for controlling and tracking this transaction.Transaction
beginAndAwait()
Blocking variant ofbegin()
.void
beginAndForget()
Variant ofbegin()
that ignores the result of the operation.io.smallrye.mutiny.Uni<Void>
close()
Close the current connection after all the pending commands have been processed.Void
closeAndAwait()
Blocking variant ofSqlClient.close()
.void
closeAndForget()
Variant ofSqlClient.close()
that ignores the result of the operation.SqlConnection
closeHandler(Runnable handler)
DatabaseMetadata
databaseMetadata()
boolean
equals(Object o)
SqlConnection
exceptionHandler(Consumer<Throwable> handler)
io.vertx.sqlclient.SqlConnection
getDelegate()
int
hashCode()
boolean
isSSL()
static SqlConnection
newInstance(io.vertx.sqlclient.SqlConnection arg)
io.smallrye.mutiny.Uni<PreparedStatement>
prepare(String sql)
Create a prepared statement using the givensql
string.io.smallrye.mutiny.Uni<PreparedStatement>
prepare(String sql, io.vertx.sqlclient.PrepareOptions options)
Create a prepared statement using the givensql
string.PreparedStatement
prepareAndAwait(String sql)
Blocking variant ofprepare(String)
.PreparedStatement
prepareAndAwait(String sql, io.vertx.sqlclient.PrepareOptions options)
Blocking variant ofprepare(String,PrepareOptions)
.SqlConnection
prepareAndForget(String sql)
Variant ofprepare(String)
that ignores the result of the operation.SqlConnection
prepareAndForget(String sql, io.vertx.sqlclient.PrepareOptions options)
Variant ofprepare(String,PrepareOptions)
that ignores the result of the operation.String
toString()
Transaction
transaction()
-
Methods inherited from class io.vertx.mutiny.sqlclient.SqlClient
newInstance, preparedQuery, preparedQuery, query
-
-
-
-
Field Detail
-
__TYPE_ARG
public static final TypeArg<SqlConnection> __TYPE_ARG
-
-
Constructor Detail
-
SqlConnection
public SqlConnection(io.vertx.sqlclient.SqlConnection delegate)
-
SqlConnection
public SqlConnection(Object delegate)
-
-
Method Detail
-
getDelegate
public io.vertx.sqlclient.SqlConnection getDelegate()
- Overrides:
getDelegate
in classSqlClient
-
prepare
@CheckReturnValue public io.smallrye.mutiny.Uni<PreparedStatement> prepare(String sql)
Create a prepared statement using the givensql
string.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
sql
- the sql- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
prepareAndAwait
public PreparedStatement prepareAndAwait(String sql)
Blocking variant ofprepare(String)
.This method waits 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).
- Parameters:
sql
- the sql- Returns:
- the PreparedStatement instance produced by the operation.
-
prepareAndForget
public SqlConnection prepareAndForget(String sql)
Variant ofprepare(String)
that ignores the result of the operation.This method subscribes on the result of
prepare(String)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromprepare(String)
but you don't need to compose it with other operations.- Parameters:
sql
- the sql- Returns:
- the instance of SqlConnection to chain method calls.
-
prepare
@CheckReturnValue public io.smallrye.mutiny.Uni<PreparedStatement> prepare(String sql, io.vertx.sqlclient.PrepareOptions options)
Create a prepared statement using the givensql
string.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
sql
- the sqloptions
-- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
prepareAndAwait
public PreparedStatement prepareAndAwait(String sql, io.vertx.sqlclient.PrepareOptions options)
Blocking variant ofprepare(String,PrepareOptions)
.This method waits 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).
- Parameters:
sql
- the sqloptions
-- Returns:
- the PreparedStatement instance produced by the operation.
-
prepareAndForget
public SqlConnection prepareAndForget(String sql, io.vertx.sqlclient.PrepareOptions options)
Variant ofprepare(String,PrepareOptions)
that ignores the result of the operation.This method subscribes on the result of
prepare(String,PrepareOptions)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromprepare(String,PrepareOptions)
but you don't need to compose it with other operations.- Parameters:
sql
- the sqloptions
-- Returns:
- the instance of SqlConnection to chain method calls.
-
exceptionHandler
public SqlConnection exceptionHandler(Consumer<Throwable> handler)
- Parameters:
handler
- the handler- Returns:
-
closeHandler
public SqlConnection closeHandler(Runnable handler)
- Parameters:
handler
- the handler- Returns:
-
begin
@CheckReturnValue public io.smallrye.mutiny.Uni<Transaction> begin()
Begin a transaction and returns aTransaction
for controlling and tracking this transaction. When the connection is explicitely closed, any inflight transaction is rollbacked.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
beginAndAwait
public Transaction beginAndAwait()
Blocking variant ofbegin()
.This method waits 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).
- Returns:
- the Transaction instance produced by the operation.
-
beginAndForget
public void beginAndForget()
-
transaction
public Transaction transaction()
- Returns:
- the current transaction if it exists, otherwise null
-
isSSL
public boolean isSSL()
- Returns:
- whether the connection uses SSL
-
close
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> close()
Close the current connection after all the pending commands have been processed.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.
-
closeAndAwait
public Void closeAndAwait()
Blocking variant ofSqlClient.close()
.This method waits 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).
- Overrides:
closeAndAwait
in classSqlClient
- Returns:
- the Void instance produced by the operation.
-
closeAndForget
public void closeAndForget()
Variant ofSqlClient.close()
that ignores the result of the operation.This method subscribes on the result of
SqlClient.close()
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromSqlClient.close()
but you don't need to compose it with other operations.- Overrides:
closeAndForget
in classSqlClient
-
databaseMetadata
public DatabaseMetadata databaseMetadata()
- Returns:
- The static metadata about the backend database server for this connection
-
newInstance
public static SqlConnection newInstance(io.vertx.sqlclient.SqlConnection arg)
-
-