my_bool mysql_stmt_bind_param(MYSQL_STMT *stmt,
MYSQL_BIND *bind)
Description
mysql_stmt_bind_param()
is used
to bind input data for the parameter markers in the SQL
statement that was passed to
mysql_stmt_prepare()
. It uses
MYSQL_BIND
structures to supply the data.
bind
is the address of an array of
MYSQL_BIND
structures. The client library
expects the array to contain one element for each
“?
” parameter marker that is
present in the query.
Suppose that you prepare the following statement:
INSERT INTO mytbl VALUES(?,?,?)
When you bind the parameters, the array of
MYSQL_BIND
structures must contain three
elements, and can be declared like this:
MYSQL_BIND bind[3];
Section 22.9.5, “C API Prepared Statement Data Structures”,
describes the members of each MYSQL_BIND
element and how they should be set to provide input values.
Return Values
Zero if the bind operation was successful. Nonzero if an error occurred.
Errors
The conversion is not supported. Possibly the
buffer_type
value is illegal or is not one of the supported types.Out of memory.
An unknown error occurred.
Example
See the Example in Section 22.9.7.10, “mysql_stmt_execute()
”.