MCPcopy Create free account
hub / github.com/bytebase/bytebase / findCommaLimitCount

Function findCommaLimitCount

backend/plugin/db/starrocks/query.go:250–266  ·  view source on GitHub ↗
(sql string, limitLoc ast.Loc)

Source from the content-addressed store, hash-verified

248}
249
250func findCommaLimitCount(sql string, limitLoc ast.Loc) (countStart, countEnd int, found bool) {
251 pos := limitLoc.End
252 pos = skipWhitespaceAndComments(sql, pos)
253 if pos >= len(sql) || sql[pos] != ',' {
254 return 0, 0, false
255 }
256 pos++
257 pos = skipWhitespaceAndComments(sql, pos)
258 countStart = pos
259 for pos < len(sql) && sql[pos] >= '0' && sql[pos] <= '9' {
260 pos++
261 }
262 if pos == countStart {
263 return 0, 0, false
264 }
265 return countStart, pos, true
266}
267
268func skipWhitespaceAndComments(sql string, pos int) int {
269 for pos < len(sql) {

Callers 2

rewriteSelectLimitFunction · 0.85
rewriteSetOpLimitFunction · 0.85

Calls 1

Tested by

no test coverage detected