classDriverPlatform
final class DriverPlatform
Restricted visibility: declared "@visibility ZtdQuery\Adapter\Pdo". Code outside that scope must not name this declaration.
Answers the database platform 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 themTest cases 1
Called from 1
Calls 2
- function-call
array_keysline 53 - class-const DriverPlatform::DRIVER_MAP() line 53
public function forConnection(PDO $pdo): PlatformAnswers the database platform for the connection's driver.
Parameters
$pdo | PDO | Connection to read the driver name off |
Returns
Platform The platform for that driverThrows
RuntimeException When ZTD has no platform for the driver, or its package is not installedTest cases 1
Called from 1
Calls 4
- method-call
PDO::getAttribute()line 67 - class-const
PDO::ATTR_DRIVER_NAME()line 67 - method-call DriverPlatform::forDriver() line 69
- function-call
is_stringline 69
public function forDriver(string $driver): PlatformAnswers the database platform for a driver name.
Parameters
$driver | string | Driver name, as PDO reports it |
Returns
Platform The platform 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 DriverPlatform::DRIVER_MAP() line 83
- new
RuntimeExceptionline 84 - function-call
sprintfline 84 - function-call
implodeline 87 - method-call DriverPlatform::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<Platform>, package: string}> DRIVER_MAP = ['mysql' => ['class' => \ZtdQuery\Platform\MySql\MySqlPlatform::class, 'package…Test cases 14§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 5
DriverPlatformTest::testDriverNamesAnswersEveryDriverZtdHasAPlatformForcallsDriverPlatformTest::testForConnectionReadsTheDriverOffTheConnectioncallsDriverPlatformTest::testForDriverAnswersThePlatformThatDriverSpeakscallsDriverPlatformTest::testForDriverNamesEverySupportedDriverWhenItRefusesOnecallsDriverPlatformTest::testForDriverRefusesADriverZtdHasNoPlatformForcalls
Other tests reaching this symbol 9
PdoConnectionTestcallsPdoStatementTestcallsConnectionExecutionTestcallsParameterBinderTestcallsPreparedQueryTestcallsStatementExecutionTestcallsZtdPdoExceptionTestcallsZtdPdoStatementTestcallsZtdPdoTestcalls