X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fpq-gateway;a=blobdiff_plain;f=lib%2Fpq%2FQuery%2FWriterInterface.php;h=885d4ca8db00a0003ec4f03597cee20e40a8658e;hp=32e133baaa905c1e85d8f21ded78f653f37308f4;hb=dc87da9c4ec52918e34f2e43eac3014f0f99a8bc;hpb=89caabf7e3ebc62190fccba97e3bc11f7f32b58c diff --git a/lib/pq/Query/WriterInterface.php b/lib/pq/Query/WriterInterface.php index 32e133b..885d4ca 100644 --- a/lib/pq/Query/WriterInterface.php +++ b/lib/pq/Query/WriterInterface.php @@ -2,14 +2,49 @@ namespace pq\Query; +/** + * A query writer which supports easily constructing queries for \pq\Connection::execParams() + */ 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); }