Function postgres::cancel_query
[−]
[src]
pub fn cancel_query<T>(params: T, tls: TlsMode, data: &CancelData) -> Result<()> where
T: IntoConnectParams,
Attempts to cancel an in-progress query.
The backend provides no information about whether a cancellation attempt was successful or not. An error will only be returned if the driver was unable to connect to the database.
A CancelData
object can be created via Connection::cancel_data
. The
object can cancel any query made on that connection.
Only the host and port of the connection info are used. See
Connection::connect
for details of the params
argument.
Example
let conn = Connection::connect(url, TlsMode::None).unwrap(); let cancel_data = conn.cancel_data(); thread::spawn(move || { conn.execute("SOME EXPENSIVE QUERY", &[]).unwrap(); }); postgres::cancel_query(url, TlsMode::None, &cancel_data).unwrap();