Skip to content

Commit

Permalink
Add error if exists after parse raw query results, fix go-gorm#1398
Browse files Browse the repository at this point in the history
  • Loading branch information
jinzhu committed Mar 24, 2017
1 parent 5730b92 commit 66d5b42
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions callback_query_preload.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 4 additions & 0 deletions scope.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 66d5b42

Please sign in to comment.