Learn R Programming

SCDB (version 0.5.1)

defer_db_cleanup: Delete table at function exit

Description

This function marks a table for deletion once the current function exits.

Usage

defer_db_cleanup(db_table)

Value

NULL (called for side effects)

Arguments

db_table

(tbl_sql)
A unmanipulated reference to a sql table.

Examples

Run this code
if (FALSE) { # requireNamespace("RSQLite", quietly = TRUE)
  conn <- get_connection()

  mt <- dplyr::copy_to(conn, mtcars)
  id_mt <- id(mt)

  defer_db_cleanup(mt)

  DBI::dbExistsTable(conn, id_mt) # TRUE

  withr::deferred_run()

  DBI::dbExistsTable(conn, id_mt) # FALSE

  close_connection(conn)
}

Run the code above in your browser using DataLab