mysql_prepare()
mysql_param_count()
mysql_prepare_result()
mysql_bind_param()
mysql_execute()
mysql_stmt_affected_rows()
mysql_bind_result()
mysql_stmt_store_result()
mysql_stmt_data_seek()
mysql_stmt_row_seek()
mysql_stmt_row_tell()
mysql_stmt_num_rows()
mysql_fetch()
mysql_send_long_data()
mysql_stmt_close()
mysql_stmt_errno()
mysql_stmt_error()
mysql_stmt_sqlstate()
mysql_bind_param()
my_bool mysql_bind_param(MYSQL_STMT *stmt, MYSQL_BIND *bind)
mysql_bind_param()
is used to bind data for the parameter markers
in the SQL statement that was passed to mysql_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 an element for each
`?' parameter marker that is present in the query.
Suppose you prepare the following statment:
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];
The members of each MYSQL_BIND
element that should be set are described
in section 9.1.5 C API Prepared Statement Datatypes.
Zero if the bind was successful. Non-zero if an error occurred.
CR_NO_PREPARE_STMT
CR_NO_PARAMETERS_EXISTS
CR_INVALID_BUFFER_USE
CR_UNSUPPORTED_PARAM_TYPE
buffer_type
value is
illegal or is not one of the supported types.
CR_OUT_OF_MEMORY
CR_UNKNOWN_ERROR
For the usage of mysql_bind_param()
, refer to the Example from
section 9.1.7.5 mysql_execute()
.