diff --git a/select.go b/select.go index 2d2d5961..7c6ae60c 100644 --- a/select.go +++ b/select.go @@ -168,7 +168,12 @@ func selectVal(e SqlExecutor, holder interface{}, query string, args ...interfac return sql.ErrNoRows } - return rows.Scan(holder) + err = rows.Scan(holder) + if err != nil { + return err + } + + return rows.Close() } func hookedselect(m *DbMap, exec SqlExecutor, i interface{}, query string, @@ -351,6 +356,11 @@ func rawselect(m *DbMap, exec SqlExecutor, i interface{}, query string, } } + err = rows.Close() + if err != nil { + return nil, err + } + if appendToSlice && sliceValue.IsNil() { sliceValue.Set(reflect.MakeSlice(sliceValue.Type(), 0, 0)) }