DELETE {pgTools}R Documentation

Generate a PostgreSQL DELETE statement, optionally execute the statement if con is not NULL.

Description

Generate a PostgreSQL DELETE statement, optionally execute the statement if con is not NULL.

Usage

DELETE(schema = NULL, table, where = NULL, con = NULL)

Arguments

schema

A string, the schema name of the SQL table to DELETE from.

table

A string, the table name of the SQL table to DELETE from.

where

A named list, names are the columns for comparison, values are lists with a comparison operator and a value the comparison operator will check against. ex: list(col1 = list(comparison = "=", value = quoteText("b")))

con

A database connection that can be passed to DBI::dbSendQuery/DBI::dbGetQuery.

Value

A string, PostgreSQL DELETE statement; or the results retrieved by DBI::dbGetQuery after executing the statement.

Examples

DELETE(
schema = "test",
table = "table1",
where = list(
  col1 = list(comparison = "=", value = quoteText("b")),
  col2 = list(comparison = "IS", value = "NULL")
)
)

[Package pgTools version 1.0.2 Index]