mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
database/sql: return context errors from Rows.Scan
The previous implementation would return "sql: Rows are closed" for any context errors, which can be confusing for context timeouts or cancelations. Fixes #24431 Change-Id: I884904ec43204c43f4e94e2335b2802aab77a888 Reviewed-on: https://go-review.googlesource.com/104276 Reviewed-by: Daniel Theophanes <kardianos@gmail.com> Run-TryBot: Daniel Theophanes <kardianos@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
7a7b63f3e7
commit
16f32a0726
2 changed files with 7 additions and 2 deletions
|
|
@ -325,8 +325,8 @@ func TestQueryContext(t *testing.T) {
|
|||
}
|
||||
t.Fatalf("Scan: %v", err)
|
||||
}
|
||||
if index == 2 && err == nil {
|
||||
t.Fatal("expected an error on last scan")
|
||||
if index == 2 && err != context.Canceled {
|
||||
t.Fatalf("Scan: %v; want context.Canceled", err)
|
||||
}
|
||||
got = append(got, r)
|
||||
index++
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue