* MySQL/MariaDB-specific multi-line comment scanner that preserves conditional comments. * MySQL conditional comments (`/*!nnnnn ... *\/`) and MariaDB-specific comments * (`/*M! ... *\/`) are executable. Stripping them would let malicious SQL bypass * read-only checks, so we return null to let th
(sql: string, i: number)
| 57 | * read-only checks, so we return null to let them pass through as plain text. |
| 58 | */ |
| 59 | function scanMultiLineCommentMySQL(sql: string, i: number): SQLToken | null { |
| 60 | if (sql[i] !== "/" || sql[i + 1] !== "*") { return null; } |
| 61 | const next = sql[i + 2]; |
| 62 | const nextNext = sql[i + 3]; |
| 63 | if (next === "!" || (next === "M" && nextNext === "!")) { return null; } |
| 64 | return scanMultiLineComment(sql, i); |
| 65 | } |
| 66 | |
| 67 | function scanNestedMultiLineComment(sql: string, i: number): SQLToken | null { |
| 68 | if (sql[i] !== "/" || sql[i + 1] !== "*") { return null; } |
no test coverage detected