Ejemplo n.º 1
0
Archivo: db.php Proyecto: lryl/Lysine2
 /**
  * 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;
 }
Ejemplo n.º 2
0
 public function __construct(Select $select)
 {
     $this->sth = $select->execute();
     $this->row_count = $this->sth->rowCount();
     $this->select = $select;
 }
Ejemplo n.º 3
0
 public function get($limit = null)
 {
     $result = array();
     foreach (parent::get($limit) as $data) {
         $result[$data->id()] = $data;
     }
     return $result;
 }