mysql_stmt_bind_param()

2023-07-26 02:37:19  Updated

You can call the mysql_stmt_bind_param() function to associate application data buffers with parameter markers in a prepared statement.

Syntax

my_bool
mysql_stmt_bind_param(MYSQL_STMT *stmt,
                      MYSQL_BIND *bind)

bind is the address of an array of MYSQL_BIND structures.

Return values

0 is returned for an execution success, and a non-zero value is returned if an error occurred.

Errors

  • CR_UNSUPPORTED_PARAM_TYPE: The conversion is not supported. Maybe the buffer_type value is invalid or the type is not supported.

  • CR_OUT_OF_MEMORY: The memory is insufficient.

  • CR_UNKNOWN_ERROR: An unknown error occurred.

Notes

mysql_stmt_bind_param() binds the input data marked by parameters in an SQL statement that is passed to mysql_stmt_prepare(). It uses the MYSQL_BIND structure to provide data.

The client library expects that each element in the array contains one ? parameter marker in the current query. For example, prepare the following statement:

INSERT INTO mytbl1 VALUES(?,?,?)

When you bind the parameters, the array of MYSQL_BIND structures must contain three elements, as shown in the following example:

MYSQL_BIND bind[3];

Contact Us