Skip to contents

Delete rows from selected database table

Usage

cas_delete_from_db(
  table,
  id = NULL,
  batch = NULL,
  index_group = NULL,
  ask = TRUE,
  db_folder = NULL,
  db_connection = NULL,
  disconnect_db = FALSE,
  ...
)

Arguments

table

Name of the table from where rows should be deleted.

id

Defaults to NULL. A vector of id. Rows with the given id will be removed from the database.

batch

Defaults to NULL. A vector of batch identigiers. Rows with the given batch id will be removed from the database.

index_group

Defaults to NULL. A vector of "index_group" names. Rows with the given "index_group" will be removed from the database.

ask

Defaults to TRUE. If TRUE, it runs a query checking how many rows would be deleted, and actually deletes them only after confirming.

db_connection

Defaults to NULL. If NULL, uses local SQLite database. If given, must be a connection object or a list with relevant connection settings (see example).

disconnect_db

Defaults to TRUE. If FALSE, leaves the connection to database open.

...

Passed to cas_get_db_file().

Value

Nothing, used for its side effects.

Examples

if (FALSE) {
if (interactive) {
  cas_delete_from_db(table = "contents_data", id = id_to_delete)
}
}