From 047d889dbf589e440f97beec7b59b2430ed09544 Mon Sep 17 00:00:00 2001 From: halnique Date: Fri, 12 Jan 2024 16:32:11 +0900 Subject: [PATCH 1/4] fix: fixed an error when rolling back a transaction that did not execute begin --- src/Concerns/ManagesTransactions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Concerns/ManagesTransactions.php b/src/Concerns/ManagesTransactions.php index 368245a9..a79a602b 100644 --- a/src/Concerns/ManagesTransactions.php +++ b/src/Concerns/ManagesTransactions.php @@ -168,7 +168,7 @@ protected function performRollBack($toLevel) if ($this->currentTransaction !== null) { try { - if ($this->currentTransaction->state() === Transaction::STATE_ACTIVE) { + if ($this->currentTransaction->state() === Transaction::STATE_ACTIVE && $this->currentTransaction->id() !== null) { $this->currentTransaction->rollBack(); } } finally { From beef732bc72d179b84258d0d8aba02fbeea52873 Mon Sep 17 00:00:00 2001 From: halnique Date: Mon, 15 Jan 2024 13:37:25 +0900 Subject: [PATCH 2/4] test: fix cursor rollback --- tests/SessionNotFoundTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/SessionNotFoundTest.php b/tests/SessionNotFoundTest.php index af2859f6..089993bd 100644 --- a/tests/SessionNotFoundTest.php +++ b/tests/SessionNotFoundTest.php @@ -160,13 +160,13 @@ public function test_session_not_found_on_cursor(): void $passes = 0; $conn->transaction(function () use ($conn, &$passes) { - $cursor = $conn->cursor('SELECT 12345'); - if ($passes === 0) { $this->deleteSession($conn); $passes++; } + $cursor = $conn->cursor('SELECT 12345'); + $this->assertEquals([12345], $cursor->current()); $passes++; From 9613ab66ed7fddf4ca888c95db4a0eb37c611727 Mon Sep 17 00:00:00 2001 From: halnique Date: Mon, 15 Jan 2024 15:35:05 +0900 Subject: [PATCH 3/4] chore: update CHANGELOG --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7cdf774c..b13484a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,11 @@ Changed Fixed - `Schema\Grammar::compileAdd()` `Schema\Grammar::compileChange()` `Schema\Grammar::compileChange()` now create separate statements (#159) +# v6.1.2 (2024-01-xx) + +Fixed +- Fixed an error when rolling back a transaction that did not execute begin (#166) + # v6.1.1 (2023-12-11) Fixed From feff339996b9ee3fde218140679ec2b5c08a50a3 Mon Sep 17 00:00:00 2001 From: halnique Date: Tue, 16 Jan 2024 16:03:27 +0900 Subject: [PATCH 4/4] chore: fill release date --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b13484a8..5fd04358 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ Changed Fixed - `Schema\Grammar::compileAdd()` `Schema\Grammar::compileChange()` `Schema\Grammar::compileChange()` now create separate statements (#159) -# v6.1.2 (2024-01-xx) +# v6.1.2 (2024-01-16) Fixed - Fixed an error when rolling back a transaction that did not execute begin (#166)