fix issue #1992: detect if error occurred after got false by calling rows.Next() #1996
No reviewers
Labels
No Label
backport/done
backport/v1
blocked
db
oracle
db
sqlserver
duplicate
feature
cache
frontport/done
frontport/main
invalid
kind
breaking
kind
bug
kind
build
kind
dependencies
kind
docs
kind
driver
kind
enhancement
kind
feature
kind
performance
kind
proposal
kind
question
kind
refactor
kind
testing
need
feedback
need
test
proposal:accepted
RaspBerry Pi
regression
skip-changelog
upstream
wip
wontfix
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: xorm/xorm#1996
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "master"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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
}
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()@ -270,6 +270,11 @@ func (session *Session) noCacheFind(table *schemas.Table, containerValue reflect
return err
}
}
I think we should check this in line 253
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?
This will be replaced by #1997
I think thus will not solve my issue.
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(^.^)
Pull request closed