Add error if exists after parse raw query results, fix #1398

This commit is contained in:
Jinzhu 2017-03-24 09:28:06 +08:00
parent 5730b92954
commit 66d5b42ee9
2 changed files with 8 additions and 0 deletions

View File

@ -310,6 +310,10 @@ func (scope *Scope) handleManyToManyPreload(field *Field, conditions []interface
}
}
if err := rows.Err(); err != nil {
scope.Err(err)
}
// assign find results
var (
indirectScopeValue = scope.IndirectValue()

View File

@ -930,6 +930,10 @@ func (scope *Scope) pluck(column string, value interface{}) *Scope {
scope.Err(rows.Scan(elem))
dest.Set(reflect.Append(dest, reflect.ValueOf(elem).Elem()))
}
if err := rows.Err(); err != nil {
scope.Err(err)
}
}
return scope
}