mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
database/sql: close statement before connection
Fixes #5936 R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/11620046
This commit is contained in:
parent
abe384f68a
commit
a293065a39
2 changed files with 15 additions and 1 deletions
|
|
@ -1046,6 +1046,20 @@ func TestRowsCloseOrder(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestStmtCloseOrder(t *testing.T) {
|
||||
db := newTestDB(t, "people")
|
||||
defer closeDB(t, db)
|
||||
|
||||
db.SetMaxIdleConns(0)
|
||||
setStrictFakeConnClose(t)
|
||||
defer setStrictFakeConnClose(nil)
|
||||
|
||||
_, err := db.Query("SELECT|non_existent|name|")
|
||||
if err == nil {
|
||||
t.Fatal("Quering non-existent table should fail")
|
||||
}
|
||||
}
|
||||
|
||||
func manyConcurrentQueries(t testOrBench) {
|
||||
maxProcs, numReqs := 16, 500
|
||||
if testing.Short() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue