Difference between revisions of "OpenDBX/C API/odbx column name"

From Linuxnetworks
< OpenDBX‎ | C API
Jump to: navigation, search
(enhanced article)
 
(11 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
 +
'''Get the name of a column in the current result set'''
 +
 +
#include <opendbx/api.h>
  
'''#include <odbx.h>'''
 
 
 
  char* '''odbx_column_name'''(
 
  char* '''odbx_column_name'''(
    odbx_result_t* '''result''',
+
    odbx_result_t* '''''result''''',
    unsigned long '''pos''' )
+
    unsigned long '''''pos''''' )
 
+
= Description: =
+
 
+
'''odbx_column_name()''' returns the name of the column specified by '''pos''' in the current result set returned by [[OpenDBX result|odbx_result()]]. The column names will not change within the result set with the exception described in [[OpenDBX column_count|odbx_column_count()]].
+
  
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.
+
== Description ==
  
Valid column indices for the requested column provided by '''pos''' start with zero and end with the value returned by [[OpenDBX column_count|odbx_column_count()]] minus one.  
+
[[OpenDBX/API/odbx_column_name|odbx_column_name]]() gets the name of the column specified by pos in the current result set returned by [[OpenDBX/API/odbx_result|odbx_result]](). The column names will not change within the result set with the exception described for MySQL in [[OpenDBX/API/odbx_column_count|odbx_column_count]]() when the first result set wasn't retrieved completely before [[OpenDBX/API/odbx_result|odbx_result]]() was called again.
  
= Return values =
+
The '''''result''''' parameter required by this function must be a valid result set returned by [[OpenDBX/API/odbx_result|odbx_result]]() and must not have been feed to [[OpenDBX/API/odbx_result_finish|odbx_result_finish]]() before.
  
The return value of '''odbx_column_name()''' is a pointer to a zero terminated string which consists of the name of the requested column. This pointer is allocated by the database client library and must not be freed by the application. The content of the string will be overwritten by the next call to '''odbx_column_name()'''.
+
Valid column indices for the requested column provided via '''''pos''''' start with zero and end with the value returned by [[OpenDBX/API/odbx_column_count|odbx_column_count]]() minus one.
  
= Errors =
+
== Return value ==
  
Errors can occur if the given '''result''' parameter is NULL or invalid or if the value of '''pos''' is out of range, i.e. more than [[OpenDBX column_count|odbx_column_count()]] minus one.
+
The return value of [[OpenDBX/API/odbx_column_name|odbx_column_name]]() is a pointer to a zero terminated string which consists of the name of the requested column. This pointer is allocated by the database client library and must not be freed by the application. The content of the string may be overwritten by the next call to [[OpenDBX/API/odbx_column_name|odbx_column_name]]()
  
= See also =
+
== Errors ==
  
* [[OpenDBX column_count|odbx_column_count()]]
+
Errors can occur if the given '''''result''''' parameter is NULL or invalid or if the value of '''''pos''''' is out of range, i.e. more than [[OpenDBX/API/odbx_column_count|odbx_column_count]]() minus one.
* [[OpenDBX column_type|odbx_column_type()]]
+
  
 +
== See also ==
  
----
+
* [[OpenDBX/API/odbx_column_count|odbx_column_count]]()
Back to [[OpenDBX API|Overview]]
+
* [[OpenDBX/API/odbx_column_type|odbx_column_type]]()
 +
* [[OpenDBX/API/odbx_result|odbx_result]]()

Latest revision as of 23:10, 28 April 2009

Get the name of a column in the current result set

#include <opendbx/api.h>
char* odbx_column_name(
    odbx_result_t* result,
    unsigned long pos )

Description

odbx_column_name() gets the name of the column specified by pos in the current result set returned by odbx_result(). The column names will not change within the result set with the exception described for MySQL in odbx_column_count() when the first result set wasn't retrieved completely before odbx_result() was called again.

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_finish() 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 value

The return value of odbx_column_name() is a pointer to a zero terminated string which consists of the name of the requested column. This pointer is allocated by the database client library and must not be freed by the application. The content of the string may be overwritten by the next call to odbx_column_name()

Errors

Errors can occur if the given result parameter is NULL or invalid or if the value of pos is out of range, i.e. more than odbx_column_count() minus one.

See also