pub struct MultiResultStream<'a> { /* private fields */ }Expand description
Multiple result sets from a batch or stored procedure.
Some queries return multiple result sets (e.g., stored procedures with multiple SELECT statements, or batches with multiple queries).
§Example
// Execute a batch with multiple SELECTs
let mut results = client.query_multiple("SELECT 1 AS a; SELECT 2 AS b, 3 AS c;", &[]).await?;
// Process first result set
while let Some(row) = results.next_row().await? {
println!("Result 1: {:?}", row);
}
// Move to second result set
if results.next_result().await? {
while let Some(row) = results.next_row().await? {
println!("Result 2: {:?}", row);
}
}Implementations§
Source§impl<'a> MultiResultStream<'a>
impl<'a> MultiResultStream<'a>
Sourcepub fn current_result_index(&self) -> usize
pub fn current_result_index(&self) -> usize
Get the current result set index (0-based).
Sourcepub fn result_count(&self) -> usize
pub fn result_count(&self) -> usize
Get the total number of result sets.
Sourcepub fn has_more_results(&self) -> bool
pub fn has_more_results(&self) -> bool
Check if there are more result sets after the current one.
Sourcepub fn columns(&self) -> Option<&[Column]>
pub fn columns(&self) -> Option<&[Column]>
Get the column metadata for the current result set.
Returns None if there are no result sets or we’ve moved past all of them.
Sourcepub async fn next_result(&mut self) -> Result<bool, Error>
pub async fn next_result(&mut self) -> Result<bool, Error>
Move to the next result set.
Returns true if there is another result set, false if no more.
Sourcepub async fn next_row(&mut self) -> Result<Option<Row>, Error>
pub async fn next_row(&mut self) -> Result<Option<Row>, Error>
Get the next row from the current result set.
Returns None when no more rows in the current result set.
Call next_result() to move to the next result set.
Sourcepub fn current_result_set(&mut self) -> Option<&mut ResultSet>
pub fn current_result_set(&mut self) -> Option<&mut ResultSet>
Get a mutable reference to the current result set.
Sourcepub fn collect_current(&mut self) -> Vec<Row>
pub fn collect_current(&mut self) -> Vec<Row>
Collect all rows from the current result set.
Sourcepub fn into_query_streams(self) -> Vec<QueryStream<'a>>
pub fn into_query_streams(self) -> Vec<QueryStream<'a>>
Consume the stream and return all result sets as QueryStreams.