dbExecute-DatabaseConnectorConnection-character-method: Execute an update statement, query number of rows affected,...

dbExecute,DatabaseConnectorConnection,character-methodR Documentation

Execute an update statement, query number of rows affected, and then close result set

Description

Executes a statement and returns the number of rows affected. dbExecute() comes with a default implementation (which should work with most backends) that calls dbSendStatement(), then dbGetRowsAffected(), ensuring that the result is always free-d by dbClearResult(). For passing query parameters, see dbBind(), in particular the "The command execution flow" section.

Usage

## S4 method for signature 'DatabaseConnectorConnection,character'
dbExecute(conn, statement, translate = TRUE, ...)

Arguments

conn

A DBIConnection object, as returned by dbConnect().

statement

a character string containing SQL.

translate

Translate the query using SqlRender?

...

Other parameters passed on to methods.

Details

You can also use dbExecute() to call a stored procedure that performs data manipulation or other actions that do not return a result set. To execute a stored procedure that returns a result set, or a data manipulation query that also returns a result set such as ⁠INSERT INTO ... RETURNING ...⁠, use dbGetQuery() instead.

Value

dbExecute() always returns a scalar numeric that specifies the number of rows affected by the statement.

See Also

For queries: dbSendQuery() and dbGetQuery().

Other DBIConnection generics: DBIConnection-class, dbAppendTable(), dbCreateTable(), dbDataType(), dbDisconnect(), dbExistsTable(), dbGetException(), dbGetInfo(), dbGetQuery(), dbIsReadOnly(), dbIsValid(), dbListFields(), dbListObjects(), dbListResults(), dbListTables(), dbReadTable(), dbRemoveTable(), dbSendQuery(), dbSendStatement(), dbWriteTable()


DatabaseConnector documentation built on Nov. 8, 2023, 5:07 p.m.