Conditions | 3 |
Paths | 3 |
Total Lines | 16 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 3.1406 |
Changes | 0 |
1 | <?php |
||
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 | } |
||
60 |