R/dbExistsTable_SQLiteConnection_character.R

Defines functions dbExistsTable_SQLiteConnection_character

Documented in dbExistsTable_SQLiteConnection_character

#' @rdname SQLiteConnection-class
#' @usage NULL
dbExistsTable_SQLiteConnection_character <- function(conn, name, ...) {
  stopifnot(length(name) == 1L)
  rs <- sqliteListTablesWithName(conn, name)
  on.exit(dbClearResult(rs), add = TRUE)

  nrow(dbFetch(rs, 1L)) > 0
}
#' @rdname SQLiteConnection-class
#' @export
setMethod("dbExistsTable", c("SQLiteConnection", "character"), dbExistsTable_SQLiteConnection_character)
rstats-db/RSQLite documentation built on April 20, 2024, 11:56 a.m.