Commit fa8e3f86 authored by gwenn's avatar gwenn

Clear bindings before the statement is put in the cache.

parent 3d0c6e69
...@@ -30,6 +30,7 @@ $ cp ~/Downloads/sqlite-amalgamation-xxx/sqlite3.{c,h} $GOPATH/src/github.com/gw ...@@ -30,6 +30,7 @@ $ cp ~/Downloads/sqlite-amalgamation-xxx/sqlite3.{c,h} $GOPATH/src/github.com/gw
### Features (not supported by database/sql/driver): ### Features (not supported by database/sql/driver):
* Dynamic type: currently, the SQLite3 manifest typing is respected. There is no use of the column declared type to guess the target/go type when scanning. On your side, you should try to not break column affinity rules (such as declaring a column with TIMESTAMP type (NUMERIC affinity) storing values with '2006-01-02T15:04:05.999Z07:00' format (TEXT type))... * Dynamic type: currently, the SQLite3 manifest typing is respected. There is no use of the column declared type to guess the target/go type when scanning. On your side, you should try to not break column affinity rules (such as declaring a column with TIMESTAMP type (NUMERIC affinity) storing values with '2006-01-02T15:04:05.999Z07:00' format (TEXT type))...
* Named bind parameters.
* Partial scan: scan values may be partially scanned (by index or name) or skipped/ignored by passing nil pointer(s). * Partial scan: scan values may be partially scanned (by index or name) or skipped/ignored by passing nil pointer(s).
* Null value: by default, empty string and zero time are bound to null for prepared statement's parameters (no need for NullString, NullTime but still supported). * Null value: by default, empty string and zero time are bound to null for prepared statement's parameters (no need for NullString, NullTime but still supported).
......
...@@ -41,10 +41,6 @@ func (c *cache) find(sql string) *Stmt { ...@@ -41,10 +41,6 @@ func (c *cache) find(sql string) *Stmt {
s := e.Value.(*Stmt) s := e.Value.(*Stmt)
if s.SQL() == sql { // TODO s.SQL() may have been trimmed by SQLite if s.SQL() == sql { // TODO s.SQL() may have been trimmed by SQLite
c.l.Remove(e) c.l.Remove(e)
if err := s.ClearBindings(); err != nil {
s.finalize()
return nil
}
return s return s
} }
} }
...@@ -60,6 +56,10 @@ func (c *cache) release(s *Stmt) error { ...@@ -60,6 +56,10 @@ func (c *cache) release(s *Stmt) error {
s.finalize() s.finalize()
return err return err
} }
if err := s.ClearBindings(); err != nil {
s.finalize()
return nil
}
c.m.Lock() c.m.Lock()
defer c.m.Unlock() defer c.m.Unlock()
c.l.PushFront(s) c.l.PushFront(s)
......
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