db_execute()
Execute a database statement
Executes a SQL statement on a database without returning results. The connection is created, used, and automatically closed.
Usage
db_execute(query, connection_name, ...)
Arguments
| Name | Description |
|---|---|
| query |
SQL statement to execute |
| connection_name |
Name of the connection in config.yml |
| ... |
Additional arguments passed to DBI::dbExecute |
Value
Number of rows affected
Examples
if (FALSE) {
rows <- db_execute("DELETE FROM cache WHERE expired = TRUE", "my_db")
}