MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / query_text

Method query_text

nodedb-test-support/src/pgwire_harness/query.rs:11–25  ·  view source on GitHub ↗

Execute a SQL statement, returning the text of each row's first column.

(&self, sql: &str)

Source from the content-addressed store, hash-verified

9impl TestServer {
10 /// Execute a SQL statement, returning the text of each row's first column.
11 pub async fn query_text(&self, sql: &str) -> Result<Vec<String>, String> {
12 let client = self.client.as_ref();
13 match client.simple_query(sql).await {
14 Ok(msgs) => {
15 let mut rows = Vec::new();
16 for msg in msgs {
17 if let tokio_postgres::SimpleQueryMessage::Row(row) = msg {
18 rows.push(row.get(0).unwrap_or("").to_string());
19 }
20 }
21 Ok(rows)
22 }
23 Err(e) => Err(pg_error_detail(&e)),
24 }
25 }
26
27 /// Execute a SQL statement, returning each row's columns joined by tab.
28 ///

Calls 5

to_stringMethod · 0.80
pg_error_detailFunction · 0.70
as_refMethod · 0.45
pushMethod · 0.45
getMethod · 0.45