MySQL 8.4.0
Source Code Documentation
s_mysql_mysql_stmt_execute Struct Reference

A service that provides the API to execute prepared statements. More...

#include <mysql_statement_service.h>

Public Attributes

mysql_service_status_t(* execute )(my_h_statement statement)
 Execute the prepared statement. More...
 
mysql_service_status_t(* prepare )(mysql_cstring_with_length query, my_h_statement statement)
 Prepare the statement with the query. More...
 
mysql_service_status_t(* reset )(my_h_statement statement)
 For prepared statements, calling reset would reset the binding parameters, close the cursor if one is open and frees the result sets. More...
 

Detailed Description

A service that provides the API to execute prepared statements.

Usage example: Prepare a statement my_h_statement statement = nullptr; SERVICE_PLACEHOLDER(mysql_stmt_factory)->init(&statement); SERVICE_PLACEHOLDER(mysql_stmt_execute)->prepare("SELECT * FROM my_table WHERE col_c = ?", statement) SERVICE_PLACEHOLDER(mysql_stmt_bind)->bind_param(statement, 0, false, MYSQL_TYPE_LONG, false, 4, 1, nullptr, 0);

To reset the parameter to bind it with new values SERVICE_PLACEHOLDER(mysql_stmt_execute)->reset(statement)

Execute the statement SERVICE_PLACEHOLDER(mysql_stmt_execute)->execute(statement)

Member Data Documentation

◆ execute

mysql_service_status_t(* s_mysql_mysql_stmt_execute::execute) (my_h_statement statement)

Execute the prepared statement.

Note
Execute will fail if all parameters are not bound.
To execute regular statement, use mysql_stmt_execute_direct::execute instead.
Parameters
[in]statementA handle to the statement
Returns
Status of the performed operation
Return values
falsesuccess
truefailure

◆ prepare

Prepare the statement with the query.

Note
Re-preparation is not allowed after the statement has been created. To prepare a new query, create a new statement instead.
Calling this on regular statements would fail.
Parameters
[in]queryThe query string to be prepared
[in]statementA handle to the statement
Returns
Status of the performed operation
Return values
falsesuccess
truefailure

◆ reset

mysql_service_status_t(* s_mysql_mysql_stmt_execute::reset) (my_h_statement statement)

For prepared statements, calling reset would reset the binding parameters, close the cursor if one is open and frees the result sets.

For regular statements, calling reset is not supported. To close and clean up the statement, use mysql_stmt_factory::close.

Note
For prepared statements, the statement still exists, only the result sets are destroyed.
Calling this on regular statements would fail.
Parameters
[in]statementA handle to the statement
Returns
Status of the performed operation
Return values
falsesuccess
truefailure

The documentation for this struct was generated from the following file: