35b6c48357e4c31799bb7e0910ba9fdec7a71e35
[m6w6/pq-gateway] / lib / pq / Query / WriterInterface.php
1 <?php
2
3 namespace pq\Query;
4
5 /**
6 * A query writer which supports easily constructing queries for \pq\Connection::execParams()
7 * @codeCoverageIgnore
8 */
9 interface WriterInterface
10 {
11 /**
12 * Returns the plain constructed query as string
13 * @return string
14 */
15 function __toString();
16
17 /**
18 * Returns a list of parameters as array
19 * @return array
20 */
21 function getParams();
22
23 /**
24 * Returns a list any types associated with the params
25 */
26 function getTypes();
27
28 /**
29 * Reset the state of the query writer
30 */
31 function reset();
32
33 /**
34 * Write plain SQL to the query
35 * @param mixed $arg variable list of arguments, arrays will be imploded to a comm separated list
36 */
37 function write(/*...*/);
38
39 /**
40 * Remember the parameter with any associated type and return $N to be written to the query string
41 * @param mixed $param a literal parameter, a \pq\Gateway\Table\Cell or a \pq\Query\Expr
42 * @param int $type the oid of the type of the param
43 */
44 function param($param, $type = null);
45
46 /**
47 * An array of AND/OR criteria
48 * @param array $criteria
49 */
50 function criteria(array $criteria);
51 }