mysql_stmt_param_metadata()
<<<
mysql_stmt_prepare() mysql_stmt_send_long_data()
>>>

21.2.7 Descriptions des fonctions C pour les requêtes préparées
21.2 API MySQL C
21 API MySQL
 Manuel de Référence MySQL 4.1 : Version Française

mysql_stmt_init()
mysql_stmt_bind_param()
mysql_stmt_bind_result()
mysql_stmt_execute()
mysql_stmt_fetch()
mysql_stmt_fetch_column()
mysql_stmt_result_metadata()
mysql_stmt_param_count()
mysql_stmt_param_metadata()
->mysql_stmt_prepare()
mysql_stmt_send_long_data()
mysql_stmt_affected_rows()
mysql_stmt_insert_id()
mysql_stmt_close()
mysql_stmt_data_seek()
mysql_stmt_errno()
mysql_stmt_error()
mysql_stmt_free_result()
mysql_stmt_num_rows()
mysql_stmt_reset()
mysql_stmt_row_seek()
mysql_stmt_row_tell()
mysql_stmt_sqlstate()
mysql_stmt_store_result()
mysql_stmt_attr_set()
mysql_stmt_attr_get()

21.2.7.10 mysql_stmt_prepare()

int mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query, unsigned long length)

Description

Prepares the SQL query pointed to by the null-terminated string query , and returns a statement handle to be used for further operations on the statement. The query must consist of a single SQL statement. You should not add a terminating semicolon ( ';' ) or \g to the statement.

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 allowed 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 allowed for identifiers (such as table or column names), in the select list that names the columns to be returned by a SELECT statement), 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 Languange (DML) statements, and not in Data Defination Language (DDL) statements.

The parameter markers must be bound to application variables using mysql_stmt_bind_param() before executing the statement.

Return Values

Errors
    CR_COMMANDS_OUT_OF_SYNC
    Commands were executed in an improper order.
    CR_OUT_OF_MEMORY
    Out of memory.
    CR_SERVER_GONE_ERROR
    The MySQL server has gone away.
    CR_SERVER_LOST
    The connection to the server was lost during the query
    CR_UNKNOWN_ERROR
    An unknown error occurred.
If the prepare is not successful (that is, mysql_stmt_prepare() returns NULL ), the error message can be obtained by calling mysql_error() .

Example

For the usage of mysql_stmt_prepare() , refer to the Example from .

<< mysql_stmt_prepare() >>
mysql_stmt_param_metadata() Descriptions des fonctions C pour les requêtes préparées mysql_stmt_send_long_data()