pub fn bind(
portal: &str,
statement: &str,
param_formats: &[i16],
params: &[Option<&[u8]>],
result_formats: &[i16],
buf: &mut BytesMut,
) -> Result<()>Expand description
Writes a bind message.
Binds parameter values to a prepared statement, creating a portal.
The server responds with BindComplete.
§Arguments
portal- Portal name (null-terminated, empty string for unnamed)statement- Statement name (from Parse message)param_formats- Format codes for each parameter (0 = text, 1 = binary)params- Parameter values (None for NULL)result_formats- Format codes for result columns (0 = text, 1 = binary)buf- Buffer to write the message to
§Errors
Currently infallible — always returns Ok(()). The io::Result return
type is preserved for forward compatibility.
§Panics
- Panics via
msg_lenif any string length, parameter length, or the total encoded message length exceedsi32::MAXbytes. - Panics via
msg_countifparam_formats.len(),params.len(), orresult_formats.len()exceedsu16::MAX(65 535).