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

Function skipWhitespaceAndComments

backend/plugin/db/starrocks/query.go:268–292  ·  view source on GitHub ↗
(sql string, pos int)

Source from the content-addressed store, hash-verified

266}
267
268func skipWhitespaceAndComments(sql string, pos int) int {
269 for pos < len(sql) {
270 for pos < len(sql) && (sql[pos] == ' ' || sql[pos] == '\t' || sql[pos] == '\n' || sql[pos] == '\r') {
271 pos++
272 }
273 if strings.HasPrefix(sql[pos:], "--") || strings.HasPrefix(sql[pos:], "#") {
274 nl := strings.IndexByte(sql[pos:], '\n')
275 if nl < 0 {
276 return len(sql)
277 }
278 pos += nl + 1
279 continue
280 }
281 if strings.HasPrefix(sql[pos:], "/*") {
282 end := strings.Index(sql[pos:], "*/")
283 if end < 0 {
284 return len(sql)
285 }
286 pos += end + 2
287 continue
288 }
289 return pos
290 }
291 return pos
292}

Callers 1

findCommaLimitCountFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected