From 0e2e8e54ab85889d3c42cf8b0744c3253065983b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 3 Mar 2025 09:51:42 +0000 Subject: [chore]: Bump github.com/ncruces/go-sqlite3 from 0.23.0 to 0.24.0 (#3862) Bumps [github.com/ncruces/go-sqlite3](https://github.com/ncruces/go-sqlite3) from 0.23.0 to 0.24.0. - [Release notes](https://github.com/ncruces/go-sqlite3/releases) - [Commits](https://github.com/ncruces/go-sqlite3/compare/v0.23.0...v0.24.0) --- updated-dependencies: - dependency-name: github.com/ncruces/go-sqlite3 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- vendor/github.com/ncruces/go-sqlite3/func.go | 39 ++++++++++++++++++---------- 1 file changed, 25 insertions(+), 14 deletions(-) (limited to 'vendor/github.com/ncruces/go-sqlite3/func.go') diff --git a/vendor/github.com/ncruces/go-sqlite3/func.go b/vendor/github.com/ncruces/go-sqlite3/func.go index 6b69368b4..f907fa940 100644 --- a/vendor/github.com/ncruces/go-sqlite3/func.go +++ b/vendor/github.com/ncruces/go-sqlite3/func.go @@ -2,6 +2,7 @@ package sqlite3 import ( "context" + "io" "sync" "github.com/tetratelabs/wazero/api" @@ -85,13 +86,19 @@ func (c *Conn) CreateWindowFunction(name string, nArg int, flag FunctionFlag, fn var funcPtr ptr_t defer c.arena.mark()() namePtr := c.arena.string(name) + call := "sqlite3_create_aggregate_function_go" if fn != nil { + agg := fn() + if c, ok := agg.(io.Closer); ok { + if err := c.Close(); err != nil { + return err + } + } + if _, ok := agg.(WindowFunction); ok { + call = "sqlite3_create_window_function_go" + } funcPtr = util.AddHandle(c.ctx, fn) } - call := "sqlite3_create_aggregate_function_go" - if _, ok := fn().(WindowFunction); ok { - call = "sqlite3_create_window_function_go" - } rc := res_t(c.call(call, stk_t(c.handle), stk_t(namePtr), stk_t(nArg), stk_t(flag), stk_t(funcPtr))) @@ -168,20 +175,24 @@ func stepCallback(ctx context.Context, mod api.Module, pCtx, pAgg, pApp ptr_t, n fn.Step(Context{db, pCtx}, args[:nArg]...) } -func finalCallback(ctx context.Context, mod api.Module, pCtx, pAgg, pApp ptr_t) { +func valueCallback(ctx context.Context, mod api.Module, pCtx, pAgg, pApp ptr_t, final int32) { db := ctx.Value(connKey{}).(*Conn) fn, handle := callbackAggregate(db, pAgg, pApp) fn.Value(Context{db, pCtx}) - if err := util.DelHandle(ctx, handle); err != nil { - Context{db, pCtx}.ResultError(err) - return // notest - } -} -func valueCallback(ctx context.Context, mod api.Module, pCtx, pAgg ptr_t) { - db := ctx.Value(connKey{}).(*Conn) - fn := util.GetHandle(db.ctx, pAgg).(AggregateFunction) - fn.Value(Context{db, pCtx}) + // Cleanup. + if final != 0 { + var err error + if handle != 0 { + err = util.DelHandle(ctx, handle) + } else if c, ok := fn.(io.Closer); ok { + err = c.Close() + } + if err != nil { + Context{db, pCtx}.ResultError(err) + return // notest + } + } } func inverseCallback(ctx context.Context, mod api.Module, pCtx, pAgg ptr_t, nArg int32, pArg ptr_t) { -- cgit v1.2.3