MCPcopy Create free account
hub / github.com/auxten/postgresql-parser / pgwireFormatStringInTuple

Function pgwireFormatStringInTuple

pkg/sql/sem/tree/pgwire_encode.go:59–77  ·  view source on GitHub ↗
(buf *bytes.Buffer, in string)

Source from the content-addressed store, hash-verified

57}
58
59func pgwireFormatStringInTuple(buf *bytes.Buffer, in string) {
60 quote := pgwireQuoteStringInTuple(in)
61 if quote {
62 buf.WriteByte('"')
63 }
64 // Loop through each unicode code point.
65 for _, r := range in {
66 if r == '"' || r == '\\' {
67 // Strings in tuples double " and \.
68 buf.WriteByte(byte(r))
69 buf.WriteByte(byte(r))
70 } else {
71 buf.WriteRune(r)
72 }
73 }
74 if quote {
75 buf.WriteByte('"')
76 }
77}
78
79func (d *DArray) pgwireFormat(ctx *FmtCtx) {
80 // 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

Used in the wild real call sites across dependent graphs

searching dependent graphs…