Exec checks if tx is closed
https://github.com/jackc/pgx/discussions/1350
This commit is contained in:
@@ -201,6 +201,10 @@ func (tx *dbTx) Rollback(ctx context.Context) error {
|
|||||||
|
|
||||||
// Exec delegates to the underlying *Conn
|
// Exec delegates to the underlying *Conn
|
||||||
func (tx *dbTx) Exec(ctx context.Context, sql string, arguments ...any) (commandTag pgconn.CommandTag, err error) {
|
func (tx *dbTx) Exec(ctx context.Context, sql string, arguments ...any) (commandTag pgconn.CommandTag, err error) {
|
||||||
|
if tx.closed {
|
||||||
|
return pgconn.CommandTag{}, ErrTxClosed
|
||||||
|
}
|
||||||
|
|
||||||
return tx.conn.Exec(ctx, sql, arguments...)
|
return tx.conn.Exec(ctx, sql, arguments...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user