Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 14 additions & 20 deletions reference/mysqli/mysqli_stmt/result-metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,15 @@
that can be used to process the meta information such as total number of fields
and individual field information.
</para>
<para>
This function returns an empty <classname>mysqli_result</classname> object
which can be used to access metadata information from the prepared statement
without having to fetch the actual rows of data. There is no need to use
this function when using <function>mysqli_stmt_get_result</function> to
retrieve the entire result set from a prepared statement as a result object.
</para>
<note>
<para>This result set pointer can be passed as an argument to any of the
<para>This result set object can be passed as an argument only to the
field-based functions that process result set metadata, such as:
<itemizedlist>
<listitem><para><function>mysqli_num_fields</function></para></listitem>
Expand All @@ -40,15 +47,12 @@
</itemizedlist>
</para>
</note>
<para>
The result set structure should be freed when you are done with it,
which you can do by passing it to <function>mysqli_free_result</function>
</para>
<note>
<para>
The result set returned by <function>mysqli_stmt_result_metadata</function> contains only
metadata. It does not contain any row results. The rows are obtained by using the
statement handle with <function>mysqli_stmt_fetch</function>.
The result set returned by <function>mysqli_stmt_result_metadata</function>
contains only metadata. It does not contain any row results.
The rows are obtained by calling <function>mysqli_stmt_get_result</function>
on the statement handle or with <function>mysqli_stmt_fetch</function>.
</para>
</note>
</refsect1>
Expand All @@ -66,6 +70,7 @@
&reftitle.returnvalues;
<para>
Returns a result object or &false; if an error occurred.
If the statement does not produce a result set, &false; is returned as well.
</para>
</refsect1>

Expand Down Expand Up @@ -98,12 +103,6 @@ $result = $stmt->result_metadata();
$field = $result->fetch_field();

printf("Fieldname: %s\n", $field->name);

/* close resultset */
$result->close();

/* close connection */
$mysqli->close();
?>
]]>
</programlisting>
Expand All @@ -130,12 +129,6 @@ $result = mysqli_stmt_result_metadata($stmt);
$field = mysqli_fetch_field($result);

printf("Fieldname: %s\n", $field->name);

/* close resultset */
mysqli_free_result($result);

/* close connection */
mysqli_close($link);
?>
]]>
</programlisting>
Expand All @@ -148,6 +141,7 @@ mysqli_close($link);
<simplelist>
<member><function>mysqli_prepare</function></member>
<member><function>mysqli_free_result</function></member>
<member><function>mysqli_stmt_get_result</function></member>
</simplelist>
</para>
</refsect1>
Expand Down