MCPcopy Index your code
hub / github.com/bytebase/dbhub / hasParameterizedLimit

Method hasParameterizedLimit

src/utils/sql-row-limiter.ts:109–115  ·  view source on GitHub ↗

* Check if a LIMIT clause uses a parameter placeholder (not a literal number). * Strips comments and string literals first to avoid false positives.

(sql: string)

Source from the content-addressed store, hash-verified

107 * Strips comments and string literals first to avoid false positives.
108 */
109 static hasParameterizedLimit(sql: string): boolean {
110 // Strip comments and strings to avoid matching LIMIT inside them
111 const cleanedSQL = stripCommentsAndStrings(sql);
112 // Check for parameterized LIMIT (excluding literal numbers)
113 const parameterizedLimitRegex = /\blimit\s+(?:\$\d+|\?|@p\d+)/i;
114 return parameterizedLimitRegex.test(cleanedSQL);
115 }
116
117 /**
118 * Apply maxRows limit to a SELECT query only

Callers 1

applyMaxRowsMethod · 0.95

Calls 1

stripCommentsAndStringsFunction · 0.85

Tested by

no test coverage detected