Returns true if the SQL string begins with a side-effecting keyword that is not permitted inside a function body.
(sql: &str)
| 30 | /// Returns true if the SQL string begins with a side-effecting keyword that is |
| 31 | /// not permitted inside a function body. |
| 32 | fn 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 | |
| 55 | fn validate_statement(stmt: &Statement, loop_depth: usize) -> Result<(), ProceduralError> { |
| 56 | match stmt { |
no test coverage detected