sql_string!() { /* proc-macro */ }Expand description
Compile-time SQL validation macro.
Validates SQL syntax at compile time and emits the validated SQL string.
§Syntax
sql_string!("SQL")— validates the SQL and emits it as a&strsql_string!("SQL"; params: N)— additionally checks that the SQL has exactly N parameters
§Validation rules
- SELECT must contain FROM
- INSERT must contain INTO and VALUES
- UPDATE must contain SET
- DELETE must contain FROM
- Parentheses must be balanced
- String literals must be properly closed
- No SQL injection patterns (OR ‘1’=‘1’, UNION SELECT,
'; DROP TABLE,--,/*) - Table/column identifiers must be valid