odbx_result_finish(3) | OpenDBX | odbx_result_finish(3) |
odbx_result_finish, odbx_result_free - Closes the result set and frees its allocated memory
#include <opendbx/api.h>
int odbx_result_finish
(odbx_result_t* result);
void odbx_result_free
(odbx_result_t* result);
odbx_result_finish() closes the result set which may also include dropping the non-fetched rows sent by the server. It releases all resources allocated by odbx_result() and by the native database library which are attached to result as well as the memory the first parameter is pointing to. Trying to free result manually using free() 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. odbx_result_finish() must be called even if the statement was not a SELECT-like statement which returned now rows as it may be necessary to commit the changes done by the statement.
odbx_result_free() performs the same tasks as odbx_result_finish() but is unable to return an error if the task couln't be completed. 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.
result must be valid a 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 feed to it again. Otherwise a "double free" may occur and the application may be terminated.
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 and they can be feed to odbx_error() and odbx_error_type() to get further details.
odbx_result()
28 January 2019 |