MCPcopy Create free account
hub / github.com/erans/pgsqlite / analyze_dml_statement

Method analyze_dml_statement

src/security/sql_injection_detector.rs:355–382  ·  view source on GitHub ↗
(
        &self,
        statement: &Statement,
        analysis: &mut SqlAnalysisResult,
        depth: usize,
        original_query: &str
    )

Source from the content-addressed store, hash-verified

353 }
354
355 fn analyze_dml_statement(
356 &self,
357 statement: &Statement,
358 analysis: &mut SqlAnalysisResult,
359 depth: usize,
360 original_query: &str
361 ) -> Result<(), PgSqliteError> {
362 // For INSERT, UPDATE, DELETE statements, analyze the WHERE clauses and subqueries
363 match statement {
364 Statement::Update { selection, .. } => {
365 if let Some(where_clause) = selection {
366 self.analyze_expression(where_clause, analysis, depth, original_query)?;
367 }
368 }
369 Statement::Delete(delete_stmt) => {
370 if let Some(where_clause) = &delete_stmt.selection {
371 self.analyze_expression(where_clause, analysis, depth, original_query)?;
372 }
373 }
374 Statement::Insert(insert_stmt) => {
375 if let Some(source) = &insert_stmt.source {
376 self.analyze_query_statement(source, analysis, depth, original_query)?;
377 }
378 }
379 _ => {}
380 }
381 Ok(())
382 }
383
384 fn is_tautology(&self, left: &Expr, op: &sqlparser::ast::BinaryOperator, right: &Expr) -> bool {
385 use sqlparser::ast::BinaryOperator;

Callers 1

analyze_statementMethod · 0.80

Calls 2

analyze_expressionMethod · 0.80

Tested by

no test coverage detected