Rechercher dans le manuel MySQL
28.7.7.17 mysql_fetch_field()
MYSQL_FIELD *mysql_fetch_field(MYSQL_RES
*result)
Description
Returns the definition of one column of a result set as a
MYSQL_FIELD
structure. 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.
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 28.7.27, “C API Optional Result Set Metadata”.
mysql_fetch_field()
is reset
to return information about the first field each time you
execute a new SELECT
query. The
field returned by
mysql_fetch_field()
is also
affected by calls to
mysql_field_seek()
.
If you've called mysql_query()
to perform a SELECT
on a table
but have not called
mysql_store_result()
, MySQL
returns the default blob length (8KB) if you call
mysql_fetch_field()
to ask for
the length of a BLOB
field.
(The 8KB size is chosen because MySQL does not know the
maximum length for the BLOB
.
This should be made configurable sometime.) Once you've
retrieved the result set,
field->max_length
contains the length of
the largest value for this column in the specific query.
The MYSQL_FIELD
structure for the current
column. NULL
if no columns are left or the
result set has no metadata.
Document created the 26/06/2006, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/mysql-rf-mysql-fetch-field.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.
References
These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.