aboutsummaryrefslogtreecommitdiff
path: root/src/database/sql/ctxutil.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/database/sql/ctxutil.go')
-rw-r--r--src/database/sql/ctxutil.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/database/sql/ctxutil.go b/src/database/sql/ctxutil.go
index bd652b5462..b73ee86594 100644
--- a/src/database/sql/ctxutil.go
+++ b/src/database/sql/ctxutil.go
@@ -107,10 +107,6 @@ func ctxDriverBegin(ctx context.Context, opts *TxOptions, ci driver.Conn) (drive
return ciCtx.BeginTx(ctx, dopts)
}
- if ctx.Done() == context.Background().Done() {
- return ci.Begin()
- }
-
if opts != nil {
// Check the transaction level. If the transaction level is non-default
// then return an error here as the BeginTx driver value is not supported.
@@ -125,6 +121,10 @@ func ctxDriverBegin(ctx context.Context, opts *TxOptions, ci driver.Conn) (drive
}
}
+ if ctx.Done() == context.Background().Done() {
+ return ci.Begin()
+ }
+
txi, err := ci.Begin()
if err == nil {
select {