mariadb_stmt_execute_direct prepares and executes a statement in a single call using a pre-allocated MYSQL_STMT handle, available in Connector/C 3.0 with MariaDB 10.2 or later.
stmt - A statement handle, which was previously allocated by mysql_stmt_init().
query SQL statement
length Length of SQL statement
Description
Prepares and executes a statement which was previously allocated by mysql_stmt_init(), using the current values of the parameter variables if any parameters exist in the statement.
Returns zero on success, non-zero on failure.
This function was added in Connector/C 3.0 and requires MariaDB 10.2 or later versions.
Since the number of parameter of the statement is unknown before execution it is mandatory to set the number of parameters via the mysql_stmt_attr_set() function.
If the SQL statement is a zero-terminated string, you can also pass -1 as length.
The statement handle is intended for one-time execution. Reusing the statement handle might lead to unexpected behavior.