Class SqlConnection
- java.lang.Object
-
- io.vertx.mutiny.sqlclient.SqlClient
-
- io.vertx.mutiny.sqlclient.SqlConnection
-
- Direct Known Subclasses:
DB2Connection,MSSQLConnection,MySQLConnection,PgConnection
public class SqlConnection extends SqlClient
A connection to the database server. NOTE: This class has been automatically generated from theoriginalnon 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 aTransactionfor controlling and tracking this transaction.TransactionbeginAndAwait()Blocking variant ofbegin().voidbeginAndForget()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.VoidcloseAndAwait()Blocking variant ofSqlClient.close().voidcloseAndForget()Variant ofSqlClient.close()that ignores the result of the operation.SqlConnectioncloseHandler(Runnable handler)DatabaseMetadatadatabaseMetadata()booleanequals(Object o)SqlConnectionexceptionHandler(Consumer<Throwable> handler)io.vertx.sqlclient.SqlConnectiongetDelegate()inthashCode()booleanisSSL()static SqlConnectionnewInstance(io.vertx.sqlclient.SqlConnection arg)io.smallrye.mutiny.Uni<PreparedStatement>prepare(String sql)Create a prepared statement using the givensqlstring.PreparedStatementprepareAndAwait(String sql)Blocking variant ofprepare(String).SqlConnectionprepareAndForget(String sql)Variant ofprepare(String)that ignores the result of the operation.StringtoString()-
Methods inherited from class io.vertx.mutiny.sqlclient.SqlClient
newInstance, 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:
getDelegatein classSqlClient
-
prepare
public io.smallrye.mutiny.Uni<PreparedStatement> prepare(String sql)
Create a prepared statement using the givensqlstring.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
unifiring 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.
-
exceptionHandler
public SqlConnection exceptionHandler(Consumer<Throwable> handler)
- Parameters:
handler- the handler- Returns:
-
closeHandler
public SqlConnection closeHandler(Runnable handler)
- Parameters:
handler- the handler- Returns:
-
begin
public io.smallrye.mutiny.Uni<Transaction> begin()
Begin a transaction and returns aTransactionfor 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
unifiring 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()
-
isSSL
public boolean isSSL()
- Returns:
- whether the connection uses SSL
-
close
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:
closeAndAwaitin 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:
closeAndForgetin 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)
-
-