1mysql_stmt_prepare(3) MariaDB Connector/C mysql_stmt_prepare(3)
2
3
4
5 Name
6 mysql_stmt_prepare - Prepares an SQL string
7
8 Synopsis
9 #include <mysql.h>
10
11 int mysql_stmt_prepare(MYSQL_STMT * stmt,
12 const char * query,
13 unsigned long length);
14
15 Description
16 Prepares the SQL query.
17
18 Parameter
19 • stmt - a statement handle, which was previously allocated by
20 mysql_stmt_init(3).
21
22 • query - SQL statement
23
24 • length - length of SQL statement
25
26 Return value
27 Zero on success, non zero on error.
28
29 Notes
30 • The parameter markers must be bound to application variables using
31 mysql_stmt_bind_param(3).
32
33 • The maximum number of parameters is 65535 (0xFFFF).
34
35 • The markers are legal only in certain places in SQL statements. For
36 example, they are allowed in the VALUES() list ofINSERT statement (to
37 specify column values for a row), or in a comparison with a column in
38 a [select()](WHERE]] clause to specify a comparison value. However,
39 they are not allowed in identifiers (such as table or column names)
40 in the select list that names the columns to be returned by SELECT
41 statement, or to specify both operands of a binary operator such as
42 the equal sign. The latter restriction is necessary because it would
43 be impossible to determine the parameter type. In general, parame‐
44 ters are legal only in Data Manipulation Language (DML) statements,
45 and not in Data Definition Language (DDL) statements.
46
47 See Also
48 • mysql_stmt_init(3)
49
50 • mysql_stmt_param_count(3)
51
52 • mysql_stmt_execute(3)
53
54
55
56Version 3.2.2 mysql_stmt_prepare(3)