Example #1
0
 /**
  * Compile an Query.
  *
  * @param Query $query The query to compile.
  * @return [string $sql, array $values]
  */
 public function compile(Query $query)
 {
     $type = $query->getType();
     $sql = $this->compileComponents($query->getComponents(), $type);
     $val = $this->compileValues($query->getComponentValues(), $type);
     return array($sql, $val);
 }
Example #2
0
 /**
  * Add an exists condition to the query.
  *
  * @param Query $q The Select sub-query.
  * @return $this
  */
 public function whereExists(Query $query, $logic = 'AND', $not = false)
 {
     $type = 'Exists';
     $cond = compact('type', 'query', 'logic', 'not');
     $this->_addWhere($cond);
     $this->addValueToQuery($query->getComponentValues());
     return $this;
 }