Commit 4cbd9b68 authored by gwenn's avatar gwenn

Adds a trace when trying to finalize a stmt with already closed connection.

parent 885c27d1
...@@ -508,11 +508,11 @@ func (c *Conn) Close() error { ...@@ -508,11 +508,11 @@ func (c *Conn) Close() error {
} }
rv := C.sqlite3_close(c.db) rv := C.sqlite3_close(c.db)
c.db = nil
if rv != C.SQLITE_OK { if rv != C.SQLITE_OK {
Log(int(rv), "error while closing Conn") Log(int(rv), "error while closing Conn")
return c.error(rv, "Conn.Close") return c.error(rv, "Conn.Close")
} }
c.db = nil
return nil return nil
} }
......
...@@ -923,14 +923,15 @@ func (s *Stmt) finalize() error { ...@@ -923,14 +923,15 @@ func (s *Stmt) finalize() error {
return nil return nil
} }
if s.c == nil || s.c.db == nil { if s.c == nil || s.c.db == nil {
Log(C.SQLITE_MISUSE, "sqlite statement with already closed database connection")
return errors.New("sqlite statement with already closed database connection") return errors.New("sqlite statement with already closed database connection")
} }
rv := C.sqlite3_finalize(s.stmt) rv := C.sqlite3_finalize(s.stmt)
s.stmt = nil
if rv != C.SQLITE_OK { if rv != C.SQLITE_OK {
Log(int(rv), "error while finalizing Stmt") Log(int(rv), "error while finalizing Stmt")
return s.error(rv, "Stmt.finalize") return s.error(rv, "Stmt.finalize")
} }
s.stmt = nil
return nil return nil
} }
......
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