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)
| 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 |
no test coverage detected