finished!
[mdref/mdref-pq] / pq / Cancel / cancel.md
1 # void pq\Cancel::cancel()
2
3 Perform the cancellation request.
4
5 ## Params:
6
7 None.
8
9 ## Throws:
10
11 * pq\Exception\InvalidArgumentException
12 * pq\Exception\BadMethodCallException
13 * pq\Exception\RuntimeException
14
15
16 ## Example:
17
18 <?php
19
20 $conn = new pq\Connection;
21 $cancel = new pq\Cancel($conn);
22
23 $conn->execAsync("SELECT pg_sleep(1)");
24 $cancel->cancel();
25
26 var_dump($conn->getResult());
27
28 ?>
29
30 Yields:
31
32 object(pq\Result)#4 (8) {
33 ["status"]=>
34 int(7)
35 ["statusMessage"]=>
36 string(11) "FATAL_ERROR"
37 ["errorMessage"]=>
38 string(47) "ERROR: canceling statement due to user request"
39 ["numRows"]=>
40 int(0)
41 ["numCols"]=>
42 int(0)
43 ["affectedRows"]=>
44 int(0)
45 ["fetchType"]=>
46 int(0)
47 ["autoConvert"]=>
48 int(65535)
49 }