Reporting documentation issues/unclarity?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Reporting documentation issues/unclarity?

Merijn Verstraaten
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?

Cheers,
Merijn

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

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Reporting documentation issues/unclarity?

Richard Hipp-3
On 1/21/20, Merijn Verstraaten <[hidden email]> 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
[hidden email]
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users