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_lenifname.len(),query.len(), or the encoded message length exceedsi32::MAXbytes. - Panics via
msg_countifparam_types.len()exceedsu16::MAX(65 535). PostgreSQL caps parameters per query at 1 600, so overflow is a programming error.