Correct work RecordNotFound for RAW SQL
This commit is contained in:
parent
f6260a0085
commit
b5db07738d
15
main.go
15
main.go
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user