Skip to main content

parse

Function parse 

Source
pub fn parse(
    name: &str,
    query: &str,
    param_types: &[Oid],
    buf: &mut BytesMut,
) -> Result<()>
Expand description

Writes a parse message (prepare statement).

Prepares a SQL statement for later execution. The server responds with ParseComplete and may send ParameterDescription.

§Arguments

  • name - Statement name (null-terminated, empty string for unnamed)
  • query - SQL query string with parameter placeholders ($1, $2, etc.)
  • param_types - OIDs of parameter types (empty if types should be inferred)
  • 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 name.len(), query.len(), or the encoded message length exceeds i32::MAX bytes.
  • Panics via msg_count if param_types.len() exceeds u16::MAX (65 535). PostgreSQL caps parameters per query at 1 600, so overflow is a programming error.