Skip to content

Commit 7048ba8

Browse files
committed
fix SQLSRV
1 parent 53e935b commit 7048ba8

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

system/Database/SQLSRV/Connection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ private function isUniqueConstraintViolation(): bool
555555

556556
foreach ($errors as $error) {
557557
// SQLSTATE 23000 (integrity constraint violation) with SQL Server error
558-
// 2627 (primary key violation) or 2601 (unique index violation).
558+
// 2627 (UNIQUE CONSTRAINT or PRIMARY KEY violation) or 2601 (UNIQUE INDEX violation).
559559
if (($error['SQLSTATE'] ?? '') === '23000'
560560
&& in_array($error['code'] ?? 0, [2627, 2601], true)) {
561561
return true;

tests/system/Database/Live/UniqueConstraintViolationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function testReturnsFalseAndErrorIsPopulatedWithDebugDisabled(): void
7070
'MySQLi' => 1062,
7171
'Postgre' => '23505',
7272
'SQLite3' => 19,
73-
'SQLSRV' => '23000/2601',
73+
'SQLSRV' => '23000/2627',
7474
'OCI8' => 1,
7575
default => $this->fail('No expected error code defined for DB driver: ' . $this->db->DBDriver),
7676
};

0 commit comments

Comments
 (0)