h1 -> h2 for Throws
[mdref/mdref-pq] / pq / Statement / prepare.md
1 # void pq\Statement::prepare()
2
3 Re-prepare a statement that has been deallocated. This is a no-op on already open statements.
4
5 ## Params:
6
7 None.
8
9 ## Throws:
10
11 * pq\Exception\InvalidArgumentException
12 * pq\Exception\BadMethodCallException
13 * pq\Exception\RuntimeException
14
15 ## Example:
16
17 <?php
18
19 $connection = new pq\Connection;
20 $types = new pq\Types($connection);
21 $statement = $connection->prepare("st1",
22 "SELECT \$1, \$2", [pq\Types::XML, pq\Types::JSON]);
23
24 // some code which executes the statement
25
26 $statement->deallocate();
27 $statement->prepare();
28
29 ?>
30