Ejemplo n.º 1
0
 /**
  * 以迭代器形式返回符合条件的记录
  *
  * @param int    $pPage      页号,0为不分页
  * @param int    $pPageSize  每页多少条记录
  * @param mix    $pOrder     排序字段
  * @param int    $pSmartCode 是否模糊匹配
  * @param string $pColumns   需要提取的字段
  * @param string $pGroupBy   需要合并的字段
  *
  * @return iterator
  */
 function _list_as_iterator($pPage = 0, $pPageSize = 10, $pOrder = null, $pSmartCode = 1, $pColumns = '*', $pGroupBy = '')
 {
     if ($pPage != 0 && $pPageSize != 1) {
         $count = $this->_count($pSmartCode, $pColumns, $pGroupBy);
         //$this->mPagination = &new Pagination(1,1);
         $this->mPagination = new Pagination($pPage, $pPageSize, $count);
     }
     if (!($pPage > 0 && $pPageSize == 1) && empty($pOrder) && count($this->mTableHash['key']) > 0) {
         $pOrder = implode(",", $this->mTableHash['key']);
     }
     $this->_generateSql($pOrder, $pSmartCode, $pColumns, $pGroupBy);
     //$this->_updateTableStatus();
     if (KISS_Framework_Config::isCached()) {
         return $this->SqlCommand->ExecuteCacheArrayQuery($this->mLastSQLQuery, $pPage, $pPageSize, 'assoc', array($this->mTableHash['name']));
     } else {
         return $this->SqlCommand->ExecuteIteratorQuery($this->mLastSQLQuery, $pPage, $pPageSize, 'assoc');
     }
 }