classDatabaseException
class DatabaseException
extends RuntimeException
Database exception that wraps driver-specific errors.
This exception provides a unified interface for handling database errors from different drivers (PDO, mysqli, SQLite3).
Methods§
public function __construct(
string $message,
int|null $driverErrorCode = null,
int $code = 0,
Throwable|null $previous = null,
)Parameters
$message | string | Exception message. |
$driverErrorCode | int|null | Driver-specific error code. |
$code | int | Exception code. |
$previous | Throwable|null | Previous exception. |
Calls 1
- static-call
RuntimeException::__construct()line 35
public function getDriverErrorCode(): ?intGet the driver-specific error code.
Returns
?intTest cases 5
FakeErrorClassifier::isUnknownSchemaErrorcallsDatabaseExceptionTest::testCarriesEverythingADriverSaidAboutTheFailurecallsDatabaseExceptionTest::testCarriesNothingTheDriverDidNotSaycallsDatabaseExceptionTest::testGetDriverErrorCodeReturnsCodecallsDatabaseExceptionTest::testGetDriverErrorCodeReturnsNullcalls
Called from 3
- method-call ZtdQuery\Platform\MySql\Connection\MySqlErrorClassifier::isUnknownSchemaError() packages/ztd-query-mysql/src/Connection/MySqlErrorClassifier.php:37
- method-call ZtdQuery\Platform\Postgres\Connection\PgSqlErrorClassifier::isUnknownSchemaError() packages/ztd-query-postgres/src/Connection/PgSqlErrorClassifier.php:53
- method-call ZtdQuery\Platform\Sqlite\Connection\SqliteErrorClassifier::isUnknownSchemaError() packages/ztd-query-sqlite/src/Connection/SqliteErrorClassifier.php:41
Private surface 1§
Implementation details, listed for orientation only.
private ?int $driverErrorCodeTest cases 59§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 4
Other tests reaching this symbol 55
FakeErrorClassifier::isUnknownSchemaErrorcallsCopyTest::testExecDelegatesUnsupportedCopyToTheSessioncallsCopyTest::testPrepareDelegatesUnsupportedCopyToTheSessioncallsCopyTest::testQueryDelegatesUnsupportedCopyToTheSessioncallsMySqlErrorClassifierTest::testIsUnknownSchemaErrorUnknownColumnErrorIsClassifiedAsUnknownSchemacallsMySqlErrorClassifierTest::testNonSchemaErrorIsNotClassifiedAsUnknownSchemacallsMySqlErrorClassifierTest::testNullDriverCodeReturnsFalsecallsMySqlErrorClassifierTest::testTableNotExistsErrorIsClassifiedAsUnknownSchemacallsMySqlErrorClassifierTest::testUndeclaredVariableErrorIsClassifiedAsUnknownSchemacallsPgSqlErrorClassifierTest::testColumnDoesNotExistPatterncallsPgSqlErrorClassifierTest::testColumnDoesNotExistUpperCasecallsPgSqlErrorClassifierTest::testConstraintViolationNotSchemaErrorcallsPgSqlErrorClassifierTest::testDriverCodeOnlyWithoutMessageMatchcallsPgSqlErrorClassifierTest::testDriverCodeZeroIsNotSchemaErrorcallsPgSqlErrorClassifierTest::testIsUnknownSchemaErrorUndefinedColumnErrorcallsPgSqlErrorClassifierTest::testNonSchemaDriverCodeReturnsFalsecallsPgSqlErrorClassifierTest::testNullCodeAndNoPatternReturnsFalsecallsPgSqlErrorClassifierTest::testNullCodeNonSchemaMessagecallsPgSqlErrorClassifierTest::testRelationDoesNotExistPatterncallsPgSqlErrorClassifierTest::testRelationDoesNotExistUpperCasecallsPgSqlErrorClassifierTest::testSqlstate42704OnlyWithoutPatternMatchcallsPgSqlErrorClassifierTest::testSqlstate42P01OnlyWithoutPatternMatchcallsPgSqlErrorClassifierTest::testSqlstate42P02OnlyWithoutPatternMatchcallsPgSqlErrorClassifierTest::testSqlstate42P10OnlyWithoutPatternMatchcallsPgSqlErrorClassifierTest::testSqlstateOnlyWithoutPatternMatchcallsPgSqlErrorClassifierTest::testSyntaxErrorNotSchemaErrorcallsPgSqlErrorClassifierTest::testTableDoesNotExistPatterncallsPgSqlErrorClassifierTest::testTableDoesNotExistUpperCasecallsPgSqlErrorClassifierTest::testUndefinedTableErrorcallsSqliteErrorClassifierTest::testConstraintViolationIsNotUnknownSchemaErrorcallsSqliteErrorClassifierTest::testHasNoColumnNamedIsUnknownSchemaErrorcallsSqliteErrorClassifierTest::testIsUnknownSchemaErrorNoSuchTableIsUnknownSchemaErrorcallsSqliteErrorClassifierTest::testNonSqliteErrorCodeIsNotUnknownSchemaErrorcallsSqliteErrorClassifierTest::testNoSuchColumnIsUnknownSchemaErrorcallsSqliteErrorClassifierTest::testNullDriverCodeIsNotUnknownSchemaErrorcallsSqliteErrorClassifierTest::testNullDriverCodeReturnsFalseNotNullcallsSqliteErrorClassifierTest::testSyntaxErrorIsNotUnknownSchemaErrorcallsSqliteErrorClassifierTest::testUppercaseHasNoColumnNamedIsUnknownSchemaErrorcallsSqliteErrorClassifierTest::testUppercaseNoSuchColumnIsUnknownSchemaErrorcallsSqliteErrorClassifierTest::testUppercaseNoSuchTableIsUnknownSchemaErrorcallsMysqliConnectionTest::testQueryTranslatesNativeFailureWhenReportingIsDisabledcallsMysqliStatementTest::testReportsNativeExecutionErrorsWithoutParameterscallsMysqliStatementTest::testReportsNativeExecutionErrorsWithParameterscallsPdoConnectionTest::testQueryThrowsDatabaseExceptionInExceptionModecallsErrorClassifierTest::testIsUnknownSchemaErrorAnswersForAFailureThePlatformCallsOnecallsErrorClassifierTest::testIsUnknownSchemaErrorIsFalseForAFailureAboutSomethingElsecallsErrorClassifierTest::testIsUnknownSchemaErrorIsFalseForAFailureTheDriverPutNoCodeOncallsRewriteRefusalTest::testForUnknownSchemaRaisesWhereTheCallerAskedToBeToldcallsRewriteRefusalTest::testForUnsupportedRaisesWhereTheCallerAskedToBeToldcallsMysqliResultProcessorTest::testProcessPreservesTheOriginalDatabaseExceptioncallsSessionTestcallsShadowApplicationTestcallsStatementSimulatorTest::testUnsupportedSqlThrowscallsZtdPdoStatementTest::testExecuteWrapsSimulationFailureAsAdapterExceptioncallsZtdPdoTest::testPrepareWrapsUnsupportedStatementsForPdoConsumerscalls
Relations§
Instantiated in 9
- new ZtdQuery\RewriteRefusal::forUnsupported() packages/ztd-query-core/src/RewriteRefusal.php:49
- new ZtdQuery\RewriteRefusal::forUnknownSchema() packages/ztd-query-core/src/RewriteRefusal.php:76
- new ZtdQuery\Shadow\ShadowApplication::apply() packages/ztd-query-core/src/Shadow/ShadowApplication.php:76
- new ZtdQuery\Adapter\Mysqli\Driver\MysqliConnection::query() packages/ztd-query-mysqli-adapter/src/Driver/MysqliConnection.php:41
- new ZtdQuery\Adapter\Mysqli\Driver\MysqliStatement::execute() packages/ztd-query-mysqli-adapter/src/Driver/MysqliStatement.php:50
- new ZtdQuery\Adapter\Mysqli\Driver\MysqliStatement::execute() packages/ztd-query-mysqli-adapter/src/Driver/MysqliStatement.php:61
- new ZtdQuery\Adapter\Pdo\Driver\PdoConnection::query() packages/ztd-query-pdo-adapter/src/Driver/PdoConnection.php:50
- new ZtdQuery\Adapter\Pdo\Driver\PdoStatement::execute() packages/ztd-query-pdo-adapter/src/Driver/PdoStatement.php:48
- new ZtdQuery\Adapter\Pdo\Driver\PdoStatement::fetchAll() packages/ztd-query-pdo-adapter/src/Driver/PdoStatement.php:67
Method calls 5
- method-call ZtdQuery\Platform\MySql\Connection\MySqlErrorClassifier::isUnknownSchemaError() packages/ztd-query-mysql/src/Connection/MySqlErrorClassifier.php:37
- method-call ZtdQuery\Platform\Postgres\Connection\PgSqlErrorClassifier::isUnknownSchemaError() packages/ztd-query-postgres/src/Connection/PgSqlErrorClassifier.php:53
- method-call ZtdQuery\Platform\Postgres\Connection\PgSqlErrorClassifier::isUnknownSchemaError() packages/ztd-query-postgres/src/Connection/PgSqlErrorClassifier.php:55
- method-call ZtdQuery\Platform\Sqlite\Connection\SqliteErrorClassifier::isUnknownSchemaError() packages/ztd-query-sqlite/src/Connection/SqliteErrorClassifier.php:41
- method-call ZtdQuery\Platform\Sqlite\Connection\SqliteErrorClassifier::isUnknownSchemaError() packages/ztd-query-sqlite/src/Connection/SqliteErrorClassifier.php:47
Type declarations 4
- type ZtdQuery\Platform\ErrorClassifier packages/ztd-query-core/src/Platform/ErrorClassifier.php:25
- type ZtdQuery\Platform\MySql\Connection\MySqlErrorClassifier packages/ztd-query-mysql/src/Connection/MySqlErrorClassifier.php:35
- type ZtdQuery\Platform\Postgres\Connection\PgSqlErrorClassifier packages/ztd-query-postgres/src/Connection/PgSqlErrorClassifier.php:51
- type ZtdQuery\Platform\Sqlite\Connection\SqliteErrorClassifier packages/ztd-query-sqlite/src/Connection/SqliteErrorClassifier.php:39