當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。