MCPcopy Create free account
hub / github.com/apache/arrow-rs / write_bind_params

Method write_bind_params

arrow-flight/src/sql/client.rs:564–597  ·  view source on GitHub ↗

Submit parameters to the server, if any have been set on this prepared statement instance Updates our stored prepared statement handle with the handle given by the server response.

(&mut self)

Source from the content-addressed store, hash-verified

562 /// Submit parameters to the server, if any have been set on this prepared statement instance
563 /// Updates our stored prepared statement handle with the handle given by the server response.
564 async fn write_bind_params(&mut self) -> Result<()> {
565 if let Some(ref params_batch) = self.parameter_binding {
566 let cmd = CommandPreparedStatementQuery {
567 prepared_statement_handle: self.handle.clone(),
568 };
569
570 let descriptor = FlightDescriptor::new_cmd(cmd.as_any().encode_to_vec());
571 let flight_stream_builder = FlightDataEncoderBuilder::new()
572 .with_flight_descriptor(Some(descriptor))
573 .with_schema(params_batch.schema());
574 let flight_data = flight_stream_builder
575 .build(futures::stream::iter(
576 self.parameter_binding.clone().map(Ok),
577 ))
578 .try_collect::<Vec<_>>()
579 .await?;
580
581 // Attempt to update the stored handle with any updated handle in the DoPut result.
582 // Older servers do not respond with a result for DoPut, so skip this step when
583 // the stream closes with no response.
584 if let Some(result) = self
585 .flight_sql_client
586 .do_put(stream::iter(flight_data))
587 .await?
588 .message()
589 .await?
590 {
591 if let Some(handle) = self.unpack_prepared_statement_handle(&result)? {
592 self.handle = handle;
593 }
594 }
595 }
596 Ok(())
597 }
598
599 /// Decodes the app_metadata stored in a [`PutResult`] as a
600 /// [`DoPutPreparedStatementResult`] and then returns

Callers 2

executeMethod · 0.80
execute_updateMethod · 0.80

Calls 8

cloneMethod · 0.45
as_anyMethod · 0.45
with_schemaMethod · 0.45
schemaMethod · 0.45
buildMethod · 0.45
do_putMethod · 0.45

Tested by

no test coverage detected