MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / parse_delete

Function parse_delete

crates/sql-parser/src/parser/sql.rs:280–303  ·  view source on GitHub ↗

Parse a DELETE statement

(mut from: Vec<TableWithJoins>, selection: Option<Expr>)

Source from the content-addressed store, hash-verified

278
279/// Parse a DELETE statement
280fn parse_delete(mut from: Vec<TableWithJoins>, selection: Option<Expr>) -> SqlParseResult<SqlDelete> {
281 if from.len() == 1 {
282 match from.swap_remove(0) {
283 TableWithJoins {
284 relation:
285 TableFactor::Table {
286 name,
287 alias: None,
288 args: None,
289 with_hints,
290 version: None,
291 partitions,
292 },
293 joins,
294 } if joins.is_empty() && with_hints.is_empty() && partitions.is_empty() => Ok(SqlDelete {
295 table: parse_ident(name)?,
296 filter: parse_expr_opt(selection)?,
297 }),
298 t => Err(SqlUnsupported::DeleteTable(t).into()),
299 }
300 } else {
301 Err(SqlUnsupported::MultiTableDelete.into())
302 }
303}
304
305/// Parse a SET variable statement
306fn parse_set_var(variable: ObjectName, mut value: Vec<Expr>) -> SqlParseResult<SqlSet> {

Callers 1

parse_statementFunction · 0.85

Calls 7

parse_identFunction · 0.85
parse_expr_optFunction · 0.85
OkFunction · 0.50
ErrFunction · 0.50
DeleteTableInterface · 0.50
lenMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…