fix issue #1992: detect if error occurred after got false by calling rows.Next() #1996

Closed
heron-sense wants to merge 1 commits from master into master
First-time contributor

In the source code from golang, any error during calling the Next method is depressed, after calling Next if got false, should call rows.Err() to detect if error orrurred.

// Every call to Scan, even the first one, must be preceded by a call to Next.
func (rs *Rows) Next() bool {
var doClose, ok bool
withLock(rs.closemu.RLocker(), func() {
doClose, ok = rs.nextLocked()
})
if doClose {
rs.Close()
}
return ok
}

In the source code from golang, any error during calling the Next method is depressed, after calling Next if got false, should call rows.Err() to detect if error orrurred. // Every call to Scan, even the first one, must be preceded by a call to Next. func (rs *Rows) Next() bool { var doClose, ok bool withLock(rs.closemu.RLocker(), func() { doClose, ok = rs.nextLocked() }) if doClose { rs.Close() } return ok }
heron-sense added 1 commit 2021-07-18 03:40:58 +00:00
fix issue #1992: detect if error occurred after got false by calling rows.Next()
Some checks failed
continuous-integration/drone/pr Build is failing
d0411b8e3b
heron-sense changed title from WIP:fix issue #1992: detect if error occurred after got false by calling rows.Next() to fix issue #1992: detect if error occurred after got false by calling rows.Next() 2021-07-18 03:43:22 +00:00
lunny reviewed 2021-07-18 09:29:45 +00:00
@ -270,6 +270,11 @@ func (session *Session) noCacheFind(table *schemas.Table, containerValue reflect
return err
}
}
Owner

I think we should check this in line 253

I think we should check this in line 253
Author
First-time contributor

I've checked the implementation of rows.Next, there's no possbile error occurred if we got true after calling rows.Next().

So it's not necessary to check error inside the loop block in line 253.

In addition, if error does occur(we will got false),then the source code inside the loop body will not execute.

So I think it's right to check the error here.

Do I make myself clear?

I've checked the implementation of rows.Next, there's no possbile error occurred if we got true after calling rows.Next(). So it's not necessary to check error inside the loop block in line 253. In addition, if error does occur(we will got false),then the source code inside the loop body will not execute. So I think it's right to check the error here. Do I make myself clear?
Owner

This will be replaced by #1997

This will be replaced by #1997
Author
First-time contributor

This will be replaced by #1997

I think thus will not solve my issue.

> This will be replaced by #1997 I think thus will not solve my issue.
Owner

You are right. And #1998 will replace this because this PR just fixed only one place but we needs to fix more.

You are right. And #1998 will replace this because this PR just fixed only one place but we needs to fix more.
Author
First-time contributor

You are right. And #1998 will replace this because this PR just fixed only one place but we needs to fix more.

Thank you so much(^.^)

> You are right. And #1998 will replace this because this PR just fixed only one place but we needs to fix more. Thank you so much(^.^)
lunny closed this pull request 2021-07-20 08:24:27 +00:00
Some checks failed
continuous-integration/drone/pr Build is failing

Pull request closed

Sign in to join this conversation.
No description provided.