Difference between revisions of "OpenDBX/C API/odbx row fetch"

From Linuxnetworks
< OpenDBX‎ | C API
Jump to: navigation, search
m (1 revision(s))
(Talk)
(docbook2x update)
Line 2: Line 2:
 
'''Retrieve rows from the result set'''
 
'''Retrieve rows from the result set'''
  
  #include <odbx.h>
+
  #include <opendbx/api.h>
+
 
 
  int '''odbx_row_fetch'''(
 
  int '''odbx_row_fetch'''(
 
     odbx_result_t* '''''result''''' )
 
     odbx_result_t* '''''result''''' )
Line 17: Line 17:
 
== Return value ==
 
== Return value ==
  
[[OpenDBX/API/odbx_row_fetch|odbx_row_fetch]]() will return one ("1") as long as rows are available from the result set. After the last row has been made available, further calls to this function will return zero ("0") indicating that the result set doesn't contain more rows.
+
[[OpenDBX/API/odbx_row_fetch|odbx_row_fetch]]() will return ODBX_ROW_NEXT ("1") as long as rows are available from the result set. After the last row has been made available, further calls to this function will return ODBX_ROW_DONE ("0") indicating that the result set doesn't contain more rows. The named constants are available since OpenDBX 1.3.2 and the numbers in brackets have to be used instead if a previous release is is the basis for the application development.
  
 
In case of an error, values less than zero are returned encodeing the reason why the error occurred.
 
In case of an error, values less than zero are returned encodeing the reason why the error occurred.
Line 35: Line 35:
 
* [[OpenDBX/API/odbx_field_value|odbx_field_value]]()
 
* [[OpenDBX/API/odbx_field_value|odbx_field_value]]()
 
* [[OpenDBX/API/odbx_result|odbx_result]]()
 
* [[OpenDBX/API/odbx_result|odbx_result]]()
 
 
----
 
Back to [[OpenDBX/API|Overview]]
 

Revision as of 00:33, 24 May 2008

Retrieve rows from the result set

#include <opendbx/api.h>
int odbx_row_fetch(
    odbx_result_t* result )

Description

Retrieves the values of a row from the current result set returned by odbx_result(). Until this function is invoked, no row and field data is available via odbx_field_length() or odbx_field_value() and these functions will return zero respectively NULL.

Moreover, it is necessary to fetch all rows from a result set until zero is returned indicating that no more rows are available. Otherwise - depending on the backend - an error may occur after calling odbx_result() the next time or the outstanding rows will be returned within the next result.

odbx_row_fetch() requires a valid result object which was created by odbx_result(). It must not have been feed to odbx_result_free() before.

Return value

odbx_row_fetch() will return ODBX_ROW_NEXT ("1") as long as rows are available from the result set. After the last row has been made available, further calls to this function will return ODBX_ROW_DONE ("0") indicating that the result set doesn't contain more rows. The named constants are available since OpenDBX 1.3.2 and the numbers in brackets have to be used instead if a previous release is is the basis for the application development.

In case of an error, values less than zero are returned encodeing the reason why the error occurred.

Errors

-ODBX_ERR_PARAM 
The result parameter is either NULL or the object is invalid. This is usually the case if result has been already feed to odbx_result_free().

See also