# mysql\_stmt\_store\_result

## Syntax

```c
int mysql_stmt_store_result(MYSQL_STMT * stmt);
```

* `stmt` - a statement handle, which was previously allocated by [mysql\_stmt\_init()](/docs/connectors/mariadb-connector-c/api-prepared-statement-functions/mysql_stmt_init.md).

## Description

You must call `mysql_stmt_store_result()` for every query that successfully produces a result set ([SELECT](/docs/server/reference/sql-statements/data-manipulation/selecting-data/select.md), [SHOW](/docs/server/reference/sql-statements/administrative-sql-statements/show.md), [DESCRIBE](/docs/server/reference/sql-statements/administrative-sql-statements/describe.md), [EXPLAIN](/docs/server/reference/sql-statements/administrative-sql-statements/analyze-and-explain-statements/explain.md)), and only if you want to buffer the complete result set by the client, so that the subsequent [mysql\_stmt\_fetch()](/docs/connectors/mariadb-connector-c/api-prepared-statement-functions/mysql_stmt_fetch.md) call returns buffered data.

Returns zero on success, nonzero if an error occurred.

{% hint style="info" %}
You can detect whether the statement produced a result set by checking the return value of [mysql\_stmt\_result\_metadata()](/docs/connectors/mariadb-connector-c/api-prepared-statement-functions/mysql_stmt_result_metadata.md) function.
{% endhint %}

## See Also

* [mysql\_stmt\_result\_metadata()](/docs/connectors/mariadb-connector-c/api-prepared-statement-functions/mysql_stmt_result_metadata.md)
* [mysql\_stmt\_fetch()](/docs/connectors/mariadb-connector-c/api-prepared-statement-functions/mysql_stmt_fetch.md)

{% @marketo/form formId="4316" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mariadb.com/docs/connectors/mariadb-connector-c/api-prepared-statement-functions/mysql_stmt_store_result.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
