diff options
| author | polo <ordipolo@gmx.fr> | 2024-08-13 23:45:21 +0200 |
|---|---|---|
| committer | polo <ordipolo@gmx.fr> | 2024-08-13 23:45:21 +0200 |
| commit | bf6655a534a6775d30cafa67bd801276bda1d98d (patch) | |
| tree | c6381e3f6c81c33eab72508f410b165ba05f7e9c /vendor/doctrine/dbal/src/Driver/API/IBMDB2 | |
| parent | 94d67a4b51f8e62e7d518cce26a526ae1ec48278 (diff) | |
| download | AppliGestionPHP-bf6655a534a6775d30cafa67bd801276bda1d98d.tar.gz AppliGestionPHP-bf6655a534a6775d30cafa67bd801276bda1d98d.tar.bz2 AppliGestionPHP-bf6655a534a6775d30cafa67bd801276bda1d98d.zip | |
VERSION 0.2 doctrine ORM et entités
Diffstat (limited to 'vendor/doctrine/dbal/src/Driver/API/IBMDB2')
| -rw-r--r-- | vendor/doctrine/dbal/src/Driver/API/IBMDB2/ExceptionConverter.php | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/vendor/doctrine/dbal/src/Driver/API/IBMDB2/ExceptionConverter.php b/vendor/doctrine/dbal/src/Driver/API/IBMDB2/ExceptionConverter.php new file mode 100644 index 0000000..bcd5554 --- /dev/null +++ b/vendor/doctrine/dbal/src/Driver/API/IBMDB2/ExceptionConverter.php | |||
| @@ -0,0 +1,47 @@ | |||
| 1 | <?php | ||
| 2 | |||
| 3 | declare(strict_types=1); | ||
| 4 | |||
| 5 | namespace Doctrine\DBAL\Driver\API\IBMDB2; | ||
| 6 | |||
| 7 | use Doctrine\DBAL\Driver\API\ExceptionConverter as ExceptionConverterInterface; | ||
| 8 | use Doctrine\DBAL\Driver\Exception; | ||
| 9 | use Doctrine\DBAL\Exception\ConnectionException; | ||
| 10 | use Doctrine\DBAL\Exception\DriverException; | ||
| 11 | use Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException; | ||
| 12 | use Doctrine\DBAL\Exception\InvalidFieldNameException; | ||
| 13 | use Doctrine\DBAL\Exception\NonUniqueFieldNameException; | ||
| 14 | use Doctrine\DBAL\Exception\NotNullConstraintViolationException; | ||
| 15 | use Doctrine\DBAL\Exception\SyntaxErrorException; | ||
| 16 | use Doctrine\DBAL\Exception\TableExistsException; | ||
| 17 | use Doctrine\DBAL\Exception\TableNotFoundException; | ||
| 18 | use Doctrine\DBAL\Exception\UniqueConstraintViolationException; | ||
| 19 | use Doctrine\DBAL\Query; | ||
| 20 | |||
| 21 | /** | ||
| 22 | * @internal | ||
| 23 | * | ||
| 24 | * @link https://www.ibm.com/docs/en/db2/11.5?topic=messages-sql | ||
| 25 | */ | ||
| 26 | final class ExceptionConverter implements ExceptionConverterInterface | ||
| 27 | { | ||
| 28 | public function convert(Exception $exception, ?Query $query): DriverException | ||
| 29 | { | ||
| 30 | return match ($exception->getCode()) { | ||
| 31 | -104 => new SyntaxErrorException($exception, $query), | ||
| 32 | -203 => new NonUniqueFieldNameException($exception, $query), | ||
| 33 | -204 => new TableNotFoundException($exception, $query), | ||
| 34 | -206 => new InvalidFieldNameException($exception, $query), | ||
| 35 | -407 => new NotNullConstraintViolationException($exception, $query), | ||
| 36 | -530, | ||
| 37 | -531, | ||
| 38 | -532, | ||
| 39 | -20356 => new ForeignKeyConstraintViolationException($exception, $query), | ||
| 40 | -601 => new TableExistsException($exception, $query), | ||
| 41 | -803 => new UniqueConstraintViolationException($exception, $query), | ||
| 42 | -1336, | ||
| 43 | -30082 => new ConnectionException($exception, $query), | ||
| 44 | default => new DriverException($exception, $query), | ||
| 45 | }; | ||
| 46 | } | ||
| 47 | } | ||
