From 92801909a1a7e8cdb949c2bb4050d9a79a94958c Mon Sep 17 00:00:00 2001 From: HAYAMA Kaoru <3752189+hymkor@users.noreply.github.com> Date: Tue, 11 Nov 2025 23:18:02 +0900 Subject: [PATCH 1/2] Enable `REPLACE` to execute within a transaction and returns count of affected rows --- loop.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/loop.go b/loop.go index e819c3a..eb5bd2a 100644 --- a/loop.go +++ b/loop.go @@ -175,7 +175,9 @@ func (ss *session) Loop(ctx context.Context, commandIn commandIn) error { case "SAVEPOINT", "SAVE", "RELEASE": misc.Echo(ss.spool, query) err = doTCL(ctx, ss, query) - case "DELETE", "INSERT", "UPDATE", "MERGE": + + // Updates returning affected row count, safe in transaction + case "DELETE", "INSERT", "UPDATE", "MERGE", "REPLACE": misc.Echo(ss.spool, query) isNewTx := (ss.tx == nil) err = ss.beginTx(ctx, ss.stdErr) From c0391124f449e4b96fa6f9fe8bf0e178ab2bc98c Mon Sep 17 00:00:00 2001 From: HAYAMA Kaoru <3752189+hymkor@users.noreply.github.com> Date: Wed, 12 Nov 2025 02:25:23 +0900 Subject: [PATCH 2/2] Release notes: mentioned #20 (`REPLACE`) --- release_note_en.md | 2 +- release_note_ja.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/release_note_en.md b/release_note_en.md index df9b253..b866c67 100644 --- a/release_note_en.md +++ b/release_note_en.md @@ -6,7 +6,7 @@ ### Specification Changes -- Enable `RELEASE SAVEPOINT` to execute within a transaction. (#19) +- Enable `RELEASE SAVEPOINT`(#19) and `REPLACE INTO`(#20,MySQL) to execute within a transaction. v0.26.0 ======= diff --git a/release_note_ja.md b/release_note_ja.md index f8e06b8..a2c5fae 100644 --- a/release_note_ja.md +++ b/release_note_ja.md @@ -6,7 +6,7 @@ ### 仕様変更 -- `RELEASE SAVEPOINT` もトランザクション内で実行できるようにした。(#19) +- `RELEASE SAVEPOINT` (#19), `REPLACE INTO` (#20,MySQL) もトランザクション内で実行できるようにした。 v0.26.0 =======