odbx_result_finish(3)

NAME
odbx_result_finish, odbx_result_free - Closes the result set and frees its allocated memory

SYNOPSIS
\FC#include <opendbx/api.h>\F[]

\FCint odbx_result_finish\F[]
\FC(odbx_result_t* result);\F[]

\FCvoid odbx_result_free\F[]
\FC(odbx_result_t* result);\F[]

DESCRIPTION
\FCodbx_result_finish\F[]() closes the result set which may also include dropping the non-fetched rows sent by the server. It releases all resources allocated by \FCodbx_result\F[]() and by the native database library which are attached to \FCresult\F[] as well as the memory the first parameter is pointing to. Trying to free \FCresult\F[] 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. \FCodbx_result_finish\F[]() 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.

\FCodbx_result_free\F[]() performs the same tasks as \FCodbx_result_finish\F[]() 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.

\FCresult\F[] must be valid a result set created by \FCodbx_result\F[]() which is returned via its second parameter. After feeding it to \FCodbx_result_finish\F[]() it becomes invalid and must not be feed to it again. Otherwise a "double free" may occur and the application may be terminated.

RETURN VALUE
\FCodbx_result_finish\F[]() returns \FCODBX_ERR_SUCCESS\F[], 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 \FCodbx_error\F[]() and \FCodbx_error_type\F[]() to get further details.

ERRORS

-\FCODBX_ERR_BACKEND\F[]
    The native database library returned an error

-\FCODBX_ERR_PARAM\F[]
    The \FCresult\F[] parameter is invalid

SEE ALSO
\FCodbx_result\F[]()