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

Function plan_delete_array

nodedb-sql/src/planner/array_dml.rs:38–59  ·  view source on GitHub ↗
(ast: &DeleteArrayAst, catalog: &dyn SqlCatalog)

Source from the content-addressed store, hash-verified

36}
37
38pub fn plan_delete_array(ast: &DeleteArrayAst, catalog: &dyn SqlCatalog) -> Result<Vec<SqlPlan>> {
39 let view = catalog
40 .lookup_array(&ast.name)
41 .ok_or_else(|| SqlError::Parse {
42 detail: format!("DELETE FROM ARRAY {}: array not found", ast.name),
43 })?;
44 if ast.coords.is_empty() {
45 return Err(SqlError::Parse {
46 detail: format!(
47 "DELETE FROM ARRAY {}: at least one coord tuple required",
48 ast.name
49 ),
50 });
51 }
52 for (ri, row) in ast.coords.iter().enumerate() {
53 validate_coords(&ast.name, ri, row, &view)?;
54 }
55 Ok(vec![SqlPlan::DeleteArray {
56 name: ast.name.clone(),
57 coords: ast.coords.clone(),
58 }])
59}
60
61fn validate_coords(
62 array: &str,

Callers 2

plan_array_statementFunction · 0.85
delete_happyFunction · 0.85

Calls 4

validate_coordsFunction · 0.85
lookup_arrayMethod · 0.45
is_emptyMethod · 0.45
iterMethod · 0.45

Tested by 1

delete_happyFunction · 0.68