This method returns the number of rows that were added, deleted, or updated by a data manipulation statement.
This documentation page describes the generics. Refer to the documentation pages linked below for the documentation for the methods that are implemented in various backend packages.
An object inheriting from DBIResult.
Other arguments passed on to methods.
dbGetRowsAffected() returns a scalar number (integer or numeric),
the number of rows affected by a data manipulation statement
The value is available directly after the call
and does not change after calling
For queries issued with
zero is returned before
and after the call to
This section gives a complete overview over the flow
for the execution of SQL statements that have side effects
such as stored procedures, inserting or deleting data,
Most of this flow, except calling
is implemented by
dbExecute(), which should be sufficient
for non-parameterized queries.
This flow requires an active connection established by
vignette("dbi-advanced") for a walkthrough.
Optionally, bind query parameters with
This is required only if the query contains placeholders
$1, depending on the database backend.
dbGetRowsAffected() to retrieve the number
of rows affected by the query.
dbClearResult() to clean up the result set object.
This step is mandatory even if no rows have been fetched
or if an error has occurred during the processing.
It is good practice to use
to ensure that this step is always executed.
Attempting to get the rows affected for a result set cleared with
dbClearResult() gives an error.
Other DBIResult generics: