Skip to main content

Crate sz_orm_sql_validator

Crate sz_orm_sql_validator 

Source
Expand description

SQL Validator - compile-time and runtime SQL validation

Provides validation of SQL statements for syntax correctness, parameter count matching, and structural integrity.

Modules§

firewall
SQL 防火墙:运行时拦截危险 SQL
sql_rules
SQL 规则引擎:可组合的规则集合、规则匹配与违规报告

Structs§

DdlPolicy
DDL operation policy that controls allowed DDL operation types.
SqlComplexityScore
SQL complexity score result.
WhitelistValidator
Whitelist validator that restricts SQL to only access allowed tables and columns.

Enums§

ComplexityLevel
SQL complexity level.
SqlStatementType
SQL statement type detected by the parser
SqlToken
SQL token type (for simplified AST analysis).
SqlValidationError
SQL validation errors

Functions§

detect_injection_ast
Deep injection detection based on AST (token sequence).
detect_statement_type
Detect the type of SQL statement
score_complexity
Calculate the complexity score of a SQL statement.
tokenize
Simple SQL lexer that splits a SQL string into a token sequence.
validate
Entry-level validation that runs all checks
validate_column_name
Validate column name is a valid SQL identifier
validate_delete
Validate a SQL DELETE statement
validate_insert
Validate a SQL INSERT statement
validate_parameter_count
Validate parameter count in prepared statements
validate_select
Validate a SQL SELECT statement
validate_sql
Validate any SQL statement by detecting its type and applying appropriate rules
validate_table_name
Validate table name is a valid SQL identifier
validate_update
Validate a SQL UPDATE statement

Type Aliases§

ValidationResult
Result type for SQL validation