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

Function EncodeUnrestrictedSQLIdent

pkg/sql/lexbase/encode.go:81–87  ·  view source on GitHub ↗

EncodeUnrestrictedSQLIdent writes the identifier in s to buf. The identifier is only quoted if the flags don't tell otherwise and the identifier contains special characters.

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

Source from the content-addressed store, hash-verified

79// The identifier is only quoted if the flags don't tell otherwise and
80// the identifier contains special characters.
81func EncodeUnrestrictedSQLIdent(buf *bytes.Buffer, s string, flags EncodeFlags) {
82 if !flags.HasFlags(EncAlwaysQuoted) && (flags.HasFlags(EncBareIdentifiers) || IsBareIdentifier(s)) {
83 buf.WriteString(s)
84 return
85 }
86 EncodeEscapedSQLIdent(buf, s)
87}
88
89// EscapeSQLIdent ensures that the potential identifier in s is fully
90// quoted, so that any special character it contains is not at risk

Callers 1

FormatMethod · 0.92

Calls 3

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…