pq\LOB docs
[mdref/mdref-pq] / pq / Connection / execParams.md
1 # pq\Result pq\Connection::execParams(string $query, array $params[, array $types = NULL])
2
3 [Execute an SQL query](pq/Connection: Executing Queries) with properly escaped parameters substituted.
4
5 ## Params:
6
7 * string $query
8 The query to execute.
9 * array $params
10 The parameter list to substitute.
11 * Optional array $types = NULL
12 Corresponding list of type OIDs for the parameters.
13
14 ## Returns:
15
16 * pq\Result
17
18 ## Throws:
19
20 * pq\Exception\InvalidArgumentException
21 * pq\Exception\RuntimeException
22 * pq\Exception\DomainException
23
24 ## Example:
25
26 <?php
27 $c = new pq\Connection;
28
29 $result = $c->execParams("SELECT int($1) * s, int($2) * s, int($3) * s
30 FROM generate_series(1,3) s", array(1,2,3));
31
32 ?>