Skip to content

Commit 9280190

Browse files
committed
Enable REPLACE to execute within a transaction and returns count of affected rows
1 parent 2884c10 commit 9280190

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

loop.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,9 @@ func (ss *session) Loop(ctx context.Context, commandIn commandIn) error {
175175
case "SAVEPOINT", "SAVE", "RELEASE":
176176
misc.Echo(ss.spool, query)
177177
err = doTCL(ctx, ss, query)
178-
case "DELETE", "INSERT", "UPDATE", "MERGE":
178+
179+
// Updates returning affected row count, safe in transaction
180+
case "DELETE", "INSERT", "UPDATE", "MERGE", "REPLACE":
179181
misc.Echo(ss.spool, query)
180182
isNewTx := (ss.tx == nil)
181183
err = ss.beginTx(ctx, ss.stdErr)

0 commit comments

Comments
 (0)