1mysql_stmt_affected_rows(3) MariaDB Connector/C mysql_stmt_affected_rows(3)
2
3
4
5 Name
6 mysql_stmt_affected_rows - Returns the number of affected rows from
7 previous executed prepared statement
8
9 Synopsis
10 #include <mysql.h>
11
12 my_ulonglong mysql_stmt_affected_rows(MYSQL_STMT * stmt);
13
14 Description
15 Returns the number of affected rows by the last prepared statement as‐
16 sociated with mysql, if the operation was an “upsert” (INSERT, UPDATE,
17 DELETE or REPLACE) statement, or -1 if the last prepared statement
18 failed.
19
20 Parameter
21 • stmt - a statement handle, which was previously allocated by
22 [mysql_stmt_init()](mysql_stmt_init().]]
23
24 Notes
25 • When using UPDATE, MariaDB will not update columns where the new val‐
26 ue is the same as the old value. This creates the possibility that
27 mysql_stmt_affected_rows() may not actually equal the number of rows
28 matched, only the number of rows that were literally affected by the
29 query.
30
31 • The REPLACE statement first deletes the record with the same primary
32 key and then inserts the new record. This function returns the num‐
33 ber of deleted records in addition to the number of inserted records.
34
35 See Also
36 • mysql_stmt_insert_id(3)
37
38
39
40Version 3.2.2 mysql_stmt_affected_rows(3)