MCPcopy Create free account
hub / github.com/dolthub/doltgresql / pgwireFormatStringInTuple

Function pgwireFormatStringInTuple

postgres/parser/sem/tree/pgwire_encode.go:73–91  ·  view source on GitHub ↗
(buf *bytes.Buffer, in string)

Source from the content-addressed store, hash-verified

71}
72
73func pgwireFormatStringInTuple(buf *bytes.Buffer, in string) {
74 quote := pgwireQuoteStringInTuple(in)
75 if quote {
76 buf.WriteByte('"')
77 }
78 // Loop through each unicode code point.
79 for _, r := range in {
80 if r == '"' || r == '\\' {
81 // Strings in tuples double " and \.
82 buf.WriteByte(byte(r))
83 buf.WriteByte(byte(r))
84 } else {
85 buf.WriteRune(r)
86 }
87 }
88 if quote {
89 buf.WriteByte('"')
90 }
91}
92
93func (d *DArray) pgwireFormat(ctx *FmtCtx) {
94 // When converting an array to text in "postgres mode" there is

Callers 1

pgwireFormatMethod · 0.85

Calls 1

pgwireQuoteStringInTupleFunction · 0.85

Tested by

no test coverage detected