Commit 77b73a52 authored by gwenn's avatar gwenn

Ensure statements are reset before being cached.

parent dbfe8195
......@@ -56,6 +56,10 @@ func (c *cache) release(s *Stmt) error {
if c.maxSize <= 0 || len(s.tail) > 0 || s.Busy() {
return s.finalize()
}
if err := s.Reset(); err != nil {
s.finalize()
return err
}
c.m.Lock()
defer c.m.Unlock()
c.l.PushFront(s)
......
......@@ -371,10 +371,7 @@ func (c *Conn) Exists(query string, args ...interface{}) (bool, error) {
if err != nil {
return false, err
}
defer func() {
s.Reset()
s.Finalize()
}()
defer s.Finalize()
return s.Next()
}
......@@ -385,10 +382,7 @@ func (c *Conn) OneValue(query string, value interface{}, args ...interface{}) er
if err != nil {
return err
}
defer func() {
s.Reset()
s.Finalize()
}()
defer s.Finalize()
b, err := s.Next()
if err != nil {
return err
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment