X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=lib%2Fpq%2FQuery%2FWriterInterface.php;h=35b6c48357e4c31799bb7e0910ba9fdec7a71e35;hb=00a4de964e8c8cd5d667a535ce84a45bf57958f6;hp=32e133baaa905c1e85d8f21ded78f653f37308f4;hpb=89caabf7e3ebc62190fccba97e3bc11f7f32b58c;p=m6w6%2Fpq-gateway diff --git a/lib/pq/Query/WriterInterface.php b/lib/pq/Query/WriterInterface.php index 32e133b..35b6c48 100644 --- a/lib/pq/Query/WriterInterface.php +++ b/lib/pq/Query/WriterInterface.php @@ -2,14 +2,50 @@ namespace pq\Query; +/** + * A query writer which supports easily constructing queries for \pq\Connection::execParams() + * @codeCoverageIgnore + */ interface WriterInterface { + /** + * Returns the plain constructed query as string + * @return string + */ function __toString(); + + /** + * Returns a list of parameters as array + * @return array + */ function getParams(); + + /** + * Returns a list any types associated with the params + */ function getTypes(); + + /** + * Reset the state of the query writer + */ + function reset(); + + /** + * Write plain SQL to the query + * @param mixed $arg variable list of arguments, arrays will be imploded to a comm separated list + */ function write(/*...*/); + + /** + * Remember the parameter with any associated type and return $N to be written to the query string + * @param mixed $param a literal parameter, a \pq\Gateway\Table\Cell or a \pq\Query\Expr + * @param int $type the oid of the type of the param + */ function param($param, $type = null); + + /** + * An array of AND/OR criteria + * @param array $criteria + */ function criteria(array $criteria); - function reset(); - function exec(\pq\Connection $c); }