API Index — Namespaces, Packages, Reports, Indices
PoolDriver
in
Connection-library adapter for {@see DbConnectionPool}.
The pool itself is connection-agnostic — it manages a bounded channel of
opaque connection objects and delegates everything library-specific
(connect, transaction lifecycle, liveness, teardown) to a driver. This is
what lets one pool implementation serve both PDO (pdo:) and mysqli, and
makes a third driver (a coroutine-native client, say) a drop-in.
Tags
Table of Contents
Methods
- begin() : void
- commit() : void
- connect() : TConn
- Open a fresh connection. Throwing here propagates out of the pool's fill/refill path (the caller sees the underlying connect error).
- disconnect() : void
- Tear down a connection. PDO closes on reference release so this can be a
no-op there; mysqli needs an explicit
close(). - isAlive() : bool
- Liveness probe — run
$queryand return false if the connection is dead (server closed it while idle). Only called when the pool was configured with a validation query. - rollback() : void
- rollbackIfNeeded() : void
- Make a borrowed connection transaction-clean before it returns to the
pool: roll back any transaction the borrower left open. Drivers that
cannot introspect transaction state (mysqli has no
inTransaction()) may no-op — see {@see MysqliDriver} for the documented limitation.
Methods
begin()
public
begin(TConn $conn) : void
Parameters
- $conn : TConn
commit()
public
commit(TConn $conn) : void
Parameters
- $conn : TConn
connect()
Open a fresh connection. Throwing here propagates out of the pool's fill/refill path (the caller sees the underlying connect error).
public
connect() : TConn
Return values
TConndisconnect()
Tear down a connection. PDO closes on reference release so this can be a
no-op there; mysqli needs an explicit close().
public
disconnect(TConn $conn) : void
Parameters
- $conn : TConn
isAlive()
Liveness probe — run $query and return false if the connection is
dead (server closed it while idle). Only called when the pool was
configured with a validation query.
public
isAlive(TConn $conn, string $query) : bool
Parameters
- $conn : TConn
- $query : string
Return values
boolrollback()
public
rollback(TConn $conn) : void
Parameters
- $conn : TConn
rollbackIfNeeded()
Make a borrowed connection transaction-clean before it returns to the
pool: roll back any transaction the borrower left open. Drivers that
cannot introspect transaction state (mysqli has no inTransaction())
may no-op — see {@see MysqliDriver} for the documented limitation.
public
rollbackIfNeeded(TConn $conn) : void
Parameters
- $conn : TConn