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

Function copy_to_query_form

nodedb/tests/sql_copy_to.rs:155–171  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

153
154#[tokio::test]
155async fn copy_to_query_form() {
156 let srv = TestServer::start().await;
157
158 seed_collection(&srv, "copy_to_query").await;
159
160 let (_dir, out_path) = temp_output_path(".ndjson");
161 // Export only rows where id < 3.
162 srv.exec(&format!(
163 "COPY (SELECT * FROM copy_to_query WHERE id < 3) TO '{out_path}'"
164 ))
165 .await
166 .expect("COPY query-form TO NDJSON");
167
168 let content = std::fs::read_to_string(&out_path).expect("read output file");
169 let count = content.lines().filter(|l| !l.trim().is_empty()).count();
170 assert_eq!(count, 2, "expected 2 rows matching id < 3");
171}
172
173// ── test 6: path traversal rejection ────────────────────────────────────────
174

Callers

nothing calls this directly

Calls 6

seed_collectionFunction · 0.85
temp_output_pathFunction · 0.85
expectMethod · 0.45
execMethod · 0.45
countMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected