classDriverSessionFactory
final class DriverSessionFactory
Restricted visibility: declared "@visibility ZtdQuery\Adapter\Pdo". Code outside that scope must not name this declaration.
Answers the session factory a connection's driver needs.
A PDO connection says which driver it speaks; each driver ZTD supports has a platform package that knows how to rewrite that dialect. This is the one place that pairing is written down, so nothing else has to guess it from a driver name.
Methods§
public function driverNames(): list<string>Answers every driver name ZTD has a platform package for.
Returns
list<string> The driver names, as PDO reports themCalled from 1
Calls 2
- function-call
array_keysline 53 - class-const DriverSessionFactory::DRIVER_MAP() line 53
public function forConnection(PDO $pdo): SessionFactoryAnswers the factory that builds a session for the connection's driver.
Parameters
$pdo | PDO | Connection to read the driver name off |
Returns
SessionFactory The factory for that driverThrows
RuntimeException When ZTD has no platform for the driver, or its package is not installedCalled from 1
Calls 4
- method-call
PDO::getAttribute()line 67 - class-const
PDO::ATTR_DRIVER_NAME()line 67 - method-call DriverSessionFactory::forDriver() line 69
- function-call
is_stringline 69
public function forDriver(string $driver): SessionFactoryAnswers the factory that builds a session for a driver name.
Parameters
$driver | string | Driver name, as PDO reports it |
Returns
SessionFactory The factory for that driverThrows
RuntimeException When ZTD has no platform for the driver, or its package is not installedTest cases 3
Called from 1
Calls 6
- class-const DriverSessionFactory::DRIVER_MAP() line 83
- new
RuntimeExceptionline 84 - function-call
sprintfline 84 - function-call
implodeline 87 - method-call DriverSessionFactory::driverNames() line 87
- function-call
class_existsline 94
Private surface 1§
Implementation details, listed for orientation only.
private const array<string, array{class: class-string<SessionFactory>, package: string}> DRIVER_MAP = ['mysql' => ['class' => \ZtdQuery\Platform\MySql\MySqlSessionFactory::class, 'p…Test cases 14§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 5
DriverSessionFactoryTest::testDriverNamesAnswersEveryDriverZtdHasAPlatformForcallsDriverSessionFactoryTest::testForConnectionReadsTheDriverOffTheConnectioncallsDriverSessionFactoryTest::testForDriverAnswersThePlatformThatDriverSpeakscallsDriverSessionFactoryTest::testForDriverNamesEverySupportedDriverWhenItRefusesOnecallsDriverSessionFactoryTest::testForDriverRefusesADriverZtdHasNoPlatformForcalls
Other tests reaching this symbol 9
PdoConnectionTestcallsPdoStatementTestcallsConnectionExecutionTestcallsParameterBinderTestcallsPreparedQueryTestcallsStatementExecutionTestcallsZtdPdoExceptionTestcallsZtdPdoStatementTestcallsZtdPdoTestcalls