/** * where in 子查询语句 * * @param string $col * @param array|Select $relation * @param boolean $in * @return $this */ protected function whereSub($col, $relation, $in) { $col = $this->adapter->quoteIdentifier($col); $params = array(); if ($relation instanceof Select) { list($sql, $params) = $relation->compile(); $sub = $sql; } else { $sub = implode(',', $this->adapter->quote($relation)); } $where = $in ? sprintf('%s IN (%s)', $col, $sub) : sprintf('%s NOT IN (%s)', $col, $sub); $this->where[] = array($where, $params); return $this; }
public function __construct(Select $select) { $this->sth = $select->execute(); $this->row_count = $this->sth->rowCount(); $this->select = $select; }
public function get($limit = null) { $result = array(); foreach (parent::get($limit) as $data) { $result[$data->id()] = $data; } return $result; }