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

Function stripQuotedIdentifiers

backend/plugin/parser/partiql/completion.go:487–517  ·  view source on GitHub ↗

stripQuotedIdentifiers replaces double-quoted identifiers with placeholder text so that keyword searches don't match content inside quotes (e.g., "order" should not be treated as the ORDER keyword).

(s string)

Source from the content-addressed store, hash-verified

485// placeholder text so that keyword searches don't match content inside
486// quotes (e.g., "order" should not be treated as the ORDER keyword).
487func stripQuotedIdentifiers(s string) string {
488 var b strings.Builder
489 b.Grow(len(s))
490 i := 0
491 for i < len(s) {
492 if s[i] == '"' {
493 // Replace the entire "..." with underscores to preserve length.
494 b.WriteByte('_')
495 i++ // skip opening "
496 for i < len(s) {
497 if s[i] == '"' {
498 i++
499 if i < len(s) && s[i] == '"' {
500 b.WriteByte('_')
501 b.WriteByte('_')
502 i++
503 continue
504 }
505 b.WriteByte('_')
506 break
507 }
508 b.WriteByte('_')
509 i++
510 }
511 } else {
512 b.WriteByte(s[i])
513 i++
514 }
515 }
516 return b.String()
517}

Callers 1

isColumnContextFunction · 0.85

Calls 1

StringMethod · 0.65

Tested by

no test coverage detected