You can call the mysql_fetch_field() function to return the type of the next table field.
Syntax
MYSQL_FIELD *
mysql_fetch_field(MYSQL_RES *result)
Return values
The MYSQL_FIELD structure of the current column is returned, and NULL is returned if no more columns are left.
Errors
None.
Notes
mysql_fetch_field() returns the definition of one column in a result set as a MYSQL_FIELD structure.
You can call this function repeatedly to retrieve information about all columns in the result set. mysql_fetch_field() returns NULL when no more fields are left.
mysql_fetch_field() is reset to return information about the first field each time a new SELECT query is executed. The field returned by mysql_fetch_field() is also affected by calls to mysql_field_seek().
If you have called mysql_real_query() or mysql_query() to perform a SELECT operation on a table without calling mysql_store_result(), OceanBase returns the default BLOB length (8 KB) when you call mysql_fetch_field() to query the length of a BLOB field.
Once the result set is retrieved, field->max_length contains the length of the largest value in this column in the specific query.