Skip Menu |
 

This queue is for tickets about the DBD-SQLite CPAN distribution.

Report information
The Basics
Id: 84027
Status: resolved
Priority: 0/
Queue: DBD-SQLite

People
Owner: Nobody in particular
Requestors: drh [...] sqlite.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



CC: support [...] sqlite.org, Sean Black <sblack [...] actualmetrics.com>
Subject: Finalizer() not called in sqlite_create_aggregate() when there are no rows
Date: Mon, 18 Mar 2013 13:29:33 -0400
To: Bugs in DBD-SQLite via RT <bug-DBD-SQLite [...] rt.cpan.org>
From: Richard Hipp <drh [...] sqlite.org>
The documentation says: finalize() This method will be called once all rows in the aggregate were processed and it should return the aggregate function's result. *When there is no rows in the aggregate, finalize() will be called right after new().* But that does not appear to be what happens. In fact, when there are no rows in the aggregate, neither the new() nor the finalize() methods are invoked. We believe that the following patch to dbdimp.c fixes the problem: --- dbdimp.c-orig 2013-03-18 12:51:31.322372116 -0400 +++ dbdimp.c 2013-03-18 12:57:26.374371658 -0400 @@ -1534,7 +1534,7 @@ aggrInfo *aggr, myAggr; int count = 0; - aggr = sqlite3_aggregate_context(context, sizeof (aggrInfo)); + aggr = sqlite3_aggregate_context(context, 0); ENTER; SAVETMPS; The problem above likely originates from ambiguities in the SQLite documentation. I have attempted to clarify the SQLite APIs with the checkin at http://www.sqlite.org/src/info/4fe2db1d86 and those changes have be folded into the SQLite website. -- D. Richard Hipp drh@sqlite.org
Download (untitled) / with headers
text/plain 1.1k
Applied in the trunk. Thanks. On Tue Mar 19 02:30:09 2013, drh@sqlite.org wrote: Show quoted text
> The documentation says: > > finalize() > This method will be called once all rows in the aggregate were
processed Show quoted text
> and it should return the aggregate function's result. *When there is
no Show quoted text
> rows in the aggregate, finalize() will be called right after new().* > > But that does not appear to be what happens. In fact, when there are
no Show quoted text
> rows in the aggregate, neither the new() nor the finalize() methods
are Show quoted text
> invoked. > > We believe that the following patch to dbdimp.c fixes the problem: > > --- dbdimp.c-orig 2013-03-18 12:51:31.322372116 -0400 > +++ dbdimp.c 2013-03-18 12:57:26.374371658 -0400 > @@ -1534,7 +1534,7 @@ > aggrInfo *aggr, myAggr; > int count = 0; > > - aggr = sqlite3_aggregate_context(context, sizeof (aggrInfo)); > + aggr = sqlite3_aggregate_context(context, 0); > > ENTER; > SAVETMPS; > > The problem above likely originates from ambiguities in the SQLite > documentation. I have attempted to clarify the SQLite APIs with the > checkin at http://www.sqlite.org/src/info/4fe2db1d86 and those
changes Show quoted text
> have be folded into the SQLite website. > > >
Download (untitled) / with headers
text/plain 1.3k
Closed as DBD::SQLite 1.38_02 was out. Thanks. On Tue Mar 19 10:03:58 2013, ISHIGAKI wrote: Show quoted text
> Applied in the trunk. Thanks. > > On Tue Mar 19 02:30:09 2013, drh@sqlite.org wrote:
> > The documentation says: > > > > finalize() > > This method will be called once all rows in the aggregate were
> processed
> > and it should return the aggregate function's result. *When there is
> no
> > rows in the aggregate, finalize() will be called right after new().* > > > > But that does not appear to be what happens. In fact, when there are
> no
> > rows in the aggregate, neither the new() nor the finalize() methods
> are
> > invoked. > > > > We believe that the following patch to dbdimp.c fixes the problem: > > > > --- dbdimp.c-orig 2013-03-18 12:51:31.322372116 -0400 > > +++ dbdimp.c 2013-03-18 12:57:26.374371658 -0400 > > @@ -1534,7 +1534,7 @@ > > aggrInfo *aggr, myAggr; > > int count = 0; > > > > - aggr = sqlite3_aggregate_context(context, sizeof (aggrInfo)); > > + aggr = sqlite3_aggregate_context(context, 0); > > > > ENTER; > > SAVETMPS; > > > > The problem above likely originates from ambiguities in the SQLite > > documentation. I have attempted to clarify the SQLite APIs with the > > checkin at http://www.sqlite.org/src/info/4fe2db1d86 and those
> changes
> > have be folded into the SQLite website. > > > > > >
> >


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.