Correct work RecordNotFound for RAW SQL

This commit is contained in:
Andrey Nehaychik 2018-09-26 15:22:03 +03:00
parent f6260a0085
commit b5db07738d

15
main.go
View File

@ -530,9 +530,18 @@ func (s *DB) NewRecord(value interface{}) bool {
// RecordNotFound check if returning ErrRecordNotFound error // RecordNotFound check if returning ErrRecordNotFound error
func (s *DB) RecordNotFound() bool { func (s *DB) RecordNotFound() bool {
for _, err := range s.GetErrors() { if s.search.raw {
if err == ErrRecordNotFound { rows, err := s.Rows()
return true defer rows.Close()
if err != nil {
return false
}
return !rows.Next()
} else {
for _, err := range s.GetErrors() {
if err == ErrRecordNotFound {
return true
}
} }
} }
return false return false