analyzeInsertStatement analyzes INSERT statements
(stmt *ast.InsertStatement)
| 188 | |
| 189 | // analyzeInsertStatement analyzes INSERT statements |
| 190 | func (a *SQLAnalyzer) analyzeInsertStatement(stmt *ast.InsertStatement) { |
| 191 | // Check for INSERT without explicit columns |
| 192 | if len(stmt.Columns) == 0 && len(stmt.Values) > 0 { |
| 193 | a.addSecurityIssue("INSERT_WITHOUT_COLUMNS", "MEDIUM", |
| 194 | "INSERT without explicit columns is brittle and error-prone", |
| 195 | "Always specify column names in INSERT statements") |
| 196 | } |
| 197 | |
| 198 | // Check for bulk operations without transaction |
| 199 | if len(stmt.Values) > 100 { |
| 200 | a.addPerformanceIssue("BULK_INSERT", "LOW", |
| 201 | "Large INSERT operations should use batch processing", |
| 202 | "performance", "Consider using batch INSERT or COPY operations") |
| 203 | } |
| 204 | } |
| 205 | |
| 206 | // analyzeUpdateStatement analyzes UPDATE statements |
| 207 | func (a *SQLAnalyzer) analyzeUpdateStatement(stmt *ast.UpdateStatement) { |
no test coverage detected