Skip to main content

bind

Function bind 

Source
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_len if any string length, parameter length, or the total encoded message length exceeds i32::MAX bytes.
  • Panics via msg_count if param_formats.len(), params.len(), or result_formats.len() exceeds u16::MAX (65 535).