MCPcopy Create free account
hub / github.com/cockroachdb/cockroachdb-parser / EncodeRestrictedSQLIdent

Function EncodeRestrictedSQLIdent

pkg/sql/lexbase/encode.go:70–76  ·  view source on GitHub ↗

EncodeRestrictedSQLIdent writes the identifier in s to buf. The identifier is quoted if either the flags ask for it, the identifier contains special characters, or the identifier is a reserved SQL keyword.

(buf *bytes.Buffer, s string, flags EncodeFlags)

Source from the content-addressed store, hash-verified

68// contains special characters, or the identifier is a reserved SQL
69// keyword.
70func EncodeRestrictedSQLIdent(buf *bytes.Buffer, s string, flags EncodeFlags) {
71 if !flags.HasFlags(EncAlwaysQuoted) && (flags.HasFlags(EncBareIdentifiers) || (!isReservedKeyword(s) && IsBareIdentifier(s))) {
72 buf.WriteString(s)
73 return
74 }
75 EncodeEscapedSQLIdent(buf, s)
76}
77
78// EncodeUnrestrictedSQLIdent writes the identifier in s to buf.
79// The identifier is only quoted if the flags don't tell otherwise and

Callers 3

SQLIdentifierMethod · 0.92
FormatMethod · 0.92
FormatMethod · 0.92

Calls 4

isReservedKeywordFunction · 0.85
IsBareIdentifierFunction · 0.85
EncodeEscapedSQLIdentFunction · 0.85
HasFlagsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…