this ruins queries with multiple select statements because if one select returns nothing you cant know which select it was
|
pub async fn into_results(mut self) -> crate::Result<Vec<Vec<Row>>> { |
|
let mut results: Vec<Vec<Row>> = Vec::new(); |
|
let mut result: Option<Vec<Row>> = None; |
|
|
|
while let Some(item) = self.try_next().await? { |
|
match (item, &mut result) { |
|
(QueryItem::Row(row), None) => { |
|
result = Some(vec![row]); |
|
} |
|
(QueryItem::Row(row), Some(ref mut result)) => result.push(row), |
|
(QueryItem::Metadata(_), None) => { |
|
result = Some(Vec::new()); |
|
} |
|
(QueryItem::Metadata(_), ref mut previous_result) => { |
|
results.push(previous_result.take().unwrap()); |
|
result = None; |
|
} |
|
} |
|
} |
|
|
|
if let Some(result) = result { |
|
results.push(result); |
|
} |
|
|
|
Ok(results) |
|
} |
this ruins queries with multiple select statements because if one select returns nothing you cant know which select it was
tiberius/src/tds/stream/query.rs
Lines 223 to 248 in 406ad27