1odbx_result_finish(3)               OpenDBX              odbx_result_finish(3)
2
3
4

NAME

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

SYNOPSIS

10       #include <opendbx/api.h>
11
12
13       int odbx_result_finish (odbx_result_t* result);
14
15       void odbx_result_free (odbx_result_t* result);
16

DESCRIPTION

18       odbx_result_finish() closes the result set which may also include drop‐
19       ping the non-fetched rows sent by the server. It releases all resources
20       allocated by odbx_result() and by the native database library which are
21       attached  to result as well as the memory the first parameter is point‐
22       ing to. Trying to free result manually using free() will create  memory
23       leaks because it contains more dynamically allocated structures and al‐
24       so the memory of the result set allocated by the  native  database  li‐
25       brary.  odbx_result_finish()  must  be called even if the statement was
26       not a SELECT-like statement which returned now rows as it may be neces‐
27       sary to commit the changes done by the statement.
28
29       odbx_result_free()  performs the same tasks as odbx_result_finish() but
30       is unable to return an error if  the  task  couln't  be  completed.  It
31       shouldn't  be  used in applications linking to the OpenDBX library ver‐
32       sion 1.3.8 or later and it will be removed from the library at a  later
33       stage.
34
35       result must be valid a result set created by odbx_result() which is re‐
36       turned via its second parameter. After feeding it  to  odbx_result_fin‐
37       ish()  it becomes invalid and must not be feed to it again. Otherwise a
38       "double free" may occur and the application may be terminated.
39

RETURN VALUE

41       odbx_result_finish() returns ODBX_ERR_SUCCESS, or an error  code  whose
42       value  is less than zero if one of the operations couldn't be completed
43       successfully. Possible error codes are listed in the error section  and
44       they  can  be feed to odbx_error() and odbx_error_type() to get further
45       details.
46

ERRORS

48       -ODBX_ERR_BACKEND
49              The native database library returned an error
50
51       -ODBX_ERR_PARAM
52              The result parameter is invalid
53

SEE ALSO

55       odbx_result()
56
57
58
59                                29 January 2020          odbx_result_finish(3)
Impressum