DBI (version 0.5-1)

dbGetRowsAffected: The number of rows affected

Description

This function returns the number of rows that were added, deleted, or updated by a data manipulation statement. For a selection query, this function returns 0.

Usage

dbGetRowsAffected(res, ...)

Arguments

res
An object inheriting from DBIResult.
...
Other arguments passed on to methods.

Value

a numeric vector of length 1

See Also

Other DBIResult generics: DBIResult-class, SQL, dbBind, dbClearResult, dbColumnInfo, dbFetch, dbGetInfo, dbGetRowCount, dbGetStatement, dbHasCompleted, dbIsValid

Examples

Run this code
con <- dbConnect(RSQLite::SQLite(), ":memory:")

dbWriteTable(con, "mtcars", mtcars)
rs <- dbSendStatement(con, "DELETE FROM mtcars")
dbGetRowsAffected(rs)
nrow(mtcars)

dbClearResult(rs)
dbDisconnect(con)

Run the code above in your browser using DataCamp Workspace