]> Cypherpunks repositories - gostls13.git/commit
database/sql: Check errors in QueryRow.Scan
authorMarko Tiikkaja <marko@joh.to>
Mon, 16 Dec 2013 20:48:35 +0000 (12:48 -0800)
committerBrad Fitzpatrick <bradfitz@golang.org>
Mon, 16 Dec 2013 20:48:35 +0000 (12:48 -0800)
commit1f20ab1116ab6cb0b77e22ffba3de9919e9def50
tree65ac8fc4317421a4d307dbcdf6b560e70882e7e7
parent54f39c997bb5824065cb17b605ba9dcff3094988
database/sql: Check errors in QueryRow.Scan

The previous coding did not correctly check for errors from the driver's
Next() or Close(), which could mask genuine errors from the database, as
witnessed in issue #6651.

Even after this change errors from Close() will be ignored if the query
returned no rows (as Rows.Next will have closed the handle already), but it
is a lot easier for the drivers to guard against that.

Fixes #6651.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/41590043
src/pkg/database/sql/fakedb_test.go
src/pkg/database/sql/sql.go
src/pkg/database/sql/sql_test.go