store/cockroach: fix dropped errors (#1796)

Co-authored-by: Asim Aslam <asim@aslam.me>
This commit is contained in:
Lars Lehtonen 2020-07-06 12:14:36 -07:00 committed by GitHub
parent 51caf2a24e
commit 2b033b6495
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -332,10 +332,11 @@ func (s *sqlStore) read(key string, options store.ReadOptions) ([]*store.Record,
}
var rows *sql.Rows
var st *sql.Stmt
var err error
if options.Limit != 0 {
st, err := s.prepare(options.Database, options.Table, "readOffset")
st, err = s.prepare(options.Database, options.Table, "readOffset")
if err != nil {
return nil, err
}
@ -343,7 +344,7 @@ func (s *sqlStore) read(key string, options store.ReadOptions) ([]*store.Record,
rows, err = st.Query(pattern, options.Limit, options.Offset)
} else {
st, err := s.prepare(options.Database, options.Table, "readMany")
st, err = s.prepare(options.Database, options.Table, "readMany")
if err != nil {
return nil, err
}