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

Function is_side_effect_sql

nodedb/src/control/planner/procedural/validate.rs:32–53  ·  view source on GitHub ↗

Returns true if the SQL string begins with a side-effecting keyword that is not permitted inside a function body.

(sql: &str)

Source from the content-addressed store, hash-verified

30/// Returns true if the SQL string begins with a side-effecting keyword that is
31/// not permitted inside a function body.
32fn is_side_effect_sql(sql: &str) -> bool {
33 let upper = sql.trim().to_uppercase();
34 let first_word = upper.split_ascii_whitespace().next().unwrap_or("");
35 matches!(
36 first_word,
37 "INSERT"
38 | "UPDATE"
39 | "DELETE"
40 | "PUBLISH"
41 | "CREATE"
42 | "DROP"
43 | "ALTER"
44 | "TRUNCATE"
45 | "GRANT"
46 | "REVOKE"
47 | "COMMIT"
48 | "ROLLBACK"
49 | "SAVEPOINT"
50 | "RELEASE"
51 | "COPY"
52 )
53}
54
55fn validate_statement(stmt: &Statement, loop_depth: usize) -> Result<(), ProceduralError> {
56 match stmt {

Callers 1

validate_statementFunction · 0.85

Calls 1

nextMethod · 0.45

Tested by

no test coverage detected