Package io.vertx.pgclient.spi
Class PgDriver
- java.lang.Object
-
- io.vertx.pgclient.spi.PgDriver
-
- All Implemented Interfaces:
Driver<PgConnectOptions>
public class PgDriver extends Object implements Driver<PgConnectOptions>
-
-
Constructor Summary
Constructors Constructor Description PgDriver()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
acceptsOptions(SqlConnectOptions options)
int
appendQueryPlaceholder(StringBuilder queryBuilder, int index, int current)
Append a parameter placeholder in thequery
.ConnectionFactory<PgConnectOptions>
createConnectionFactory(Vertx vertx, NetClientOptions transportOptions)
Create a connection factory to the givendatabase
.PgConnectOptions
downcast(SqlConnectOptions connectOptions)
Downcast the connect options to the specific driver options.Pool
newPool(Vertx vertx, java.util.function.Supplier<Future<PgConnectOptions>> databases, PoolOptions poolOptions, NetClientOptions transportOptions, Handler<SqlConnection> connectHandler, io.vertx.core.internal.CloseFuture closeFuture)
Create a connection pool to the database configured with the givenconnectOptions
andpoolOptions
.PgConnectOptions
parseConnectionUri(String uri)
io.vertx.sqlclient.internal.SqlConnectionInternal
wrapConnection(io.vertx.core.internal.ContextInternal context, ConnectionFactory<PgConnectOptions> factory, io.vertx.sqlclient.internal.Connection conn)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.vertx.sqlclient.spi.Driver
createPool
-
-
-
-
Field Detail
-
INSTANCE
public static final PgDriver INSTANCE
-
-
Method Detail
-
newPool
public Pool newPool(Vertx vertx, java.util.function.Supplier<Future<PgConnectOptions>> databases, PoolOptions poolOptions, NetClientOptions transportOptions, Handler<SqlConnection> connectHandler, io.vertx.core.internal.CloseFuture closeFuture)
Description copied from interface:Driver
Create a connection pool to the database configured with the givenconnectOptions
andpoolOptions
.This method is not meant to be used directly by users, instead they should use
Driver.createPool(Vertx, Supplier, PoolOptions, NetClientOptions, Handler)
.- Specified by:
newPool
in interfaceDriver<PgConnectOptions>
- Parameters:
vertx
- the Vertx instance to be used with the connection pooldatabases
- the list of databasespoolOptions
- the options for creating the pooltransportOptions
- the options to configure the TCP clientconnectHandler
- the connect handlercloseFuture
- the close future- Returns:
- the connection pool
-
parseConnectionUri
public PgConnectOptions parseConnectionUri(String uri)
- Specified by:
parseConnectionUri
in interfaceDriver<PgConnectOptions>
- Returns:
true
if the driver accepts theconnectOptions
,false
otherwise
-
acceptsOptions
public boolean acceptsOptions(SqlConnectOptions options)
- Specified by:
acceptsOptions
in interfaceDriver<PgConnectOptions>
- Returns:
- true if the driver accepts the
connectOptions
, false otherwise
-
downcast
public PgConnectOptions downcast(SqlConnectOptions connectOptions)
Description copied from interface:Driver
Downcast the connect options to the specific driver options.- Specified by:
downcast
in interfaceDriver<PgConnectOptions>
- Parameters:
connectOptions
- the options to downcast- Returns:
- the downcasted options
-
createConnectionFactory
public ConnectionFactory<PgConnectOptions> createConnectionFactory(Vertx vertx, NetClientOptions transportOptions)
Description copied from interface:Driver
Create a connection factory to the givendatabase
.- Specified by:
createConnectionFactory
in interfaceDriver<PgConnectOptions>
- Parameters:
vertx
- the Vertx instancetransportOptions
- the options to configure the TCP client- Returns:
- the connection factory
-
appendQueryPlaceholder
public int appendQueryPlaceholder(StringBuilder queryBuilder, int index, int current)
Description copied from interface:Driver
Append a parameter placeholder in thequery
.The index starts at
0
.- When
index == current
indicates it is a new parameter and therefore the same * value should be returned. - When
index < current
indicates the builder wants to reuse a parameter. The implementation can either return the same value to indicate the parameter can be reused or return the next index to use (which is shall be thecurrent
value
- Specified by:
appendQueryPlaceholder
in interfaceDriver<PgConnectOptions>
- Parameters:
queryBuilder
- the builder to append toindex
- the parameter placeholder index- Returns:
- the index at which the parameter placeholder could be added
- When
-
wrapConnection
public io.vertx.sqlclient.internal.SqlConnectionInternal wrapConnection(io.vertx.core.internal.ContextInternal context, ConnectionFactory<PgConnectOptions> factory, io.vertx.sqlclient.internal.Connection conn)
- Specified by:
wrapConnection
in interfaceDriver<PgConnectOptions>
-
-