my_ulonglong mysql_stmt_affected_rows(MYSQL_STMT
*stmt)
Description
Returns the total number of rows changed, deleted, or inserted
by the last executed statement. May be called immediately
after mysql_stmt_execute()
for
UPDATE
, DELETE
, or
INSERT
statements. For
SELECT
statements,
mysql_stmt_affected_rows()
works like
mysql_num_rows()
.
This function was added in MySQL 4.1.0.
Return Values
An integer greater than zero indicates the number of rows
affected or retrieved. Zero indicates that no records were
updated for an UPDATE
statement, no rows
matched the WHERE
clause in the query, or
that no query has yet been executed. -1 indicates that the
query returned an error or that, for a
SELECT
query,
mysql_stmt_affected_rows()
was called prior
to calling mysql_stmt_store_result()
.
Because mysql_stmt_affected_rows()
returns
an unsigned value, you can check for -1 by comparing the
return value to (my_ulonglong)-1
(or to
(my_ulonglong)~0
, which is equivalent).
See Sección 24.2.3.1, “mysql_affected_rows()
” for additional
information on the return value.
Errors
None.
Example
For the usage of
mysql_stmt_affected_rows()
, refer to the
Example from Sección 24.2.7.10, “mysql_stmt_execute()
”.
Ésta es una traducción del manual de referencia de MySQL, que puede encontrarse en dev.mysql.com. El manual de referencia original de MySQL está escrito en inglés, y esta traducción no necesariamente está tan actualizada como la versión original. Para cualquier sugerencia sobre la traducción y para señalar errores de cualquier tipo, no dude en dirigirse a mysql-es@vespito.com.