* Check if a SQL statement already has a TOP clause (SQL Server). * Strips comments and string literals first to avoid false positives.
(sql: string)
| 30 | * Strips comments and string literals first to avoid false positives. |
| 31 | */ |
| 32 | static hasTopClause(sql: string): boolean { |
| 33 | // Strip comments and strings to avoid matching TOP inside them |
| 34 | const cleanedSQL = stripCommentsAndStrings(sql); |
| 35 | // Simple regex to detect TOP clause - handles most common cases |
| 36 | const topRegex = /\bselect\s+top\s+\d+/i; |
| 37 | return topRegex.test(cleanedSQL); |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * Extract existing LIMIT value from SQL if present. |
nothing calls this directly
no test coverage detected