EncodeSQL encodes the value into an SQL statement. Can be binary.
(b BinWriter)
| 259 | |
| 260 | // EncodeSQL encodes the value into an SQL statement. Can be binary. |
| 261 | func (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. |
| 275 | func (v Value) EncodeASCII(b BinWriter) { |