| Total Complexity | 5 |
| Total Lines | 40 |
| Duplicated Lines | 0 % |
| Coverage | 61.9% |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | class Connection extends PDOConnection implements \Doctrine\DBAL\Driver\Connection |
||
| 15 | { |
||
| 16 | /** |
||
| 17 | * {@inheritDoc} |
||
| 18 | */ |
||
| 19 | 2 | public function getSequenceNumber(string $name) : string |
|
| 20 | { |
||
| 21 | 2 | $stmt = $this->prepare('SELECT CONVERT(VARCHAR(MAX), current_value) FROM sys.sequences WHERE name = ?'); |
|
| 22 | 2 | $stmt->execute([$name]); |
|
| 23 | |||
| 24 | 2 | $result = $stmt->fetchColumn(); |
|
| 25 | |||
| 26 | 2 | if ($result === false) { |
|
| 27 | 1 | throw DriverException::noSuchSequence($name); |
|
| 28 | } |
||
| 29 | |||
| 30 | 1 | return (string) $result; |
|
| 31 | } |
||
| 32 | |||
| 33 | /** |
||
| 34 | * {@inheritDoc} |
||
| 35 | */ |
||
| 36 | 7 | public function quote(string $value) : string |
|
| 37 | { |
||
| 38 | 7 | $val = parent::quote($value); |
|
| 39 | |||
| 40 | // Fix for a driver version terminating all values with null byte |
||
| 41 | 7 | if (strpos($val, "\0") !== false) { |
|
| 42 | $val = substr($val, 0, -1); |
||
| 43 | } |
||
| 44 | |||
| 45 | 7 | return $val; |
|
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * {@inheritDoc} |
||
| 50 | */ |
||
| 51 | 246 | protected function createStatement(\PDOStatement $stmt) : PDOStatement |
|
| 54 | } |
||
| 55 | } |
||
| 56 |