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

Function EncodeSQLBytes

pkg/sql/lexbase/encode.go:216–220  ·  view source on GitHub ↗

EncodeSQLBytes encodes the SQL byte array in 'in' to buf, to a format suitable for re-scanning. We don't use a straightforward hex encoding here with x'...' because the result would be less compact. We are trading a little more time during the encoding to have a little less bytes on the wire.

(buf *bytes.Buffer, in string)

Source from the content-addressed store, hash-verified

214// compact. We are trading a little more time during the encoding to
215// have a little less bytes on the wire.
216func EncodeSQLBytes(buf *bytes.Buffer, in string) {
217 buf.WriteString("b'")
218 EncodeSQLBytesInner(buf, in)
219 buf.WriteByte('\'')
220}
221
222// EncodeSQLBytesInner is like EncodeSQLBytes but does not include the
223// outer quote delimiter and the 'b' prefix.

Callers 1

FormatMethod · 0.92

Calls 1

EncodeSQLBytesInnerFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…