Class DriverBase<O extends SqlConnectOptions>
java.lang.Object
io.vertx.sqlclient.spi.DriverBase<O>
- Type Parameters:
O-
- All Implemented Interfaces:
Driver<O>
- Direct Known Subclasses:
DB2Driver, MSSQLDriver, MySQLDriver, OracleDriver, PgDriver
A generic driver.
-
Constructor Summary
ConstructorsConstructorDescriptionDriverBase(String discriminant) DriverBase(String discriminant, Function<Connection, Future<Void>> afterAcquire, Function<Connection, Future<Void>> beforeRecycle) -
Method Summary
Modifier and TypeMethodDescriptionabstract ConnectionFactory<O> createConnectionFactory(Vertx vertx, NetClientOptions transportOptions) Create a connection factory to the givendatabase.protected PoolnewPool(io.vertx.core.internal.VertxInternal vertx, Handler<SqlConnection> connectHandler, Supplier<Future<O>> databases, PoolOptions poolOptions, NetClientOptions transportOptions, io.vertx.core.internal.CloseFuture closeFuture) newPool(Vertx vertx, Supplier<Future<O>> databases, PoolOptions options, NetClientOptions transportOptions, Handler<SqlConnection> connectHandler, io.vertx.core.internal.CloseFuture closeFuture) Create a connection pool to the database configured with the givenconnectOptionsandpoolOptions.io.vertx.sqlclient.internal.SqlConnectionInternalwrapConnection(io.vertx.core.internal.ContextInternal context, ConnectionFactory<O> factory, Connection connection) Wrap a givenconnectioninto aSqlConnectionInternal.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Driver
acceptsOptions, appendQueryPlaceholder, createPool, downcast, parseConnectionUri
-
Constructor Details
-
DriverBase
-
DriverBase
public DriverBase(String discriminant, Function<Connection, Future<Void>> afterAcquire, Function<Connection, Future<Void>> beforeRecycle)
-
-
Method Details
-
createConnectionFactory
public abstract ConnectionFactory<O> createConnectionFactory(Vertx vertx, NetClientOptions transportOptions) Create a connection factory to the givendatabase.- Parameters:
vertx- the Vertx instancetransportOptions- the options to configure the TCP client- Returns:
- the connection factory
-
wrapConnection
public io.vertx.sqlclient.internal.SqlConnectionInternal wrapConnection(io.vertx.core.internal.ContextInternal context, ConnectionFactory<O> factory, Connection connection) Wrap a givenconnectioninto aSqlConnectionInternal. The default implementation wraps with a genericSqlConnectionBase.- Parameters:
context- the connection contextfactory- the connection factoryconnection- the connection to wrap- Returns:
- the wrapped connection
-
newPool
public Pool newPool(Vertx vertx, Supplier<Future<O>> databases, PoolOptions options, NetClientOptions transportOptions, Handler<SqlConnection> connectHandler, io.vertx.core.internal.CloseFuture closeFuture) Description copied from interface:DriverCreate a connection pool to the database configured with the givenconnectOptionsandpoolOptions.This method is not meant to be used directly by users, instead they should use
Driver.createPool(Vertx, Supplier, PoolOptions, NetClientOptions, Handler).- Specified by:
newPoolin interfaceDriver<O extends SqlConnectOptions>- Parameters:
vertx- the Vertx instance to be used with the connection pooldatabases- the list of databasesoptions- the options for creating the pooltransportOptions- the options to configure the TCP clientconnectHandler- the connect handlercloseFuture- the close future- Returns:
- the connection pool
-
newPool
protected Pool newPool(io.vertx.core.internal.VertxInternal vertx, Handler<SqlConnection> connectHandler, Supplier<Future<O>> databases, PoolOptions poolOptions, NetClientOptions transportOptions, io.vertx.core.internal.CloseFuture closeFuture)
-