Total Complexity | 6 |
Total Lines | 44 |
Duplicated Lines | 0 % |
Coverage | 62.5% |
Changes | 0 |
1 | <?php |
||
14 | class Connection extends PDOConnection implements \Doctrine\DBAL\Driver\Connection |
||
15 | { |
||
16 | /** |
||
17 | * {@inheritDoc} |
||
18 | */ |
||
19 | 5 | public function lastInsertId(?string $name = null) : string |
|
20 | { |
||
21 | 5 | if ($name === null) { |
|
22 | 3 | return parent::lastInsertId($name); |
|
23 | } |
||
24 | |||
25 | 2 | $stmt = $this->prepare('SELECT CONVERT(VARCHAR(MAX), current_value) FROM sys.sequences WHERE name = ?'); |
|
26 | 2 | $stmt->execute([$name]); |
|
27 | |||
28 | 2 | $result = $stmt->fetchColumn(); |
|
29 | |||
30 | 2 | if ($result === false) { |
|
31 | 1 | throw DriverException::noSuchSequence($name); |
|
32 | } |
||
33 | |||
34 | 1 | return (string) $result; |
|
35 | } |
||
36 | |||
37 | /** |
||
38 | * {@inheritDoc} |
||
39 | */ |
||
40 | 7 | public function quote(string $value) : string |
|
50 | } |
||
51 | |||
52 | /** |
||
53 | * {@inheritDoc} |
||
54 | */ |
||
55 | 246 | protected function createStatement(\PDOStatement $stmt) : PDOStatement |
|
58 | } |
||
59 | } |
||
60 |