Skip to main content

Module prepare

Module prepare 

Source
Expand description

Prepared statement support using extended query protocol.

§Parameter Encoding

Use the [params!] macro for ergonomic parameter encoding:

let stmt = client.prepare("SELECT * FROM users WHERE id = $1 AND name = $2")?;
let rows = client.execute(&stmt, params![42_i32, "Alice"])?;

Structs§

OwnedPreparedStatement
A prepared statement that automatically closes itself when dropped.
PreparedStatement
A prepared statement.

Traits§

SqlParam
Trait for types that can be encoded as SQL prepared statement parameters.

Functions§

close_statement
Closes a prepared statement on the server.
execute_prepared
Executes a prepared statement with parameters, collecting all rows.
execute_prepared_no_result
Executes a prepared statement that doesn’t return rows.
execute_prepared_no_result_with_formats
Executes a prepared statement that doesn’t return rows, with a caller-chosen wire format per parameter.
prepare
Prepares a statement using the extended query protocol.
prepare_owned
Creates an owned prepared statement that automatically closes when dropped.