| Conditions | 3 |
| Total Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 3.4326 |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | public function lastInsertId(?string $name = null) : string |
||
| 21 | 3 | { |
|
| 22 | 2 | if ($name === null) { |
|
| 23 | return parent::lastInsertId($name); |
||
| 24 | } |
||
| 25 | 1 | ||
| 26 | 1 | $stmt = $this->prepare('SELECT CONVERT(VARCHAR(MAX), current_value) FROM sys.sequences WHERE name = ?'); |
|
| 27 | $stmt->execute([$name]); |
||
| 28 | 1 | ||
| 29 | $result = $stmt->fetchColumn(); |
||
| 30 | |||
| 31 | if ($result === false) { |
||
| 32 | // WIP regarding exceptions, see: |
||
| 33 | // https://github.com/doctrine/dbal/pull/3335#discussion_r234381175 |
||
| 34 | 8 | throw new class ('No sequence with name "' . $name . '" found.') extends AbstractDriverException {}; |
|
| 35 | } |
||
| 36 | 8 | ||
| 37 | return (string) $result; |
||
| 38 | } |
||
| 63 |