sqlite3_create_function xFinal argument called when there's an error?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

sqlite3_create_function xFinal argument called when there's an error?

Nelson, Erik - 2
All- for aggregate functions, is xFinal called if there's an error?  For example, in the percentile.c add-on function, percentStep has code like

sqlite3_result_error(pCtx, "2nd argument to percentile() is not "
                         "a number between 0.0 and 100.0", -1);

If that error happens, does percentFinal still get called to clean up the memory?  Or does it leak?

Thanks

Erik

----------------------------------------------------------------------
This message, and any attachments, is for the intended recipient(s) only, may contain information that is privileged, confidential and/or proprietary and subject to important terms and conditions available at http://www.bankofamerica.com/emaildisclaimer.   If you are not the intended recipient, please delete this message.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: sqlite3_create_function xFinal argument called when there's an error?

Clemens Ladisch
Nelson, Erik - 2 wrote:
> for aggregate functions, is xFinal called if there's an error?

Yes; it's always called when SQLite cleans up the context.


Regards,
Clemens
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: sqlite3_create_function xFinal argument called when there's an error?

Nelson, Erik - 2
> From: sqlite-users [mailto:[hidden email]] On
> Behalf Of Clemens Ladisch
> Sent: Wednesday, May 17, 2017 2:36 AM
> To: [hidden email]
> Subject: Re: [sqlite] sqlite3_create_function xFinal argument called when
> there's an error?
>
> Nelson, Erik - 2 wrote:
> > for aggregate functions, is xFinal called if there's an error?
>
> Yes; it's always called when SQLite cleans up the context.
>
>
>Clemens wrote:

Thanks!  In that case, should any result be set in xFinal?  Like sqlite3_result_error?  Or the previously-returned xStep error is sufficient?

----------------------------------------------------------------------
This message, and any attachments, is for the intended recipient(s) only, may contain information that is privileged, confidential and/or proprietary and subject to important terms and conditions available at http://www.bankofamerica.com/emaildisclaimer.   If you are not the intended recipient, please delete this message.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: sqlite3_create_function xFinal argument called when there's an error?

Clemens Ladisch
Nelson, Erik - 2 wrote:
> should any result be set in xFinal?  Like sqlite3_result_error?  Or the previously-returned xStep error is sufficient?

The sqlite3_result_xxx() documentation documents what happens when you
call it multiple times (i.e., the later call overrides the earlier
value).  You call sqlite3_result_error() in xFinal if you want that to
happen.


Regards,
Clemens
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users