885d4ca8db00a0003ec4f03597cee20e40a8658e
[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 */
8 interface WriterInterface
9 {
10 /**
11 * Returns the plain constructed query as string
12 * @return string
13 */
14 function __toString();
15
16 /**
17 * Returns a list of parameters as array
18 * @return array
19 */
20 function getParams();
21
22 /**
23 * Returns a list any types associated with the params
24 */
25 function getTypes();
26
27 /**
28 * Reset the state of the query writer
29 */
30 function reset();
31
32 /**
33 * Write plain SQL to the query
34 * @param mixed $arg variable list of arguments, arrays will be imploded to a comm separated list
35 */
36 function write(/*...*/);
37
38 /**
39 * Remember the parameter with any associated type and return $N to be written to the query string
40 * @param mixed $param a literal parameter, a \pq\Gateway\Table\Cell or a \pq\Query\Expr
41 * @param int $type the oid of the type of the param
42 */
43 function param($param, $type = null);
44
45 /**
46 * An array of AND/OR criteria
47 * @param array $criteria
48 */
49 function criteria(array $criteria);
50 }