Executes multiple queries, delimited with `;` and return multiple result sets; one for each query. Passthrough method for [`tiberius::Client::simple_query`]. Note: The returned [`Future`] does not need to be awaited for the query to be sent. [`Future`]: std::future::Future
(
&mut self,
query: impl Into<Cow<'a, str>>,
)
| 268 | /// |
| 269 | /// [`Future`]: std::future::Future |
| 270 | pub async fn simple_query<'a>( |
| 271 | &mut self, |
| 272 | query: impl Into<Cow<'a, str>>, |
| 273 | ) -> Result<SmallVec<[tiberius::Row; 1]>, SqlServerError> { |
| 274 | let (tx, rx) = tokio::sync::oneshot::channel(); |
| 275 | let kind = RequestKind::SimpleQuery { |
| 276 | query: query.into().to_string(), |
| 277 | }; |
| 278 | self.tx |
| 279 | .send(Request { tx, kind }) |
| 280 | .context("sending request")?; |
| 281 | |
| 282 | let response = rx.await.context("channel")??; |
| 283 | match response { |
| 284 | Response::Rows(rows) => Ok(rows), |
| 285 | other @ Response::Execute { .. } | other @ Response::RowStream { .. } => Err( |
| 286 | SqlServerError::ProgrammingError(format!("expected Response::Rows, got {other:?}")), |
| 287 | ), |
| 288 | } |
| 289 | } |
| 290 | |
| 291 | /// Starts a transaction which is automatically rolled back on drop. |
| 292 | /// |