MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / simple_query

Method simple_query

src/sql-server-util/src/lib.rs:270–289  ·  view source on GitHub ↗

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>>,
    )

Source from the content-addressed store, hash-verified

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 ///

Callers 15

snapshotMethod · 0.45
newMethod · 0.45
create_savepointMethod · 0.45
get_lsnMethod · 0.45
lock_table_sharedMethod · 0.45
rollbackMethod · 0.45
commitMethod · 0.45
handle_requestMethod · 0.45
get_max_lsnFunction · 0.45

Calls 4

channelFunction · 0.85
to_stringMethod · 0.45
contextMethod · 0.45
sendMethod · 0.45