当前位置: 首页>>代码示例>>PHP>>正文


PHP ResultWrapper::rewind方法代码示例

本文整理汇总了PHP中ResultWrapper::rewind方法的典型用法代码示例。如果您正苦于以下问题:PHP ResultWrapper::rewind方法的具体用法?PHP ResultWrapper::rewind怎么用?PHP ResultWrapper::rewind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ResultWrapper的用法示例。


在下文中一共展示了ResultWrapper::rewind方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: reset

 /**
  * Start iteration. This must be called before current() or next().
  * @return Revision First list item
  */
 public function reset()
 {
     if (!$this->res) {
         $this->res = $this->doQuery(wfGetDB(DB_SLAVE));
     } else {
         $this->res->rewind();
     }
     $this->initCurrent();
     return $this->current;
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:14,代码来源:RevisionList.php

示例2: doQuery

	/**
	 * Do the query, using information from the object context. This function
	 * has been kept minimal to make it overridable if necessary, to allow for
	 * result sets formed from multiple DB queries.
	 */
	public function doQuery() {
		# Use the child class name for profiling
		$fname = __METHOD__ . ' (' . get_class( $this ) . ')';
		wfProfileIn( $fname );

		$descending = ( $this->mIsBackwards == $this->mDefaultDirection );
		# Plus an extra row so that we can tell the "next" link should be shown
		$queryLimit = $this->mLimit + 1;

		if ( $this->mOffset == '' ) {
			$isFirst = true;
		} else {
			// If there's an offset, we may or may not be at the first entry.
			// The only way to tell is to run the query in the opposite
			// direction see if we get a row.
			$oldIncludeOffset = $this->mIncludeOffset;
			$this->mIncludeOffset = !$this->mIncludeOffset;
			$isFirst = !$this->reallyDoQuery( $this->mOffset, 1, !$descending )->numRows();
			$this->mIncludeOffset = $oldIncludeOffset;
		}

		$this->mResult = $this->reallyDoQuery(
			$this->mOffset,
			$queryLimit,
			$descending
		);

		$this->extractResultInfo( $isFirst, $queryLimit, $this->mResult );
		$this->mQueryDone = true;

		$this->preprocessResults( $this->mResult );
		$this->mResult->rewind(); // Paranoia

		wfProfileOut( $fname );
	}
开发者ID:nahoj,项目名称:mediawiki_ynh,代码行数:40,代码来源:Pager.php

示例3: combineResult

 /**
  * Combine results from 2 tables.
  *
  * Note: This will throw away some results
  *
  * @param ResultWrapper $res1
  * @param ResultWrapper $res2
  * @param int $limit
  * @param bool $ascending See note about $asc in $this->reallyDoQuery
  * @return FakeResultWrapper $res1 and $res2 combined
  */
 protected function combineResult($res1, $res2, $limit, $ascending)
 {
     $res1->rewind();
     $res2->rewind();
     $topRes1 = $res1->next();
     $topRes2 = $res2->next();
     $resultArray = array();
     for ($i = 0; $i < $limit && $topRes1 && $topRes2; $i++) {
         if (strcmp($topRes1->{$this->mIndexField}, $topRes2->{$this->mIndexField}) > 0) {
             if (!$ascending) {
                 $resultArray[] = $topRes1;
                 $topRes1 = $res1->next();
             } else {
                 $resultArray[] = $topRes2;
                 $topRes2 = $res2->next();
             }
         } else {
             if (!$ascending) {
                 $resultArray[] = $topRes2;
                 $topRes2 = $res2->next();
             } else {
                 $resultArray[] = $topRes1;
                 $topRes1 = $res1->next();
             }
         }
     }
     // @codingStandardsIgnoreStart Squiz.WhiteSpace.SemicolonSpacing.Incorrect
     for (; $i < $limit && $topRes1; $i++) {
         // @codingStandardsIgnoreEnd
         $resultArray[] = $topRes1;
         $topRes1 = $res1->next();
     }
     // @codingStandardsIgnoreStart Squiz.WhiteSpace.SemicolonSpacing.Incorrect
     for (; $i < $limit && $topRes2; $i++) {
         // @codingStandardsIgnoreEnd
         $resultArray[] = $topRes2;
         $topRes2 = $res2->next();
     }
     return new FakeResultWrapper($resultArray);
 }
开发者ID:mb720,项目名称:mediawiki,代码行数:51,代码来源:SpecialListfiles.php

示例4: doQuery

 /**
  * Do the query, using information from the object context. This function
  * has been kept minimal to make it overridable if necessary, to allow for
  * result sets formed from multiple DB queries.
  */
 public function doQuery()
 {
     # Use the child class name for profiling
     $fname = __METHOD__ . ' (' . get_class($this) . ')';
     wfProfileIn($fname);
     $descending = $this->mIsBackwards == $this->mDefaultDirection;
     # Plus an extra row so that we can tell the "next" link should be shown
     $queryLimit = $this->mLimit + 1;
     $this->mResult = $this->reallyDoQuery($this->mOffset, $queryLimit, $descending);
     $this->extractResultInfo($this->mOffset, $queryLimit, $this->mResult);
     $this->mQueryDone = true;
     $this->preprocessResults($this->mResult);
     $this->mResult->rewind();
     // Paranoia
     wfProfileOut($fname);
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:21,代码来源:Pager.php

示例5: rewind

 function rewind()
 {
     $this->res->rewind();
     $this->key = 0;
     $this->setCurrent($this->res->current());
 }
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:6,代码来源:TitleArray.php


注:本文中的ResultWrapper::rewind方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。