MYSQL_RES * mysql_stmt_result_metadata(MYSQL_STMT *stmt)
may be called after preparing the statement with
before closing the statement handler. The result set metadata
is in the form of a pointer to a
structure that can be used to process the meta information
such as number of fields and individual field information.
This result set pointer can be passed as an argument to any of
the field-based API functions that process result set
metadata, such as:
If the client has suppressed metadata (as described in
Section 3.6.6, “Optional Result Set Metadata”), the
MYSQL_RES structure has the field count
filled in but is no field information.
When you are done with the metadata result set structure, free
it by passing it to
mysql_free_result(). This is
similar to the way you free a result set structure obtained
from a call to
If you call
the column types in the metadata are as determined by the
optimizer. If you call
the column types in the metadata are as actually present in
the result set. In most cases, these should be the same.
If the executed statement is a
statement, it may produce multiple result sets. In this case,
do not call
check the metadata for each result set separately after
For an example of this technique, see
Section 3.6.4, “Prepared CALL Statement Support”.
The result set returned by
contains only metadata. It does not contain any row results.
To obtain the row results, use the statement handler with
executing the statement with
MYSQL_RES result structure.
NULL if no meta information exists for the
See the Example in Section 6.4.11, “mysql_stmt_fetch()”.