1mysql_affected_rows(3)        MariaDB Connector/C       mysql_affected_rows(3)
2
3
4
5   Name
6       mysql_affected_rows  -  returns the number of rows affected by the last
7       operation
8
9   Synopsis
10              #include <mysql.h>
11
12              my_ulonglong mysql_affected_rows(MYSQL * mysql);
13
14   Description
15       Returns the number of affected rows by the  last  operation  associated
16       with mysql, if the operation was an “upsert” (INSERT, UPDATE, DELETE or
17       REPLACE) statement, or -1 if the last operation failed.
18
19   Parameters:
20       mysql is a connection identifier, which  was  previously  allocated  by
21       mysql_init(3) and connected by mysql_real_connect(3).
22
23   Notes:
24       • When using UPDATE, MariaDB will not update columns where the new val‐
25         ue is the same as the old value.  This creates the  possibility  that
26         mysql_affected_rows  may  not  actually  equal  the  number  of  rows
27         matched, only the number of rows that were literally affected by  the
28         query.
29
30       • The  REPLACE statement first deletes the record with the same primary
31         key and then inserts the new record.  This function returns the  num‐
32         ber of deleted records in addition to the number of inserted records.
33

Return value

35       Returns the number of affected rows or -1 on error.
36
37   See also
38mysql_num_rows(3)
39
40
41
42Version 3.3.1                                           mysql_affected_rows(3)
Impressum