Reference

odbx_column_count(3)

Get the number of columns in the current result set

NAME

odbx_column_count - Get the number of columns in the current result set

SYNOPSIS

FC#include <opendbx/api.h>F[0]

FCint odbx_column_countF[0] FC(odbx_result_t* result);F[0]

DESCRIPTION

Returns the number of columns which belongs to the current result set allocated by FCodbx_resultF[0](). The number will never change within a result set with one notable exception: MySQL returns all outstanding rows of a previous result set first if they were not fetched completely by FCodbx_row_fetchF[0]() before. Therefore, the column count might change in this special situation. It is strongly advised to fetch all rows of a result set before calling FCodbx_resultF[0]() again because other backends will return an error in this case.

The FCresultF[0] parameter required by this function must be a valid result set returned by FCodbx_resultF[0]() and must not has been feed to FCodbx_result_finishF[0]() before.

RETURN VALUE

FCodbx_column_countF[0]() returns the number of columns/fields which are available in the current result set. The value depends on the column list being part of the SELECT query and it is zero if the query wasn't a SELECT-like query.

ERRORS

This function will also return zero if the FCresultF[0] parameter is invalid.

SEE ALSO

FCodbx_column_nameF[0](), FCodbx_column_typeF[0](), FCodbx_resultF[0]()

History