logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

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

Description

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 nec‐
       essary 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 ver‐
       sion 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.

Errors

       -ODBX_ERR_BACKEND
              The native database library returned an error

       -ODBX_ERR_PARAM
              The result parameter is invalid

Name

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

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
       and they can be feed to odbx_error() and odbx_error_type() to get further details.

See Also

odbx_result()

                                                 8 January 2025                            odbx_result_finish(3)

Synopsis

       #include <opendbx/api.h>

       int odbx_result_finish (odbx_result_t* result);

       void odbx_result_free (odbx_result_t* result);

See Also