odbx_result_finish(3)
π odbx_result_finish(3) β the OpenDBX glow-up cleanup era β¨
okay bestie, this is a page from the OpenDBX manual and it's literally about the two functions that close out your result set and free its memory π so like, the cleanup girlies. let's go π«Ά
β¨ SYNOPSIS β¨
#include <opendbx/api.h>
int odbx_result_finish (odbx_result_t* result);
void odbx_result_free (odbx_result_t* result);
that's it, that's the whole vibe check πΈ two functions, one pointer, so many feelings.
π NAME π
odbx_result_finish, odbx_result_free β closes the result set and frees its allocated memory. yes both of them, they're a package deal π
π¦ DESCRIPTION π¦
π odbx_result_finish()
so odbx_result_finish() closes the result set β and lowkey that can even include dropping the non-fetched rows that the server sent π like, it doesn't just tidy up, it may actually toss the leftovers.
it releases all resources allocated by odbx_result() and by the native database library that are attached to result, plus the memory that the first parameter is pointing to. all of it. every crumb π§Ήβ¨
β οΈ ok this is the important part, bestie, listen: trying to free result manually withfree()will create memory leaks π because it contains more dynamically allocated structures, and also the memory of the result set allocated by the native database library. so like. don't.free()is not the moment, i promise.
and here's the thing that surprises people β odbx_result_finish() must be called even if the statement was not a SELECT-like statement which returned no rows π«’ because it may be necessary to commit the changes done by the statement. no cap. a non-select statement still needs its finish. periodt π
π odbx_result_free()
odbx_result_free() performs the same tasks as odbx_result_finish() but it is unable to return an error if the task couldn't be completed π so if it fails you just... never know. iconic in a tragic way.
π it shouldn't be used in applications linking to the OpenDBX library version 1.3.8 or later and it will be removed from the library at a later stage. so she's giving deprecated, she's giving sunset era, she's giving "we don't stan anymore". use odbx_result_finish() instead, bestie π«Ά
πΈ about result itself
result must be a valid result set created by odbx_result() which is returned via its second parameter. after feeding it to odbx_result_finish() it becomes invalid and must not be fed to it again π₯ otherwise a "double free" may occur and the application may be terminated π like flat-out terminated, no thoughts head empty. so keep track of her, don't double-dip.
β RETURN VALUE β
odbx_result_finish() returns ODBX_ERR_SUCCESS, or an error code whose value is less than zero if one of the operations couldn't be completed successfully π₯² possible error codes are listed in the error section (that's the next section, keep scrolling babe) and they can be fed to odbx_error() and odbx_error_type() to get further details π
(and odbx_result_free() returns... nothing. void. she says nothing and leaves π)
π ERRORS π
-ODBX_ERR_BACKENDβ the native database library returned an error π the backend said no ma'am-ODBX_ERR_PARAMβ the result parameter is invalid π wrong pointer, wrong era
π SEE ALSO π
odbx_result()β the one that makes the result set in the first place β¨
and that's the page!! π§π this cutie was brought to you by the OpenDBX manual, dated 6 February 2026, and it's the odbx_result_finish(3) page in all her glory β clean your result sets, commit your statements, and never free() her manually π
π bye bestie!! πΈπ¦
π¦ where this page comes from
- ubuntu resolute: libopendbx1-dev 1.4.6-18build2
- ubuntu stonking: libopendbx1-dev 1.4.6-18build2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms