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

Method execute

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

Executes SQL statements in SQL Server, returning the number of rows effected. Passthrough method for [`tiberius::Client::execute`]. 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>>,
        params: &[&dyn ToSql],
    )

Source from the content-addressed store, hash-verified

148 ///
149 /// [`Future`]: std::future::Future
150 pub async fn execute<'a>(
151 &mut self,
152 query: impl Into<Cow<'a, str>>,
153 params: &[&dyn ToSql],
154 ) -> Result<SmallVec<[u64; 1]>, SqlServerError> {
155 let (tx, rx) = tokio::sync::oneshot::channel();
156
157 let params = params
158 .iter()
159 .map(|p| OwnedColumnData::from(p.to_sql()))
160 .collect();
161 let kind = RequestKind::Execute {
162 query: query.into().to_string(),
163 params,
164 };
165 self.tx
166 .send(Request { tx, kind })
167 .context("sending request")?;
168
169 let response = rx.await.context("channel")??;
170 match response {
171 Response::Execute { rows_affected } => Ok(rows_affected),
172 other @ Response::Rows(_) | other @ Response::RowStream { .. } => {
173 Err(SqlServerError::ProgrammingError(format!(
174 "expected Response::Execute, got {other:?}"
175 )))
176 }
177 }
178 }
179
180 /// Executes SQL statements in SQL Server, returning the resulting rows.
181 ///

Callers 7

handle_requestMethod · 0.45
ensure_fixed_featuresMethod · 0.45
run_recordMethod · 0.45
run_statementMethod · 0.45
prepare_queryMethod · 0.45
execute_view_innerMethod · 0.45
execute_viewMethod · 0.45

Calls 8

channelFunction · 0.85
collectMethod · 0.45
mapMethod · 0.45
iterMethod · 0.45
to_sqlMethod · 0.45
to_stringMethod · 0.45
contextMethod · 0.45
sendMethod · 0.45

Tested by

no test coverage detected