db_execute()
Run a statement, commit it, and return the number of rows affected.
Usage
db_execute(
query: str,
connection_name: str,
params: Sequence[Any] | Mapping[str, Any] | None = None,
) -> int
Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| query required | str |
The SQL statement. |
|
| connection_name required | str |
The connection's name in the settings. The connection is opened for this statement and closed afterward. |
|
| params | Sequence[Any] | Mapping[str, Any] | None | None |
Values for the statement's placeholders, as a sequence or a mapping. The placeholder style is the driver's, as in |
Value
The driver's count of affected rows, or -1 when the driver does not report one.
Raises
FrameworkError: When the connection cannot be opened or the statement fails.