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


PHP ResultWrapper::fetchRow方法代码示例

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


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

示例1: extractResultInfo

 /**
  * Extract some useful data from the result object for use by 
  * the navigation bar, put it into $this
  */
 function extractResultInfo($offset, $limit, ResultWrapper $res)
 {
     $numRows = $res->numRows();
     if ($numRows) {
         $row = $res->fetchRow();
         $firstIndex = $row[$this->mIndexField];
         # Discard the extra result row if there is one
         if ($numRows > $this->mLimit && $numRows > 1) {
             $res->seek($numRows - 1);
             $this->mPastTheEndRow = $res->fetchObject();
             $indexField = $this->mIndexField;
             $this->mPastTheEndIndex = $this->mPastTheEndRow->{$indexField};
             $res->seek($numRows - 2);
             $row = $res->fetchRow();
             $lastIndex = $row[$this->mIndexField];
         } else {
             $this->mPastTheEndRow = null;
             # Setting indexes to an empty string means that they will be
             # omitted if they would otherwise appear in URLs. It just so
             # happens that this  is the right thing to do in the standard
             # UI, in all the relevant cases.
             $this->mPastTheEndIndex = '';
             $res->seek($numRows - 1);
             $row = $res->fetchRow();
             $lastIndex = $row[$this->mIndexField];
         }
     } else {
         $firstIndex = '';
         $lastIndex = '';
         $this->mPastTheEndRow = null;
         $this->mPastTheEndIndex = '';
     }
     if ($this->mIsBackwards) {
         $this->mIsFirst = $numRows < $limit;
         $this->mIsLast = $offset == '';
         $this->mLastShown = $firstIndex;
         $this->mFirstShown = $lastIndex;
     } else {
         $this->mIsFirst = $offset == '';
         $this->mIsLast = $numRows < $limit;
         $this->mLastShown = $lastIndex;
         $this->mFirstShown = $firstIndex;
     }
 }
开发者ID:ErdemA,项目名称:wikihow,代码行数:48,代码来源:Pager.php

示例2: invalidateIDs

 /**
  * Invalidate a set of IDs, right now
  */
 function invalidateIDs(ResultWrapper $res)
 {
     global $wgUseFileCache, $wgUseSquid;
     if ($res->numRows() == 0) {
         return;
     }
     $dbw =& wfGetDB(DB_MASTER);
     $timestamp = $dbw->timestamp();
     $done = false;
     while (!$done) {
         # Get all IDs in this query into an array
         $ids = array();
         for ($i = 0; $i < $this->mRowsPerQuery; $i++) {
             $row = $res->fetchRow();
             if ($row) {
                 $ids[] = $row[0];
             } else {
                 $done = true;
                 break;
             }
         }
         if (!count($ids)) {
             break;
         }
         # Update page_touched
         $dbw->update('page', array('page_touched' => $timestamp), array('page_id IN (' . $dbw->makeList($ids) . ')'), __METHOD__);
         # Update squid
         if ($wgUseSquid || $wgUseFileCache) {
             $titles = Title::newFromIDs($ids);
             if ($wgUseSquid) {
                 $u = SquidUpdate::newFromTitles($titles);
                 $u->doUpdate();
             }
             # Update file cache
             if ($wgUseFileCache) {
                 foreach ($titles as $title) {
                     $cm = new CacheManager($title);
                     @unlink($cm->fileCacheName());
                 }
             }
         }
     }
 }
开发者ID:puring0815,项目名称:OpenKore,代码行数:46,代码来源:HTMLCacheUpdate.php

示例3: extractResultInfo

	/**
	 * Extract some useful data from the result object for use by
	 * the navigation bar, put it into $this
	 *
	 * @param $isFirst bool: False if there are rows before those fetched (i.e.
	 *     if a "previous" link would make sense)
	 * @param $limit Integer: exact query limit
	 * @param $res ResultWrapper
	 */
	function extractResultInfo( $isFirst, $limit, ResultWrapper $res ) {
		$numRows = $res->numRows();
		if ( $numRows ) {
			# Remove any table prefix from index field
			$parts = explode( '.', $this->mIndexField );
			$indexColumn = end( $parts );

			$row = $res->fetchRow();
			$firstIndex = $row[$indexColumn];

			# Discard the extra result row if there is one
			if ( $numRows > $this->mLimit && $numRows > 1 ) {
				$res->seek( $numRows - 1 );
				$this->mPastTheEndRow = $res->fetchObject();
				$this->mPastTheEndIndex = $this->mPastTheEndRow->$indexColumn;
				$res->seek( $numRows - 2 );
				$row = $res->fetchRow();
				$lastIndex = $row[$indexColumn];
			} else {
				$this->mPastTheEndRow = null;
				# Setting indexes to an empty string means that they will be
				# omitted if they would otherwise appear in URLs. It just so
				# happens that this  is the right thing to do in the standard
				# UI, in all the relevant cases.
				$this->mPastTheEndIndex = '';
				$res->seek( $numRows - 1 );
				$row = $res->fetchRow();
				$lastIndex = $row[$indexColumn];
			}
		} else {
			$firstIndex = '';
			$lastIndex = '';
			$this->mPastTheEndRow = null;
			$this->mPastTheEndIndex = '';
		}

		if ( $this->mIsBackwards ) {
			$this->mIsFirst = ( $numRows < $limit );
			$this->mIsLast = $isFirst;
			$this->mLastShown = $firstIndex;
			$this->mFirstShown = $lastIndex;
		} else {
			$this->mIsFirst = $isFirst;
			$this->mIsLast = ( $numRows < $limit );
			$this->mLastShown = $lastIndex;
			$this->mFirstShown = $firstIndex;
		}
	}
开发者ID:nahoj,项目名称:mediawiki_ynh,代码行数:57,代码来源:Pager.php

示例4: invalidateIDs

 /**
  * Invalidate a set of IDs, right now
  */
 public function invalidateIDs(ResultWrapper $res)
 {
     global $wgUseFileCache, $wgUseSquid;
     if ($res->numRows() == 0) {
         return;
     }
     // sanity check
     $dbw = wfGetDB(DB_MASTER);
     $timestamp = $dbw->timestamp();
     $done = false;
     while (!$done) {
         # Get all IDs in this query into an array
         $ids = array();
         for ($i = 0; $i < $this->mRowsPerQuery; $i++) {
             $row = $res->fetchRow();
             if ($row) {
                 $ids[] = $row[0];
             } else {
                 $done = true;
                 break;
             }
         }
         if (count($ids) == 0) {
             break;
         }
         # Update page_touched
         $dbw->update('page', array('page_touched' => $timestamp), array('page_id' => $ids), __METHOD__);
         # Update static caches
         if ($wgUseSquid || $wgUseFileCache) {
             $titles = Title::newFromIDs($ids);
             # Update squid cache
             if ($wgUseSquid) {
                 $u = SquidUpdate::newFromTitles($titles);
                 $u->doUpdate();
             }
             # Update file cache
             if ($wgUseFileCache) {
                 foreach ($titles as $title) {
                     HTMLFileCache::clearFileCache($title);
                 }
             }
         }
     }
 }
开发者ID:crippsy14,项目名称:orange-smorange,代码行数:47,代码来源:FRExtraCacheUpdate.php


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