Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2663)

Issue 12677050: code review 12677050: database/sql: make Rows.Next returning false always imp... (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 9 months ago by nigeltao
Modified:
10 years, 9 months ago
Reviewers:
bradfitz
CC:
bradfitz, brainman, golang-dev, rsc
Visibility:
Public.

Description

database/sql: make Rows.Next returning false always implicitly call Rows.Close. Previously, callers that followed the example code (but not call rows.Close after "for rows.Next() { ... }") could leak statements if the driver returned an error other than io.EOF.

Patch Set 1 #

Patch Set 2 : diff -r d7db8c804ffa https://code.google.com/p/go/ #

Patch Set 3 : diff -r d7db8c804ffa https://code.google.com/p/go/ #

Total comments: 2

Patch Set 4 : diff -r 2bf4cf823da3 https://code.google.com/p/go/ #

Patch Set 5 : diff -r 249cd3c39e56 https://code.google.com/p/go/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+49 lines, -16 lines) Patch
M src/pkg/database/sql/fakedb_test.go View 1 2 3 3 chunks +11 lines, -3 lines 0 comments Download
M src/pkg/database/sql/sql.go View 1 2 3 4 4 chunks +9 lines, -13 lines 0 comments Download
M src/pkg/database/sql/sql_test.go View 1 2 3 4 2 chunks +29 lines, -0 lines 0 comments Download

Messages

Total messages: 7
nigeltao
Hello bradfitz@golang.org (cc: golang-dev@googlegroups.com, rsc@golang.org), I'd like you to review this change to https://code.google.com/p/go/
10 years, 9 months ago (2013-08-12 07:05:29 UTC) #1
nigeltao
"go test database/sql" passes but that doesn't actually exercise any of the real drivers. How ...
10 years, 9 months ago (2013-08-12 07:16:19 UTC) #2
brainman
Brad will want new test. :-) I tested this against code.google.com/p/odbc and it works OK. ...
10 years, 9 months ago (2013-08-12 07:35:07 UTC) #3
bradfitz
Seems fine. I can't see this breaking anything, but it'd be nice to add a ...
10 years, 9 months ago (2013-08-12 22:11:00 UTC) #4
nigeltao
Test added. PTAL. https://codereview.appspot.com/12677050/diff/6001/src/pkg/database/sql/sql.go File src/pkg/database/sql/sql.go (right): https://codereview.appspot.com/12677050/diff/6001/src/pkg/database/sql/sql.go#newcode1373 src/pkg/database/sql/sql.go:1373: // result of Err. Close is ...
10 years, 9 months ago (2013-08-14 01:25:18 UTC) #5
bradfitz
LGTM thanks!
10 years, 9 months ago (2013-08-14 20:44:11 UTC) #6
nigeltao
10 years, 9 months ago (2013-08-16 01:23:51 UTC) #7
*** Submitted as https://code.google.com/p/go/source/detail?r=1da41fd62139 ***

database/sql: make Rows.Next returning false always implicitly call
Rows.Close.

Previously, callers that followed the example code (but not call
rows.Close after "for rows.Next() { ... }") could leak statements if
the driver returned an error other than io.EOF.

R=bradfitz, alex.brainman
CC=golang-dev, rsc
https://codereview.appspot.com/12677050
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b