1mysql_real_escape_string(3) MariaDB Connector/C mysql_real_escape_string(3)
2
3
4
5 Name
6 mysql_real_escape_string - escape string by taking into account charac‐
7 ter set of connection
8
9 Synopsis
10 #include <mysql.h>
11
12 unsigned long mysql_real_escape_string(MYSQL * mysql,
13 char * to,
14 const char * from,
15 unsigned long);
16
17 Description
18 This function is used to create a legal SQL string that you can use in
19 an SQL statement. The given string is encoded to an escaped SQL
20 string, taking into account the current character set of the connec‐
21 tion.
22
23 Parameter
24 • mysql - a mysql handle, which was previously allocated by
25 mysql_init(3) and connected by mysql_real_connect(3).
26
27 • to - buffer for the encoded string. The size of this buffer must be
28 length * 2 + 1 bytes: in worst case every character of the from
29 string needs to be escaped. Additionally a trailing 0 character will
30 be appended.
31
32 • from - a string which will be encoded by mysql_real_escape_string().
33
34 • long - the length of the from string.
35
36 Return value
37 Returns the length of the encoded (to) string.
38
39 See also
40 • mysql_escape_string(3)
41
42 • mysql_hex_string(3)
43
44
45
46Version 3.2.2 mysql_real_escape_string(3)