MySQL 8.4 C API Developer Guide
MYSQL_FIELD *
mysql_fetch_field_direct(MYSQL_RES *result,
unsigned int fieldnr)
Given a field number fieldnr for a column
within a result set, returns that column's field definition as
a MYSQL_FIELD structure. Use this function
to retrieve the definition for an arbitrary column. Specify a
value for fieldnr in the range from 0 to
mysql_num_fields(result)-1.
For metadata-optional connections, this function returns
NULL when the
resultset_metadata system
variable is set to NONE. To check whether a
result set has metadata, use the
mysql_result_metadata()
function. For details about managing result set metadata
transfer, see Section 3.6.7, “Optional Result Set Metadata”.
The MYSQL_FIELD structure for the specified
column. NULL if the result set has no
metadata.