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 them
Test cases 1
Called from 1
Calls 2
public function forConnection(PDO $pdo): Platform

Answers the database platform for the connection's driver.

Parameters

$pdoPDOConnection to read the driver name off

Returns

Platform The platform for that driver

Throws

RuntimeException When ZTD has no platform for the driver, or its package is not installed
Test cases 1
Called from 1
Calls 4
public function forDriver(string $driver): Platform

Answers the database platform for a driver name.

Parameters

$driverstringDriver name, as PDO reports it

Returns

Platform The platform for that driver

Throws

RuntimeException When ZTD has no platform for the driver, or its package is not installed
Test cases 3
Called from 1
Calls 6

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
Other tests reaching this symbol 9

Relations§

Instantiated in 1
Method calls 1