On 1/21/20, Merijn Verstraaten <mer...@inconsistent.nl> wrote:
> Should issues with the documentation (i.e., missing/unclear things) be
> reported to this mailing list too?
>
> Specifically, something that was unclear to me while implementing my own
> aggregate function is what happens if sqlite3_result_error() is called and
> another result functions gets called afterwards. So, suppose we have:
>
> void stepfun(sqlite3_context *ctxt, int nArgs, sqlite3_value **args)
> {
>     ... random code here...
>     sqlite3_result_error(ctxt, "Something went bad!", -1);
>     ...more random code...
>     sqlite3_result_int(ctxt, 42);
>     return;
> }
>
> Would the overall function still report an error or would the call to
> sqlite3_result_int overwrite the earlier error and have it return
> successfully again?

For details like this, I think it is best to just ask on the mailing
list, and not expect that the answer will be documented.

Writing documentation is a careful balance between brevity and detail.
You don't what to explain what happens in every corner case, as that
will attention away from the main use case, where it belongs.

IIRC, in this case, sqlite3_result_error() persists.  The subsequent
sqlite3_result_int() call merely changes the error message to the
number 42.  If you want to cancel a prior call to
sqlite3_result_error(), you need to invoke
sqlite3_result_error_code(context, SQLITE_OK).

-- 
D. Richard Hipp
d...@sqlite.org
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to