- * @param \pq\Query\Writer $query
- * @param array $criteria
- * @param string $join
- */
- protected function criteria(QueryWriter $query, array $criteria, $join = "AND") {
- $joinable = false;
- $query->write("(");
- foreach ($criteria as $lop => $rop) {
- if (is_array($rop)) {
- if ($joinable) {
- $query->write(")", $join, "(");
- }
- $this->criteria($query, $rop, is_int($lop) ? "AND" : $lop);
- } else {
- if ($joinable) {
- $query->write(")", $join, "(");
- }
- if (!is_int($lop)) {
- $query->write($lop);
- }
- $query->write($query->param($rop));
- }
- $joinable or $joinable = true;
+ * Set the query writer
+ * @param \pq\Query\WriterInterface $query
+ * @return \pq\Gateway\Table
+ */
+ function setQueryWriter(\pq\Query\WriterInterface $query) {
+ $this->query = $query;
+ return $this;
+ }
+
+ /**
+ * Get the query writer
+ * @return \pq\Query\WriterInterface
+ */
+ function getQueryWriter() {
+ if (!$this->query) {
+ $this->query = new QueryWriter;
+ }
+ return $this->query;
+ }
+
+ /**
+ * Set the query executor
+ * @param \pq\Query\ExecutorInterface $exec
+ * @return \pq\Gateway\Table
+ */
+ function setQueryExecutor(\pq\Query\ExecutorInterface $exec) {
+ $this->exec = $exec;
+ return $this;
+ }
+
+ /**
+ * Get the query executor
+ * @return \pq\Query\ExecutorInterface
+ */
+ function getQueryExecutor() {
+ if (!$this->exec) {
+ $this->exec = new QueryExecutor($this->conn);