--- /dev/null
+# namespace pq\Query
+
+The pq\Query namespace holds implementations and interfaces related to assembling, expressing and executing queries on behalf of the gateway.
--- /dev/null
+# class pq\Query\Writer implements pq\Query\WriterInterface
+
+A query writer implementation.
+
+## Properties:
+
+* protected string $query
+ The assembled query.
+* protected array $params
+ The query parameters.
+* protected array $types
+ The query parameters' types.
+
--- /dev/null
+# string pq\Query\Writer::__toString()
+
+Retrieve the assembled query.
+
+## Params:
+
+None.
+
+## Returns:
+
+* string, the plainy query string.
--- /dev/null
+# pq\Query\Writer pq\Query\Writer::criteria(array $criteria)
+
+Write nested AND/OR criteria to the query string.
+
+## Params:
+
+* array $criteria
+ Nested AND/OR criteria.
+
+## Returns:
+
+* pq\Query\Writer, self.
+
+## Example:
+
+ <?php
+
+ use pq\Query;
+
+ $q = new Query\Writer;
+ $q->write("select * from account where")
+ ->criteria([
+ ["id >" => 1, "id <" => 5],
+ ["name =" => "mike"]
+ ]);
+
+ var_dump((string) $q, $q->getParams());
+
+ ?>
+
+Yields:
+
+ string(84) "select * from account where ( ( ( id > $1 ) AND ( id < $2 ) ) OR ( ( name = $3 ) ) )"
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(5)
+ [2]=>
+ string(4) "mike"
+ }
--- /dev/null
+# array pq\Query\Writer::getParams()
+
+Retrieve the query parameters.
+
+## Params:
+
+None.
+
+## Returns:
+
+* array, list of query parameters.
--- /dev/null
+# array pq\Query\Writer::getTypes()
+
+Get the query parameters' types.
+
+## Params:
+
+None.
+
+## Returns:
+
+* array, list of type OIDs.
--- /dev/null
+# string pq\Query\Writer::param(mixed $param[, int $type = NULL])
+
+Remember the parameter with any associated type and return $N to be written to the query string.
+
+## Params:
+
+* mixed $param
+ Query parameter value.
+* Optional int $type = NULL
+ The type OID of the parameter.
+
+## Returns:
+
+* string, '$N', to be used with pq\Query\Writer::write(), where N is tne number of this parameter.
+
+## Example:
+
+ <?php
+
+ use pq\Query;
+
+ $writer = new Query\Writer;
+ $writer->write("SELECT", $writer->param(1));
+
+ var_dump((string) $writer, $writer->getParams());
+
+ ?>
+
+Yields:
+
+ string(9) "SELECT $1"
+ array(1) {
+ [0]=>
+ int(1)
+ }
--- /dev/null
+# pq\Query\Writer pq\Query\Writer::reset()
+
+Reset the query writer to initial state.
+
+## Params:
+
+None.
+
+## Returns:
+
+* pq\Query\Writer, self.
--- /dev/null
+# pq\Query\Writer pq\Query\Writer::write()
+
+Write a part of the query string.
+
+## Params:
+
+* Variable list of query parts.
+
+## Returns:
+
+* pq\Query\Writer, self.
--- /dev/null
+# interface pq\Query\WriterInterface
+
+API for assembling unnamed statements with safe parameter substitution.
+See pq\Gateway\Table::setQueryWriter().
--- /dev/null
+# string pq\Query\WriterInterface::__toString()
+
+Retrieve the assembled query.
+
+## Params:
+
+None.
+
+## Returns:
+
+* string, the plainy query string.
--- /dev/null
+# pq\Query\WriterInterface pq\Query\WriterInterface::criteria(array $criteria)
+
+Write nested AND/OR criteria to the query string.
+
+## Params:
+
+* array $criteria
+ Nested AND/OR criteria.
+
+## Returns:
+
+* pq\Query\WriterInterface, self.
+
+## Example:
+
+ <?php
+
+ use pq\Query;
+
+ $q = new Query\Writer;
+ $q->write("select * from account where")
+ ->criteria([
+ ["id >" => 1, "id <" => 5],
+ ["name =" => "mike"]
+ ]);
+
+ var_dump((string) $q, $q->getParams());
+
+ ?>
+
+Yields:
+
+ string(84) "select * from account where ( ( ( id > $1 ) AND ( id < $2 ) ) OR ( ( name = $3 ) ) )"
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(5)
+ [2]=>
+ string(4) "mike"
+ }
--- /dev/null
+# array pq\Query\WriterInterface::getParams()
+
+Retrieve the query parameters.
+
+## Params:
+
+None.
+
+## Returns:
+
+* array, list of query parameters.
--- /dev/null
+# array pq\Query\WriterInterface::getTypes()
+
+Get the query parameters' types.
+
+## Params:
+
+None.
+
+## Returns:
+
+* array, list of type OIDs.
--- /dev/null
+# string pq\Query\WriterInterface::param(mixed $param[, int $type = NULL])
+
+Remember the parameter with any associated type and return $N to be written to the query string.
+
+## Params:
+
+* mixed $param
+ Query parameter value.
+* Optional int $type = NULL
+ The type OID of the parameter.
+
+## Returns:
+
+* string, '$N', to be used with pq\Query\WriterInterface::write(), where N is tne number of this parameter.
+
+## Example:
+
+ <?php
+
+ use pq\Query;
+
+ $writer = new Query\Writer;
+ $writer->write("SELECT", $writer->param(1));
+
+ var_dump((string) $writer, $writer->getParams());
+
+ ?>
+
+Yields:
+
+ string(9) "SELECT $1"
+ array(1) {
+ [0]=>
+ int(1)
+ }
--- /dev/null
+# pq\Query\WriterInterface pq\Query\WriterInterface::reset()
+
+Reset the query writer to initial state.
+
+## Params:
+
+None.
+
+## Returns:
+
+* pq\Query\WriterInterface, self.
--- /dev/null
+# pq\Query\WriterInterface pq\Query\WriterInterface::write()
+
+Write a part of the query string.
+
+## Params:
+
+* Variable list of query parts.
+
+## Returns:
+
+* pq\Query\WriterInterface, self.