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

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 length of 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.
+
'''odbx_field_length()''' returns the length of the field value in bytes. The field is part of the current row which was retrieved by the latest call to [[OpenDBX row_fetch|odbx_row_fetch()]] and is specified by the column index given by '''pos'''.
  
= Parameters: =
+
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.
  
* result: Pointer to object created by [[OpenDBX_result|odbx_result()]]
+
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.
* pos: Column number in the current result set
+
  
= Return values: =
+
= Return values =
  
* Length of the value in the specified column of the current row
+
The '''odbx_field_length()''' function provides the number of bytes of the specified field to the caller. If the field value consists of character data, the returned length will be without the terminating zero character. For binary values the exact size of the block as stored in the database is returned.
  
= Errors: =
+
= Errors =
  
* None
+
This function will also return zero if the '''result''' parameter is invalid.
  
= See also: =
+
= See also =
  
* [[OpenDBX_field_value]]
+
* [[OpenDBX field_value|odbx_field_value()]]
  
  
 
----
 
----
 
Back to [[OpenDBX API|Overview]]
 
Back to [[OpenDBX API|Overview]]

Revision as of 21:28, 25 April 2007


#include <odbx.h>

unsigned long odbx_field_length(
    odbx_result_t* result,
    unsigned long pos )

Description

odbx_field_length() returns the length of the field value in bytes. The field is part of the current row which was retrieved by the latest call to odbx_row_fetch() and is specified by the column index given by pos.

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 odbx_field_length() function provides the number of bytes of the specified field to the caller. If the field value consists of character data, the returned length will be without the terminating zero character. For binary values the exact size of the block as stored in the database is returned.

Errors

This function will also return zero if the result parameter is invalid.

See also



Back to Overview