C API Prepared Statement Function Descriptions
2216
The application can include one or more parameter markers in the SQL statement by embedding
question mark (
?
) characters into the SQL string at the appropriate positions.
The markers are legal only in certain places in SQL statements. For example, they are permitted in
the
VALUES()
list of an
INSERT
statement (to specify column values for a row), or in a comparison
with a column in a
WHERE
clause to specify a comparison value. However, they are not permitted for
identifiers (such as table or column names), or to specify both operands of a binary operator such
as the
=
equal sign. The latter restriction is necessary because it would be impossible to determine
the parameter type. In general, parameters are legal only in Data Manipulation Language (DML)
statements, and not in Data Definition Language (DDL) statements.
The parameter markers must be bound to application variables using
mysql_stmt_bind_param()
before executing the statement.
Return Values
Zero if the statement was prepared successfully. Nonzero if an error occurred.
Errors
•
CR_COMMANDS_OUT_OF_SYNC
[2942]
Commands were executed in an improper order.
•
CR_OUT_OF_MEMORY
[2942]
Out of memory.
•
CR_SERVER_GONE_ERROR
[2942]
The MySQL server has gone away.
•
CR_SERVER_LOST
[2942]
The connection to the server was lost during the query
•
CR_UNKNOWN_ERROR
[2941]
An unknown error occurred.
If the prepare operation was unsuccessful (that is,
mysql_stmt_prepare()
returns nonzero), the
error message can be obtained by calling
mysql_stmt_error()
.
Example
See the Example in
Section 20.6.10.10, “
mysql_stmt_execute()
”
.
20.6.10.21.
mysql_stmt_reset()
my_bool mysql_stmt_reset(MYSQL_STMT *stmt)
Description
Resets a prepared statement on client and server to state after prepare. It resets the statement on the
server, data sent using
mysql_stmt_send_long_data()
, unbuffered result sets and current errors.
It does not clear bindings or stored result sets. Stored result sets will be cleared when executing the
prepared statement (or closing it).
To re-prepare the statement with another query, use
mysql_stmt_prepare()
.
Return Values
Zero if the statement was reset successfully. Nonzero if an error occurred.
Summary of Contents for 5.0
Page 1: ...MySQL 5 0 Reference Manual ...
Page 18: ...xviii ...
Page 60: ...40 ...
Page 396: ...376 ...
Page 578: ...558 ...
Page 636: ...616 ...
Page 844: ...824 ...
Page 1234: ...1214 ...
Page 1427: ...MySQL Proxy Scripting 1407 ...
Page 1734: ...1714 ...
Page 1752: ...1732 ...
Page 1783: ...Configuring Connector ODBC 1763 ...
Page 1793: ...Connector ODBC Examples 1773 ...
Page 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Page 2850: ...2830 ...
Page 2854: ...2834 ...
Page 2928: ...2908 ...
Page 3000: ...2980 ...
Page 3122: ...3102 ...
Page 3126: ...3106 ...
Page 3174: ...3154 ...
Page 3232: ...3212 ...