classSqliteErrorClassifier
final class SqliteErrorClassifier
implements ErrorClassifier
Public API: explicitly declared with
@visibility public.SQLite-specific error classifier.
Classifies SQLite error codes to determine the type of error. SQLite uses SQLITE_ERROR (1) for general SQL errors including unknown columns and tables. More specific codes are available via extended error codes.
$classifier = new \ZtdQuery\Platform\Sqlite\Connection\SqliteErrorClassifier();
$error = new \ZtdQuery\Connection\Exception\DatabaseException("no such table: users", 1);
$classifier->isUnknownSchemaError($error) // => trueMethods§
public function isUnknownSchemaError(DatabaseException $e): boolPublic API: explicitly declared with
@visibility public.{@inheritDoc}
Parameters
Returns
bool$classifier = new \ZtdQuery\Platform\Sqlite\Connection\SqliteErrorClassifier();
$error = new \ZtdQuery\Connection\Exception\DatabaseException("no such table: users", 1);
$classifier->isUnknownSchemaError($error) // => true
$classifier->isUnknownSchemaError(new \ZtdQuery\Connection\Exception\DatabaseException("syntax error", 1)) // => falseTest cases 11
SqliteErrorClassifierTest::testConstraintViolationIsNotUnknownSchemaErrorcallsSqliteErrorClassifierTest::testHasNoColumnNamedIsUnknownSchemaErrorcallsSqliteErrorClassifierTest::testIsUnknownSchemaErrorNoSuchTableIsUnknownSchemaErrorcallsSqliteErrorClassifierTest::testNonSqliteErrorCodeIsNotUnknownSchemaErrorcallsSqliteErrorClassifierTest::testNoSuchColumnIsUnknownSchemaErrorcallsSqliteErrorClassifierTest::testNullDriverCodeIsNotUnknownSchemaErrorcallsSqliteErrorClassifierTest::testNullDriverCodeReturnsFalseNotNullcallsSqliteErrorClassifierTest::testSyntaxErrorIsNotUnknownSchemaErrorcallsSqliteErrorClassifierTest::testUppercaseHasNoColumnNamedIsUnknownSchemaErrorcallsSqliteErrorClassifierTest::testUppercaseNoSuchColumnIsUnknownSchemaErrorcallsSqliteErrorClassifierTest::testUppercaseNoSuchTableIsUnknownSchemaErrorcalls
Calls 5
- method-call DatabaseException::getDriverErrorCode() line 41
- class-const SqliteErrorClassifier::SQLITE_ERROR() line 46
- function-call
strtolowerline 47 - method-call DatabaseException::getMessage() line 47
- function-call
str_containsline 49
Private surface 1§
Implementation details, listed for orientation only.
private const SQLITE_ERROR = 1Test cases 11§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 11
SqliteErrorClassifierTest::testConstraintViolationIsNotUnknownSchemaErrorcallsSqliteErrorClassifierTest::testHasNoColumnNamedIsUnknownSchemaErrorcallsSqliteErrorClassifierTest::testIsUnknownSchemaErrorNoSuchTableIsUnknownSchemaErrorcallsSqliteErrorClassifierTest::testNonSqliteErrorCodeIsNotUnknownSchemaErrorcallsSqliteErrorClassifierTest::testNoSuchColumnIsUnknownSchemaErrorcallsSqliteErrorClassifierTest::testNullDriverCodeIsNotUnknownSchemaErrorcallsSqliteErrorClassifierTest::testNullDriverCodeReturnsFalseNotNullcallsSqliteErrorClassifierTest::testSyntaxErrorIsNotUnknownSchemaErrorcallsSqliteErrorClassifierTest::testUppercaseHasNoColumnNamedIsUnknownSchemaErrorcallsSqliteErrorClassifierTest::testUppercaseNoSuchColumnIsUnknownSchemaErrorcallsSqliteErrorClassifierTest::testUppercaseNoSuchTableIsUnknownSchemaErrorcalls