pub struct ExecuteResult { /* private fields */ }Expand description
A result from a query execution, listing the number of affected rows.
If executing multiple queries, the resulting counts will be come separately, marking the rows affected for each query.
§Example
let result = client
.execute(
"INSERT INTO #Test (id) VALUES (@P1); INSERT INTO #Test (id) VALUES (@P2, @P3)",
&[&1i32, &2i32, &3i32],
)
.await?;
assert_eq!(&[1, 2], result.rows_affected());Implementations§
Source§impl<'a> ExecuteResult
impl<'a> ExecuteResult
Sourcepub fn rows_affected(&self) -> &[u64]
pub fn rows_affected(&self) -> &[u64]
The rows affected by each INSERT, UPDATE, DELETE, MERGE or other
non-SELECT statement, in execution order, including those run by
procedures and triggers. SELECTs and variable assignments
(SET @v = .., SELECT @v = ..) are left out, and statements under
SET NOCOUNT ON report nothing. This is what SqlClient’s
ExecuteNonQuery counts.
Sourcepub fn total(self) -> u64
pub fn total(self) -> u64
The sum of rows_affected: SqlClient’s
ExecuteNonQuery result, except that it is 0 rather than -1 when no
statement reported a count.
§Example
let rows_affected = client
.execute(
"INSERT INTO #Test (id) VALUES (@P1); INSERT INTO #Test (id) VALUES (@P2, @P3)",
&[&1i32, &2i32, &3i32],
)
.await?;
assert_eq!(3, rows_affected.total());Trait Implementations§
Source§impl Debug for ExecuteResult
impl Debug for ExecuteResult
Source§impl IntoIterator for ExecuteResult
impl IntoIterator for ExecuteResult
Auto Trait Implementations§
impl Freeze for ExecuteResult
impl RefUnwindSafe for ExecuteResult
impl Send for ExecuteResult
impl Sync for ExecuteResult
impl Unpin for ExecuteResult
impl UnsafeUnpin for ExecuteResult
impl UnwindSafe for ExecuteResult
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more