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

Method query

nodedb-client/src/native/client/core.rs:37–48  ·  view source on GitHub ↗

Execute a SQL query and return structured results. Retries once with a fresh connection on I/O failure.

(&self, sql: &str)

Source from the content-addressed store, hash-verified

35 ///
36 /// Retries once with a fresh connection on I/O failure.
37 pub async fn query(&self, sql: &str) -> NodeDbResult<QueryResult> {
38 let mut conn = self.pool.acquire().await?;
39 match conn.execute_sql(sql).await {
40 Ok(r) => Ok(r),
41 Err(e) if is_connection_error(&e) => {
42 drop(conn);
43 let mut conn = self.pool.acquire().await?;
44 conn.execute_sql(sql).await
45 }
46 Err(e) => Err(e),
47 }
48 }
49
50 /// Execute a DDL command.
51 pub async fn ddl(&self, sql: &str) -> NodeDbResult<QueryResult> {

Callers 3

query_rawMethod · 0.45
graph_stats_implMethod · 0.45
graph_pagerank_implMethod · 0.45

Calls 3

is_connection_errorFunction · 0.85
acquireMethod · 0.45
execute_sqlMethod · 0.45

Tested by

no test coverage detected