Difference between revisions of "OpenDBX/C API/odbx field value"

From Linuxnetworks
< OpenDBX‎ | C API
Jump to: navigation, search
(header)
(enhanced article)
Line 7: Line 7:
 
     unsigned long '''pos''' )
 
     unsigned long '''pos''' )
  
= Description: =
+
= Description =
  
Returns the field value specified by "pos" of the current row. The value of "pos" must be in the range from 0 to [[OpenDBX_column_count|odbx_column_count()]]-1. All values except binary objects are strings terminated by \0 but NULL is also a valid field value. Numbers have to be converted to their binary representation before arithmetic operations are allowed.
+
'''odbx_field_value()''' returns a pointer to the field value specified by the column index '''pos'''. The field is part of the current row which was retrieved by the latest call to [[OpenDBX row_fetch|odbx_row_fetch()]].
  
= Parameters: =
+
All values except binary objects are handed back as strings terminated by the zero character. This does also apply to numeric values, dates, etc. They have to be converted to their binary machine dependent representation before arithmetic operations can be done. If a value is undefined, i.e. "NULL" is attached to the field in the database, an equivalent NULL pointer is returned.
  
* result: Pointer to object created by [[OpenDBX_result|odbx_result()]]
+
The '''result''' parameter required by this function must be a valid result set returned by [[OpenDBX result|odbx_result()]] and must not have been feed to [[OpenDBX result_free|odbx_result_free()]] before.
* pos: Column number in the current result set
+
  
= Return values: =
+
Valid column indices for the requested column provided via '''pos''' start with zero and end with the value returned by [[OpenDBX column_count|odbx_column_count()]] minus one.
  
* Address of a string or binary object for the specified field
+
= Return values =
* NULL if the field is a NULL value, "result" is invalid or "pos" is out of range.
+
  
= Errors: =
+
The function provides the address of the field value pointing to its beginning back to the caller where the string or binary object is stored in memory. It returns a NULL pointer if the field is a "NULL" value.
  
* None
+
= Errors =
  
= See also: =
+
This function will also return NULL if the '''result''' parameter is invalid or if the value of '''pos''' is out of range.
  
* [[OpenDBX_column_type]]
+
= See also =
* [[OpenDBX_field_length]]
+
 
 +
* [[OpenDBX column_type|odbx_column_type()]]
 +
* [[OpenDBX field_length|odbx_field_length()]]
  
  
 
----
 
----
 
Back to [[OpenDBX API|Overview]]
 
Back to [[OpenDBX API|Overview]]

Revision as of 21:46, 25 April 2007


#include <odbx.h>

const char* odbx_field_value(
    odbx_result_t* result,
    unsigned long pos )

Description

odbx_field_value() returns a pointer to the field value specified by the column index pos. The field is part of the current row which was retrieved by the latest call to odbx_row_fetch().

All values except binary objects are handed back as strings terminated by the zero character. This does also apply to numeric values, dates, etc. They have to be converted to their binary machine dependent representation before arithmetic operations can be done. If a value is undefined, i.e. "NULL" is attached to the field in the database, an equivalent NULL pointer is returned.

The result parameter required by this function must be a valid result set returned by odbx_result() and must not have been feed to odbx_result_free() before.

Valid column indices for the requested column provided via pos start with zero and end with the value returned by odbx_column_count() minus one.

Return values

The function provides the address of the field value pointing to its beginning back to the caller where the string or binary object is stored in memory. It returns a NULL pointer if the field is a "NULL" value.

Errors

This function will also return NULL if the result parameter is invalid or if the value of pos is out of range.

See also



Back to Overview