mariadb_stmt_execute_direct

Syntax

int mariadb_stmt_execute_direct(MYSQL_STMT * stmt, const char *query, size_t length);
  • 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.

See Also

Example

Last updated

Was this helpful?