pub struct ResultSet { /* private fields */ }Expand description
ResultSet contains the rows of a query result.
§Example
while let Some(row) = rs.next().await {
let row: Row = row?;
// Process the row
}Implementations§
Source§impl ResultSet
impl ResultSet
Sourcepub fn metadata(&self) -> Option<&ResultSetMetadata>
pub fn metadata(&self) -> Option<&ResultSetMetadata>
Returns the metadata of the result set.
§Example
if let Some(metadata) = rs.metadata() {
for column in metadata.column_names() {
println!("Column name: {}", column);
}
}Sourcepub fn stats(&self) -> Option<&ResultSetStats>
pub fn stats(&self) -> Option<&ResultSetStats>
Returns the stats of the result set, if available.
§Example
while let Some(row) = rs.next().await {
let row = row?;
// Process row
}
if let Some(stats) = rs.stats() {
println!("Query plan: {:?}", stats.query_plan);
}Stats are only available after the results have been fully consumed and the query was run in PLAN or PROFILE mode.
Sourcepub fn update_count(&self) -> Option<i64>
pub fn update_count(&self) -> Option<i64>
Returns the number of rows modified by the DML statement, if available.
§Example
let runner = db_client.read_write_transaction().build().await?;
runner.run(async |tx| {
let stmt = Statement::builder("UPDATE Singers SET LastName = 'Simpson' WHERE SingerId = @id THEN RETURN SingerId, LastName")
.add_param("id", &123_i64)
.build();
let mut rs = tx.execute_query(stmt).await?;
while let Some(row) = rs.next().await.transpose()? {
// Process returned rows
}
if let Some(count) = rs.update_count() {
println!("Rows modified: {}", count);
}
Ok(())
}).await?;Returns the number of rows modified when this ResultSet was produced from a
DML statement with a THEN RETURN clause.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ResultSet
impl !RefUnwindSafe for ResultSet
impl !UnwindSafe for ResultSet
impl Send for ResultSet
impl Sync for ResultSet
impl Unpin for ResultSet
impl UnsafeUnpin for ResultSet
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request