summaryrefslogtreecommitdiff
path: root/vendor/doctrine/dbal/src/Driver/API/SQLite
diff options
context:
space:
mode:
authorpolo <ordipolo@gmx.fr>2026-10-18 00:08:23 +0200
committerpolo <ordipolo@gmx.fr>2026-10-18 00:10:03 +0200
commit05e38eadbeb3de19e5b26003c2b401e00bb71df4 (patch)
treecf48350b69cfce92de6f3a0e03eb0876931c7077 /vendor/doctrine/dbal/src/Driver/API/SQLite
parent32843e50aa981f190bdb4fbc9adbeacc06fdf775 (diff)
downloadAppliGestionPHP-05e38eadbeb3de19e5b26003c2b401e00bb71df4.tar.gz
AppliGestionPHP-05e38eadbeb3de19e5b26003c2b401e00bb71df4.tar.bz2
AppliGestionPHP-05e38eadbeb3de19e5b26003c2b401e00bb71df4.zip
sortie de vendor du dépôt, oubli dans config-template.ini
Diffstat (limited to 'vendor/doctrine/dbal/src/Driver/API/SQLite')
-rw-r--r--vendor/doctrine/dbal/src/Driver/API/SQLite/ExceptionConverter.php85
1 files changed, 0 insertions, 85 deletions
diff --git a/vendor/doctrine/dbal/src/Driver/API/SQLite/ExceptionConverter.php b/vendor/doctrine/dbal/src/Driver/API/SQLite/ExceptionConverter.php
deleted file mode 100644
index 5885195..0000000
--- a/vendor/doctrine/dbal/src/Driver/API/SQLite/ExceptionConverter.php
+++ /dev/null
@@ -1,85 +0,0 @@
1<?php
2
3declare(strict_types=1);
4
5namespace Doctrine\DBAL\Driver\API\SQLite;
6
7use Doctrine\DBAL\Driver\API\ExceptionConverter as ExceptionConverterInterface;
8use Doctrine\DBAL\Driver\Exception;
9use Doctrine\DBAL\Exception\ConnectionException;
10use Doctrine\DBAL\Exception\DriverException;
11use Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException;
12use Doctrine\DBAL\Exception\InvalidFieldNameException;
13use Doctrine\DBAL\Exception\LockWaitTimeoutException;
14use Doctrine\DBAL\Exception\NonUniqueFieldNameException;
15use Doctrine\DBAL\Exception\NotNullConstraintViolationException;
16use Doctrine\DBAL\Exception\ReadOnlyException;
17use Doctrine\DBAL\Exception\SyntaxErrorException;
18use Doctrine\DBAL\Exception\TableExistsException;
19use Doctrine\DBAL\Exception\TableNotFoundException;
20use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
21use Doctrine\DBAL\Query;
22
23use function str_contains;
24
25/** @internal */
26final class ExceptionConverter implements ExceptionConverterInterface
27{
28 /** @link http://www.sqlite.org/c3ref/c_abort.html */
29 public function convert(Exception $exception, ?Query $query): DriverException
30 {
31 if (str_contains($exception->getMessage(), 'database is locked')) {
32 return new LockWaitTimeoutException($exception, $query);
33 }
34
35 if (
36 str_contains($exception->getMessage(), 'must be unique') ||
37 str_contains($exception->getMessage(), 'is not unique') ||
38 str_contains($exception->getMessage(), 'are not unique') ||
39 str_contains($exception->getMessage(), 'UNIQUE constraint failed')
40 ) {
41 return new UniqueConstraintViolationException($exception, $query);
42 }
43
44 if (
45 str_contains($exception->getMessage(), 'may not be NULL') ||
46 str_contains($exception->getMessage(), 'NOT NULL constraint failed')
47 ) {
48 return new NotNullConstraintViolationException($exception, $query);
49 }
50
51 if (str_contains($exception->getMessage(), 'no such table:')) {
52 return new TableNotFoundException($exception, $query);
53 }
54
55 if (str_contains($exception->getMessage(), 'already exists')) {
56 return new TableExistsException($exception, $query);
57 }
58
59 if (str_contains($exception->getMessage(), 'has no column named')) {
60 return new InvalidFieldNameException($exception, $query);
61 }
62
63 if (str_contains($exception->getMessage(), 'ambiguous column name')) {
64 return new NonUniqueFieldNameException($exception, $query);
65 }
66
67 if (str_contains($exception->getMessage(), 'syntax error')) {
68 return new SyntaxErrorException($exception, $query);
69 }
70
71 if (str_contains($exception->getMessage(), 'attempt to write a readonly database')) {
72 return new ReadOnlyException($exception, $query);
73 }
74
75 if (str_contains($exception->getMessage(), 'unable to open database file')) {
76 return new ConnectionException($exception, $query);
77 }
78
79 if (str_contains($exception->getMessage(), 'FOREIGN KEY constraint failed')) {
80 return new ForeignKeyConstraintViolationException($exception, $query);
81 }
82
83 return new DriverException($exception, $query);
84 }
85}