public interface PgConnection extends SqlConnection
The connection object supports all the operations defined in the SqlConnection
interface,
it also provides additional support:
Modifier and Type | Method and Description |
---|---|
PgConnection |
cancelRequest(Handler<AsyncResult<Void>> handler)
Send a request cancellation message to tell the server to cancel processing request in this connection.
|
static PgConnection |
cast(SqlConnection sqlConnection)
Cast a
SqlConnection to PgConnection . |
PgConnection |
closeHandler(Handler<Void> handler)
Set an handler called when the connection is closed.
|
static Future<PgConnection> |
connect(Vertx vertx)
Like
connect(Vertx, Handler) but returns a Future of the asynchronous result |
static void |
connect(Vertx vertx,
Handler<AsyncResult<PgConnection>> handler)
Like
connect(Vertx, PgConnectOptions, Handler) with options build from the environment variables. |
static Future<PgConnection> |
connect(Vertx vertx,
PgConnectOptions options)
Like
connect(Vertx, PgConnectOptions, Handler) but returns a Future of the asynchronous result |
static void |
connect(Vertx vertx,
PgConnectOptions options,
Handler<AsyncResult<PgConnection>> handler)
Connects to the database and returns the connection if that succeeds.
|
static Future<PgConnection> |
connect(Vertx vertx,
String connectionUri)
Like
connect(Vertx, String, Handler) but returns a Future of the asynchronous result |
static void |
connect(Vertx vertx,
String connectionUri,
Handler<AsyncResult<PgConnection>> handler)
Like
connect(Vertx, PgConnectOptions, Handler) with options build from connectionUri . |
PgConnection |
exceptionHandler(Handler<Throwable> handler)
Set an handler called with connection errors.
|
PgConnection |
noticeHandler(Handler<PgNotice> handler)
Set a handler called when the connection receives a notice from the server.
|
PgConnection |
notificationHandler(Handler<PgNotification> handler)
Set a handler called when the connection receives notification on a channel.
|
PgConnection |
prepare(String sql,
Handler<AsyncResult<PreparedStatement>> handler)
Create a prepared statement using the given
sql string. |
int |
processId() |
int |
secretKey() |
begin, begin, close, databaseMetadata, isSSL, prepare, prepare, prepare, transaction
close, preparedQuery, preparedQuery, query
static void connect(Vertx vertx, PgConnectOptions options, Handler<AsyncResult<PgConnection>> handler)
vertx
- the vertx instanceoptions
- the connect optionshandler
- the handler called with the connection or the failurestatic Future<PgConnection> connect(Vertx vertx, PgConnectOptions options)
connect(Vertx, PgConnectOptions, Handler)
but returns a Future
of the asynchronous resultstatic void connect(Vertx vertx, Handler<AsyncResult<PgConnection>> handler)
connect(Vertx, PgConnectOptions, Handler)
with options build from the environment variables.static Future<PgConnection> connect(Vertx vertx)
connect(Vertx, Handler)
but returns a Future
of the asynchronous resultstatic void connect(Vertx vertx, String connectionUri, Handler<AsyncResult<PgConnection>> handler)
connect(Vertx, PgConnectOptions, Handler)
with options build from connectionUri
.static Future<PgConnection> connect(Vertx vertx, String connectionUri)
connect(Vertx, String, Handler)
but returns a Future
of the asynchronous resultPgConnection notificationHandler(Handler<PgNotification> handler)
PgNotification
and has access to the channel name
and the notification payload.handler
- the handlerPgConnection noticeHandler(Handler<PgNotice> handler)
handler
- PgConnection cancelRequest(Handler<AsyncResult<Void>> handler)
handler
- the handler notified if cancelling request is sentint processId()
int secretKey()
PgConnection prepare(String sql, Handler<AsyncResult<PreparedStatement>> handler)
sql
string.prepare
in interface SqlConnection
sql
- the sqlhandler
- the handler notified with the prepared query asynchronouslyPgConnection exceptionHandler(Handler<Throwable> handler)
exceptionHandler
in interface SqlConnection
handler
- the handlerPgConnection closeHandler(Handler<Void> handler)
closeHandler
in interface SqlConnection
handler
- the handlerstatic PgConnection cast(SqlConnection sqlConnection)
SqlConnection
to PgConnection
.
This is mostly useful for Vert.x generated APIs like RxJava/Mutiny.sqlConnection
- the connection to castinstance
Copyright © 2023 Eclipse. All rights reserved.