stakowerflol
stakowerflol

Reputation: 1079

How find code of the function in R package code?

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.

Upvotes: 1

Views: 60

Answers (1)

snaut
snaut

Reputation: 2535

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.

Upvotes: 1

Related Questions