MCPcopy Index your code
hub / github.com/cube2222/octosql / EncodeSQL

Method EncodeSQL

parser/sqlparser/dependency/sqltypes/value.go:261–272  ·  view source on GitHub ↗

EncodeSQL encodes the value into an SQL statement. Can be binary.

(b BinWriter)

Source from the content-addressed store, hash-verified

259
260// EncodeSQL encodes the value into an SQL statement. Can be binary.
261func (v Value) EncodeSQL(b BinWriter) {
262 // ToNative panics if v is invalid.
263 _ = v.ToNative()
264 switch {
265 case v.typ == Null:
266 writebytes(nullstr, b)
267 case IsQuoted(v.typ):
268 encodeBytesSQL(v.val, b)
269 default:
270 writebytes(v.val, b)
271 }
272}
273
274// EncodeASCII encodes the value using 7-bit clean ascii bytes.
275func (v Value) EncodeASCII(b BinWriter) {

Callers 3

FormatMethod · 0.80
TestPanicsFunction · 0.80
TestEncodeFunction · 0.80

Calls 4

ToNativeMethod · 0.95
writebytesFunction · 0.85
IsQuotedFunction · 0.85
encodeBytesSQLFunction · 0.85

Tested by 2

TestPanicsFunction · 0.64
TestEncodeFunction · 0.64