release memory on close, return close error
This commit is contained in:
parent
e92b36e765
commit
7ad9da2cfc
|
@ -272,10 +272,10 @@ func (c *SQLiteConn) QueryContext(ctx context.Context, query string, args []driv
|
||||||
func (c *SQLiteConn) Close() (err error) {
|
func (c *SQLiteConn) Close() (err error) {
|
||||||
// see: https://www.sqlite.org/pragma.html#pragma_optimize
|
// see: https://www.sqlite.org/pragma.html#pragma_optimize
|
||||||
const onClose = "PRAGMA analysis_limit=1000; PRAGMA optimize;"
|
const onClose = "PRAGMA analysis_limit=1000; PRAGMA optimize;"
|
||||||
if r, ok := c.ConnIface.(sqlite3.DriverConn); ok {
|
raw := c.ConnIface.(sqlite3.DriverConn).Raw()
|
||||||
_ = r.Raw().Exec(onClose)
|
_ = raw.Exec(onClose)
|
||||||
_ = r.Raw().Close()
|
_ = raw.ReleaseMemory()
|
||||||
}
|
err = raw.Close()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue