Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 148 | Ganze Datei anzeigen | Leerzeichen ignorieren | Details | Blame | Letzte Änderung | Log anzeigen | RSS feed

Revision 148 Revision 621
Zeile 7... Zeile 7...
7
use Doctrine\DBAL\Driver\PDO\Connection;
7
use Doctrine\DBAL\Driver\PDO\Connection;
8
use Doctrine\DBAL\Driver\PDO\Exception;
8
use Doctrine\DBAL\Driver\PDO\Exception;
9
use Doctrine\Deprecations\Deprecation;
9
use Doctrine\Deprecations\Deprecation;
10
use PDO;
10
use PDO;
11
use PDOException;
11
use PDOException;
-
 
12
use SensitiveParameter;
-
 
13
 
-
 
14
use function array_intersect_key;
Zeile 12... Zeile 15...
12
 
15
 
13
final class Driver extends AbstractSQLiteDriver
16
final class Driver extends AbstractSQLiteDriver
14
{
17
{
15
    /**
18
    /**
16
     * {@inheritdoc}
19
     * {@inheritdoc}
17
     *
20
     *
18
     * @return Connection
21
     * @return Connection
19
     */
22
     */
-
 
23
    public function connect(
-
 
24
        #[SensitiveParameter]
20
    public function connect(array $params)
25
        array $params
21
    {
26
    ) {
22
        $driverOptions        = $params['driverOptions'] ?? [];
27
        $driverOptions        = $params['driverOptions'] ?? [];
Zeile 23... Zeile 28...
23
        $userDefinedFunctions = [];
28
        $userDefinedFunctions = [];
24
 
29
 
Zeile 34... Zeile 39...
34
            unset($driverOptions['userDefinedFunctions']);
39
            unset($driverOptions['userDefinedFunctions']);
35
        }
40
        }
Zeile 36... Zeile 41...
36
 
41
 
37
        try {
42
        try {
38
            $pdo = new PDO(
43
            $pdo = new PDO(
39
                $this->constructPdoDsn($params),
44
                $this->constructPdoDsn(array_intersect_key($params, ['path' => true, 'memory' => true])),
40
                $params['user'] ?? '',
45
                $params['user'] ?? '',
41
                $params['password'] ?? '',
46
                $params['password'] ?? '',
42
                $driverOptions,
47
                $driverOptions,
43
            );
48
            );
Zeile 54... Zeile 59...
54
    }
59
    }
Zeile 55... Zeile 60...
55
 
60
 
56
    /**
61
    /**
57
     * Constructs the Sqlite PDO DSN.
62
     * Constructs the Sqlite PDO DSN.
58
     *
63
     *
59
     * @param mixed[] $params
64
     * @param array<string, mixed> $params
60
     */
65
     */
61
    private function constructPdoDsn(array $params): string
66
    private function constructPdoDsn(array $params): string
62
    {
67
    {
63
        $dsn = 'sqlite:';
68
        $dsn = 'sqlite:';