Beispiel #1
0
 /**
  * 一次取出一行
  *
  * @param mixed $query 查询对象
  * @param array $filter 行过滤器函数,将查询的每一行作为第一个参数传入指定的过滤器中
  * @return stdClass
  */
 public function fetchRow($query, array $filter = NULL)
 {
     $resource = $this->query($query, self::READ);
     /** 取出过滤器 */
     if ($filter) {
         list($object, $method) = $filter;
     }
     return ($rows = $this->_adapter->fetch($resource)) ? $filter ? $object->{$method}($rows) : $rows : array();
 }