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 6... Zeile 6...
6
use Doctrine\DBAL\Driver\PDO\Connection;
6
use Doctrine\DBAL\Driver\PDO\Connection;
7
use Doctrine\DBAL\Driver\PDO\Exception;
7
use Doctrine\DBAL\Driver\PDO\Exception;
8
use Doctrine\Deprecations\Deprecation;
8
use Doctrine\Deprecations\Deprecation;
9
use PDO;
9
use PDO;
10
use PDOException;
10
use PDOException;
-
 
11
use SensitiveParameter;
Zeile 11... Zeile 12...
11
 
12
 
12
final class Driver extends AbstractPostgreSQLDriver
13
final class Driver extends AbstractPostgreSQLDriver
13
{
14
{
14
    /**
15
    /**
15
     * {@inheritdoc}
16
     * {@inheritdoc}
16
     *
17
     *
17
     * @return Connection
18
     * @return Connection
18
     */
19
     */
-
 
20
    public function connect(
-
 
21
        #[SensitiveParameter]
19
    public function connect(array $params)
22
        array $params
20
    {
23
    ) {
Zeile 21... Zeile 24...
21
        $driverOptions = $params['driverOptions'] ?? [];
24
        $driverOptions = $params['driverOptions'] ?? [];
22
 
25
 
23
        if (! empty($params['persistent'])) {
26
        if (! empty($params['persistent'])) {
Zeile -... Zeile 27...
-
 
27
            $driverOptions[PDO::ATTR_PERSISTENT] = true;
-
 
28
        }
-
 
29
 
24
            $driverOptions[PDO::ATTR_PERSISTENT] = true;
30
        $safeParams = $params;
25
        }
31
        unset($safeParams['password'], $safeParams['url']);
26
 
32
 
27
        try {
33
        try {
28
            $pdo = new PDO(
34
            $pdo = new PDO(
29
                $this->constructPdoDsn($params),
35
                $this->constructPdoDsn($safeParams),
30
                $params['user'] ?? '',
36
                $params['user'] ?? '',
31
                $params['password'] ?? '',
37
                $params['password'] ?? '',
Zeile 55... Zeile 61...
55
    }
61
    }
Zeile 56... Zeile 62...
56
 
62
 
57
    /**
63
    /**
58
     * Constructs the Postgres PDO DSN.
64
     * Constructs the Postgres PDO DSN.
59
     *
65
     *
60
     * @param mixed[] $params
66
     * @param array<string, mixed> $params
61
     */
67
     */
62
    private function constructPdoDsn(array $params): string
68
    private function constructPdoDsn(array $params): string
63
    {
69
    {