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/SQLite3/Driver.php | |
| 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/SQLite3/Driver.php')
| -rw-r--r-- | vendor/doctrine/dbal/src/Driver/SQLite3/Driver.php | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/vendor/doctrine/dbal/src/Driver/SQLite3/Driver.php b/vendor/doctrine/dbal/src/Driver/SQLite3/Driver.php new file mode 100644 index 0000000..e6996d3 --- /dev/null +++ b/vendor/doctrine/dbal/src/Driver/SQLite3/Driver.php | |||
| @@ -0,0 +1,48 @@ | |||
| 1 | <?php | ||
| 2 | |||
| 3 | declare(strict_types=1); | ||
| 4 | |||
| 5 | namespace Doctrine\DBAL\Driver\SQLite3; | ||
| 6 | |||
| 7 | use Doctrine\DBAL\Driver\AbstractSQLiteDriver; | ||
| 8 | use SensitiveParameter; | ||
| 9 | use SQLite3; | ||
| 10 | |||
| 11 | final class Driver extends AbstractSQLiteDriver | ||
| 12 | { | ||
| 13 | /** | ||
| 14 | * {@inheritDoc} | ||
| 15 | */ | ||
| 16 | public function connect( | ||
| 17 | #[SensitiveParameter] | ||
| 18 | array $params, | ||
| 19 | ): Connection { | ||
| 20 | $isMemory = $params['memory'] ?? false; | ||
| 21 | |||
| 22 | if (isset($params['path'])) { | ||
| 23 | if ($isMemory) { | ||
| 24 | throw new Exception( | ||
| 25 | 'Invalid connection settings: specifying both parameters "path" and "memory" is ambiguous.', | ||
| 26 | ); | ||
| 27 | } | ||
| 28 | |||
| 29 | $filename = $params['path']; | ||
| 30 | } elseif ($isMemory) { | ||
| 31 | $filename = ':memory:'; | ||
| 32 | } else { | ||
| 33 | throw new Exception( | ||
| 34 | 'Invalid connection settings: specify either the "path" or the "memory" parameter for SQLite3.', | ||
| 35 | ); | ||
| 36 | } | ||
| 37 | |||
| 38 | try { | ||
| 39 | $connection = new SQLite3($filename); | ||
| 40 | } catch (\Exception $e) { | ||
| 41 | throw Exception::new($e); | ||
| 42 | } | ||
| 43 | |||
| 44 | $connection->enableExceptions(true); | ||
| 45 | |||
| 46 | return new Connection($connection); | ||
| 47 | } | ||
| 48 | } | ||
