MCPcopy Create free account
hub / github.com/f0rr0/oliphaunt / exec_internal

Method exec_internal

src/pglite/client.rs:671–699  ·  view source on GitHub ↗
(&mut self, sql: &str, options: Option<&QueryOptions>)

Source from the content-addressed store, hash-verified

669 }
670
671 fn exec_internal(&mut self, sql: &str, options: Option<&QueryOptions>) -> Result<Vec<Results>> {
672 let options_snapshot = options.cloned();
673 let default_options = QueryOptions::default();
674 let exec_opts_ref = options.unwrap_or(&default_options);
675 let mut exec_opts = ExecProtocolOptions::no_sync();
676 exec_opts.on_notice = exec_opts_ref.on_notice.clone();
677 exec_opts.data_transfer_container = exec_opts_ref.data_transfer_container;
678
679 self.handle_blob_input(exec_opts_ref.blob.as_ref())?;
680
681 let mut collected_messages: Vec<BackendMessage> = Vec::new();
682
683 let message = Serialize::query(sql);
684 let ExecProtocolResult { messages, .. } = match self.exec_protocol(&message, exec_opts) {
685 Ok(result) => result,
686 Err(err) => match err.downcast::<DatabaseError>() {
687 Ok(db_err) => {
688 let enriched = PgliteError::new(db_err, sql, Vec::new(), options_snapshot);
689 return Err(enriched.into());
690 }
691 Err(err) => {
692 return Err(err.context(format!("failed to execute simple query: {sql}")));
693 }
694 },
695 };
696 collected_messages.extend(messages);
697
698 self.finish_exec(collected_messages, options)
699 }
700
701 /// Register a listener for `LISTEN channel`. Returns a handle that can be used to unlisten.
702 pub fn listen<F>(&mut self, channel: &str, callback: F) -> Result<ListenerHandle>

Callers 10

execMethod · 0.80
listenMethod · 0.80
unlistenMethod · 0.80
unlisten_channelMethod · 0.80
run_exec_commandMethod · 0.80
commit_internalMethod · 0.80
rollback_internalMethod · 0.80

Calls 3

handle_blob_inputMethod · 0.80
exec_protocolMethod · 0.80
finish_execMethod · 0.80

Tested by

no test coverage detected