From ce2791899902f9b2ad080b194244e419bed28a24 Mon Sep 17 00:00:00 2001 From: HAYAMA Kaoru <3752189+hymkor@users.noreply.github.com> Date: Wed, 12 Nov 2025 16:21:12 +0900 Subject: [PATCH 1/2] SQL Server: Fixed an issue where `ROLLBACK TRANSACTION` without a savepoint was not recognized as ending the transaction, causing the prompt to remain as `SQL*` --- loop.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/loop.go b/loop.go index 41cf921..17bb30d 100644 --- a/loop.go +++ b/loop.go @@ -164,11 +164,18 @@ func (ss *session) Loop(ctx context.Context, commandIn commandIn) error { err = doSelect(ctx, ss, query, nil, commandIn) case "ROLLBACK": misc.Echo(ss.spool, query) - arg, _ = misc.CutField(arg) + var rest string + arg, rest = misc.CutField(arg) if arg == "" { err = ss.rollback() - } else if strings.EqualFold(arg, "TO") || strings.EqualFold(arg, "TRANSACTION") { + } else if strings.EqualFold(arg, "TO") { err = doTCL(ctx, ss, query) + } else if strings.EqualFold(arg, "TRANSACTION") { + if strings.TrimSpace(rest) == "" { + err = ss.rollback() + } else { + err = doTCL(ctx, ss, query) + } } else { err = ErrInvalidRollback } From 076247278bf0283d8535beeae94a412abf919e15 Mon Sep 17 00:00:00 2001 From: HAYAMA Kaoru <3752189+hymkor@users.noreply.github.com> Date: Wed, 12 Nov 2025 16:21:12 +0900 Subject: [PATCH 2/2] Release notes: mentioned to #22 --- release_note_en.md | 1 + release_note_ja.md | 1 + 2 files changed, 2 insertions(+) diff --git a/release_note_en.md b/release_note_en.md index 4dfb323..2dea3f4 100644 --- a/release_note_en.md +++ b/release_note_en.md @@ -3,6 +3,7 @@ ### Bug fixes - Fix: Errors were not reported during execution of `SAVEPOINT` and `SAVE TRANSACTION`. (#19) +- SQL Server: Fixed an issue where `ROLLBACK TRANSACTION` without a savepoint was not recognized as ending the transaction, causing the prompt to remain as `SQL*`. (#22) ### Specification Changes diff --git a/release_note_ja.md b/release_note_ja.md index dac6fc8..733360a 100644 --- a/release_note_ja.md +++ b/release_note_ja.md @@ -3,6 +3,7 @@ ### 不具合修正 - `SAVEPOINT`, `SAVE TRANSACTION` の実行中にエラーが発生してもメッセージが表示されなかった問題を修正 (#19) +- SQL Server: SAVEPOINT を指定しない `ROLLBACK TRANSACTION` でトランザクションは終了するのに、それを認識せず、プロンプトがトランザクション中を意味する `SQL*` のままになっていた問題を修正 (#22) ### 仕様変更