buildBindBody constructs a Bind message body (without the 'B' type byte and length header): portal name, statement name, no format codes, one parameter with the given declared length and actual data, no result format codes.
(portal, stmt string, declaredLen int32, data []byte)
| 11 | // length header): portal name, statement name, no format codes, one parameter |
| 12 | // with the given declared length and actual data, no result format codes. |
| 13 | func buildBindBody(portal, stmt string, declaredLen int32, data []byte) []byte { |
| 14 | var buf bytes.Buffer |
| 15 | buf.WriteString(portal) |
| 16 | buf.WriteByte(0) |
| 17 | buf.WriteString(stmt) |
| 18 | buf.WriteByte(0) |
| 19 | _ = binary.Write(&buf, binary.BigEndian, int16(0)) // no param format codes |
| 20 | _ = binary.Write(&buf, binary.BigEndian, int16(1)) // one parameter |
| 21 | _ = binary.Write(&buf, binary.BigEndian, declaredLen) |
| 22 | buf.Write(data) |
| 23 | _ = binary.Write(&buf, binary.BigEndian, int16(0)) // no result format codes |
| 24 | return buf.Bytes() |
| 25 | } |
| 26 | |
| 27 | // bindMessageBody builds a Bind message body (without the type byte and |
| 28 | // length prefix) for portal/statement names with raw trailing fields. |
no test coverage detected