final class PgSqlErrorClassifier
    implements ErrorClassifier
Public API: explicitly declared with @visibility public.

PostgreSQL-specific error classifier.

Classifies PostgreSQL SQLSTATE codes to determine the type of error. PostgreSQL uses 5-character SQLSTATE codes; driver error codes are mapped from these.

Distinguish schema errors from syntax errorsdoctest
$classifier = new \ZtdQuery\Platform\Postgres\Connection\PgSqlErrorClassifier();
    $classifier->isUnknownSchemaError(new \ZtdQuery\Connection\Exception\DatabaseException('42P01: relation "users" does not exist')) // => true
    $classifier->isUnknownSchemaError(new \ZtdQuery\Connection\Exception\DatabaseException('42601: syntax error')) // => false

Methods§

public function isUnknownSchemaError(DatabaseException $e): bool
Public API: explicitly declared with @visibility public.

{@inheritDoc}

Parameters

Returns

bool
Distinguish schema errors from syntax errorsdoctest
$classifier = new \ZtdQuery\Platform\Postgres\Connection\PgSqlErrorClassifier();
    $classifier->isUnknownSchemaError(new \ZtdQuery\Connection\Exception\DatabaseException('42P01: relation "users" does not exist')) // => true
    $classifier->isUnknownSchemaError(new \ZtdQuery\Connection\Exception\DatabaseException('42601: syntax error')) // => false
Test cases 20
Calls 7

Private surface 2§

Implementation details, listed for orientation only.

private const SCHEMA_ERROR_CODES = [7]
private const SCHEMA_SQLSTATES = [
    '42703',
    // undefined_column
    '42P01',
    // undefined_table
    …

Test cases 20§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 20