Skip to main content

execute

Function execute 

Source
pub fn execute(sql: &str) -> i32
Expand description

Run an INSERT, UPDATE, or DELETE statement.

Returns the number of affected rows, or -1 on error.

let affected = db::execute("UPDATE orders SET status = 'shipped' WHERE id = 'abc'");
log::info(&format!("Updated {} rows", affected));