From 7aed11b4612b0d268532638b9167f0ef0fbc7785 Mon Sep 17 00:00:00 2001 From: Gianmarco Fantinuoli Date: Tue, 4 Nov 2025 17:09:06 +0100 Subject: [PATCH] Fix: add missing `unsafe` in `Tx.Stmtx` The `Tx` type can wrap a statement, the returned statement was missing the `unsafe` flag. --- sqlx.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sqlx.go b/sqlx.go index 8259a4fe..24223367 100644 --- a/sqlx.go +++ b/sqlx.go @@ -483,7 +483,7 @@ func (tx *Tx) Stmtx(stmt interface{}) *Stmt { default: panic(fmt.Sprintf("non-statement type %v passed to Stmtx", reflect.ValueOf(stmt).Type())) } - return &Stmt{Stmt: tx.Stmt(s), Mapper: tx.Mapper} + return &Stmt{Stmt: tx.Stmt(s), unsafe: tx.unsafe, Mapper: tx.Mapper} } // NamedStmt returns a version of the prepared statement which runs within a transaction.