Rechercher dans le manuel MySQL
28. 7. 11. 21 mysql _stmt _prepare ()
int mysql_stmt_prepare(MYSQL_STMT *stmt, const char
*stmt_str, unsigned long length)
Description
Given the statement handler returned by
mysql_stmt_init()
, prepares
the SQL statement pointed to by the string
stmt_str
and returns a status value. The
string length should be given by the length
argument. The string 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 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.
Metadata changes to tables or views referred to by prepared statements are detected and cause automatic repreparation of the statement when it is next executed. For more information, see Section 8.10.3, “Caching of Prepared Statements and Stored Programs”.
Commands were executed in an improper order.
Out of memory.
The MySQL server has gone away.
The connection to the server was lost during the query
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()
.
See the Example in Section 28.7.11.10, “mysql_stmt_execute()”.
Traduction non disponible
Le manuel MySQL n'est pas encore traduit en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.
Document créé le 26/06/2006, dernière modification le 26/10/2018
Source du document imprimé : https://www.gaudry.be/mysql-rf-mysql-stmt-prepare.html
L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.
Références
Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.