1

I want to find the code of DBI::dbGetRowsAffected. I downloaded the package DBI from https://github.com/r-dbi/DBI and found only this by dbGetRowsAffected:

#' The number of rows affected
#'
#' This method returns the number of rows that were added, deleted, or updated
#' by a data manipulation statement.
#'
#' @template methods
#' @templateVar method_name dbGetRowsAffected
#'
#' @inherit DBItest::spec_meta_get_rows_affected return
#'
#' @inheritParams dbClearResult
#' @family DBIResult generics
#' @export
#' @examples
#' con <- dbConnect(RSQLite::SQLite(), ":memory:")
#'
#' dbWriteTable(con, "mtcars", mtcars)
#' rs <- dbSendStatement(con, "DELETE FROM mtcars")
#' dbGetRowsAffected(rs)
#' nrow(mtcars)
#'
#' dbClearResult(rs)
#' dbDisconnect(con)
setGeneric("dbGetRowsAffected",
  def = function(res, ...) standardGeneric("dbGetRowsAffected"),
  valueClass = "numeric"
)

but where is the implementation of it? I can see here is some inheritance from DBItest::spec_meta_get_rows_affected return. So I have downloaded DBItest package from https://github.com/r-dbi/DBItest and search for spec_meta_get_rows_affected. Found that this is just the unit test.

1 Answer 1

1

As stated in the readme on github:

The DBI package defines a common interface between the R and database management systems (DBMS).

The package defines an interface and does not implement the methods itself. The methods are defined there but implemented in driver-packages implementing the interface and requiring the DBI package.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.