From a6814a9fa7186708186184cf3a38d965c9df176e Mon Sep 17 00:00:00 2001 From: Kamil Tekiela Date: Thu, 9 Oct 2025 15:48:59 +0100 Subject: [PATCH 1/2] This is nonsense --- reference/mysqli/mysqli_stmt/result-metadata.xml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/reference/mysqli/mysqli_stmt/result-metadata.xml b/reference/mysqli/mysqli_stmt/result-metadata.xml index 2b91153957d1..059c990d2a14 100644 --- a/reference/mysqli/mysqli_stmt/result-metadata.xml +++ b/reference/mysqli/mysqli_stmt/result-metadata.xml @@ -40,10 +40,6 @@ - - The result set structure should be freed when you are done with it, - which you can do by passing it to mysqli_free_result - The result set returned by mysqli_stmt_result_metadata contains only From eb2b8c9de5909de11c7b3a6a1f01f8eee023e356 Mon Sep 17 00:00:00 2001 From: Kamil Tekiela Date: Thu, 9 Oct 2025 16:18:36 +0100 Subject: [PATCH 2/2] Improve the documentation of mysqli_stmt_result_metadata() --- .../mysqli/mysqli_stmt/result-metadata.xml | 30 +++++++++---------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/reference/mysqli/mysqli_stmt/result-metadata.xml b/reference/mysqli/mysqli_stmt/result-metadata.xml index 059c990d2a14..724df29fb758 100644 --- a/reference/mysqli/mysqli_stmt/result-metadata.xml +++ b/reference/mysqli/mysqli_stmt/result-metadata.xml @@ -25,8 +25,15 @@ that can be used to process the meta information such as total number of fields and individual field information. + + This function returns an empty mysqli_result 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 mysqli_stmt_get_result to + retrieve the entire result set from a prepared statement as a result object. + - This result set pointer can be passed as an argument to any of the + This result set object can be passed as an argument only to the field-based functions that process result set metadata, such as: mysqli_num_fields @@ -42,9 +49,10 @@ - The result set returned by mysqli_stmt_result_metadata contains only - metadata. It does not contain any row results. The rows are obtained by using the - statement handle with mysqli_stmt_fetch. + The result set returned by mysqli_stmt_result_metadata + contains only metadata. It does not contain any row results. + The rows are obtained by calling mysqli_stmt_get_result + on the statement handle or with mysqli_stmt_fetch. @@ -62,6 +70,7 @@ &reftitle.returnvalues; Returns a result object or &false; if an error occurred. + If the statement does not produce a result set, &false; is returned as well. @@ -94,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(); ?> ]]> @@ -126,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); ?> ]]> @@ -144,6 +141,7 @@ mysqli_close($link); mysqli_prepare mysqli_free_result + mysqli_stmt_get_result