Difference between revisions of "OpenDBX/API/odbx result free"

From Linuxnetworks
< OpenDBX‎ | API
Jump to: navigation, search
(Description:)
m (1 revision(s))
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
 +
'''Frees the allocated memory of a result set'''
  
  void odbx_result_free(
+
#include <odbx.h>
     odbx_result_t* result )
+
 +
  void '''odbx_result_free'''(
 +
     odbx_result_t* '''''result''''' )
  
= Description: =
+
== Description ==
  
Deletes all resources allocated by [[OpenDBX_result|odbx_result()]]. You must not free() "result" by yourself because this will create memory leaks and you have to call odbx_result_free() even if the statement returned now rows. This is indicated by a return value of "2" for not SELECT-like queries.
+
[[OpenDBX/API/odbx_result_free|odbx_result_free]]() releases all resources allocated by [[OpenDBX/API/odbx_result|odbx_result]]() and 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 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. [[OpenDBX/API/odbx_result_free|odbx_result_free]]() must be called even if the statement was not a SELECT-like statement which returned now rows.
  
= Parameters: =
+
'''''result''''' must be valid a result set created by [[OpenDBX/API/odbx_result|odbx_result]]() which is returned via its second parameter. After feeding it to [[OpenDBX/API/odbx_result_free|odbx_result_free]]() it becomes invalid and must not be feed to it again. Otherwise a "double free" will occur and the application may be terminated.
  
* result: Object created by odbx_result()
+
== Return value ==
  
= Return values: =
+
This function doesn't return any values.
  
* None
+
== Errors ==
  
= Errors: =
+
[[OpenDBX/API/odbx_result_free|odbx_result_free]]() tries its best to cleanup the allocated structure and doesn't generate an error.
  
* None
+
== See also ==
 +
 
 +
* [[OpenDBX/API/odbx_result|odbx_result]]()
  
  
 
----
 
----
Back to [[OpenDBX API|Overview]]
+
Back to [[OpenDBX/API|Overview]]

Latest revision as of 22:08, 19 May 2007

Frees the allocated memory of a result set

#include <odbx.h>

void odbx_result_free(
    odbx_result_t* result )

Description

odbx_result_free() releases all resources allocated by odbx_result() and 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 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_free() must be called even if the statement was not a SELECT-like statement which returned now rows.

result must be valid a result set 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 may be terminated.

Return value

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