Suppose that you prepare and execute a statement as follows:
1. Call
mysql_stmt_prepare()
2. Call
mysql_stmt_bind_param()
3. Call
mysql_stmt_execute()
As a result of the preceding calls, the server writes the following lines to the general query log:
Prepare
[1] SELECT ?
Execute
[1] SELECT 3
Each
Prepare
keep track of which prepared statement is being logged.
prepared statements active simultaneously for the client,
shows a prepared statement after substitution of data values for
20.6.10. C API Prepared Statement Function Descriptions
To prepare and execute queries, use the functions described in detail in the following sections.
All functions that operate with a
To create a
20.6.10.1.
mysql_stmt_affected_rows()
my_ulonglong mysql_stmt_affected_rows(MYSQL_STMT *stmt)
Description
mysql_stmt_affected_rows()
mysql_stmt_execute(). It is like
a description of what the affected-rows value returned by this function means, See
"mysql_affected_rows()".
Errors
None.
Example
See the Example in
20.6.10.2.
mysql_stmt_attr_get()
my_bool mysql_stmt_attr_get(MYSQL_STMT *stmt, enum enum_stmt_attr_type
option, void *arg)
Description
Can be used to get the current value for a statement attribute.
The
option
contain the option value. If the option is an integer,
See
Section 20.6.10.3,
C API Prepared Statement Function Descriptions
and
line in the log is tagged with a
Execute
MYSQL_STMT
handle, use the
MYSQL_STMT
Section 20.6.10.10,
argument is the option that you want to get; the
"mysql_stmt_attr_set()", for a list of options and option types.
Note
In MySQL 5.0,
mysql_stmt_attr_get()
*, for STMT_ATTR_UPDATE_MAX_LENGTH. This was corrected in
my_bool
MySQL 5.1.7.
to prepare the statement string
to bind the value
3
to execute the prepared statement.
N
N
structure begin with the prefix mysql_stmt_.
mysql_stmt_init()
may be called immediately after executing a statement with
mysql_affected_rows()
"mysql_stmt_execute()".
should point to the value of the integer.
arg
2200
"SELECT
?".
to the parameter in the prepared statement.
statement identifier so that you can
[N]
is a positive integer. If there are multiple
may be greater than 1. Each
parameters.
?
function.
but for prepared statements. For
should point to a variable that should
arg
uses
unsigned int
lines
Execute
Section 20.6.6.1,
*, not
Need help?
Do you have a question about the 5.0 and is the answer not in the manual?
Questions and answers