Difference between revisions of "OpenDBX/API/odbx result free"
(rewrite) |
(header hierarchy) |
||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
− | |||
'''#include <odbx.h>''' | '''#include <odbx.h>''' | ||
Line 6: | Line 5: | ||
odbx_result_t* '''result''' ) | odbx_result_t* '''result''' ) | ||
− | = Description = | + | == Description == |
'''odbx_result_free()''' releases all resources allocated by [[OpenDBX_result|odbx_result()]] or by the native database library which are attached to '''result'''. It also frees the memory the first parameter is pointing to. Trying to free() '''result''' manually will create memory leaks because it contains more dynamically allocated structures and also the result set allocated by the native database library. '''odbx_result_free()''' must be called even if the statement was not a SELECT-like statement which returned now rows. | '''odbx_result_free()''' releases all resources allocated by [[OpenDBX_result|odbx_result()]] or by the native database library which are attached to '''result'''. It also frees the memory the first parameter is pointing to. Trying to free() '''result''' manually will create memory leaks because it contains more dynamically allocated structures and also the result set allocated by the native database library. '''odbx_result_free()''' must be called even if the statement was not a SELECT-like statement which returned now rows. | ||
Line 12: | Line 11: | ||
'''result''' must be a result set object created by [[OpenDBX_result|odbx_result()]] which is returned via its second parameter. After feeding it to '''odbx_result_free()''' it becomes invalid and must not be feed to it again. Otherwise a "double free" will occur and the application will be terminated. | '''result''' must be a result set object created by [[OpenDBX_result|odbx_result()]] which is returned via its second parameter. After feeding it to '''odbx_result_free()''' it becomes invalid and must not be feed to it again. Otherwise a "double free" will occur and the application will be terminated. | ||
− | = Return values = | + | == Return values == |
This function doesn't return any values. | This function doesn't return any values. | ||
− | = Errors = | + | == Errors == |
'''odbx_result_free()''' tries its best to cleanup the allocated structure and doesn't generate an error. | '''odbx_result_free()''' tries its best to cleanup the allocated structure and doesn't generate an error. | ||
− | = See also = | + | == See also == |
[[OpenDBX_result|odbx_result()]] | [[OpenDBX_result|odbx_result()]] |
Revision as of 18:42, 6 May 2007
#include <odbx.h> void odbx_result_free( odbx_result_t* result )
Description
odbx_result_free() releases all resources allocated by odbx_result() or by the native database library which are attached to result. It also frees the memory the first parameter is pointing to. Trying to free() result manually will create memory leaks because it contains more dynamically allocated structures and also the result set allocated by the native database library. odbx_result_free() must be called even if the statement was not a SELECT-like statement which returned now rows.
result must be a result set object created by odbx_result() which is returned via its second parameter. After feeding it to odbx_result_free() it becomes invalid and must not be feed to it again. Otherwise a "double free" will occur and the application will be terminated.
Return values
This function doesn't return any values.
Errors
odbx_result_free() tries its best to cleanup the allocated structure and doesn't generate an error.
See also
Back to Overview