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


PHP ResultWrapper::fetchObject方法代码示例

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


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

示例1: materializeList

 /**
  * @param ResultWrapper $queryResult
  * @return GWTUser[]
  */
 private function materializeList($queryResult)
 {
     $list = array();
     while ($obj = $queryResult->fetchObject()) {
         $list[] = $this->materialize($obj);
     }
     return $list;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:12,代码来源:GWTUserRepository.php

示例2: loadFromRows

 protected function loadFromRows(ResultWrapper $res)
 {
     $ret = array();
     while ($row = $res->fetchObject()) {
         unset($grp);
         unset($ver);
         // experiment
         $e_id = $row->e_id;
         if (!isset($ret[$e_id])) {
             $ret[$e_id] = array('id' => $row->e_id, 'name' => $row->e_name, 'description' => $row->e_description, 'versions' => array(), 'groups' => array());
         }
         $exp =& $ret[$e_id];
         // group
         $g_id = $row->g_id;
         if ($g_id && !isset($exp['groups'][$g_id])) {
             $exp['groups'][$g_id] = array('experiment_id' => $e_id, 'id' => $row->g_id, 'name' => $row->g_name, 'description' => $row->g_description);
         }
         if ($g_id) {
             $grp =& $exp['groups'][$g_id];
         }
         // version
         $v_id = $row->v_id;
         if ($v_id && !isset($exp['versions'][$v_id])) {
             $exp['versions'][$v_id] = array('experiment_id' => $e_id, 'id' => $row->v_id, 'start_time' => $row->v_start_time, 'end_time' => $row->v_end_time, 'ga_slot' => $row->v_ga_slot, 'control_group_id' => $row->v_control_group_id, 'group_ranges' => array());
         }
         if ($v_id) {
             $ver =& $exp['versions'][$v_id];
         }
         // group ranges
         if ($g_id && $v_id && $row->r_group_id) {
             // row in group_ranges found
             if (!isset($ver['group_ranges'][$g_id])) {
                 $ver['group_ranges'][$g_id] = array('version_id' => $v_id, 'group_id' => $g_id, 'ranges' => $row->r_ranges);
             }
         }
     }
     return $ret;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:38,代码来源:AbTestingData.class.php

示例3: 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

示例4: getBody

	/**
	 * Get the formatted result list. Calls getStartBody(), formatRow() and
	 * getEndBody(), concatenates the results and returns them.
	 *
	 * @return String
	 */
	public function getBody() {
		if ( !$this->mQueryDone ) {
			$this->doQuery();
		}

		if ( $this->mResult->numRows() ) {
			# Do any special query batches before display
			$this->doBatchLookups();
		}

		# Don't use any extra rows returned by the query
		$numRows = min( $this->mResult->numRows(), $this->mLimit );

		$s = $this->getStartBody();
		if ( $numRows ) {
			if ( $this->mIsBackwards ) {
				for ( $i = $numRows - 1; $i >= 0; $i-- ) {
					$this->mResult->seek( $i );
					$row = $this->mResult->fetchObject();
					$s .= $this->formatRow( $row );
				}
			} else {
				$this->mResult->seek( 0 );
				for ( $i = 0; $i < $numRows; $i++ ) {
					$row = $this->mResult->fetchObject();
					$s .= $this->formatRow( $row );
				}
			}
		} else {
			$s .= $this->getEmptyBody();
		}
		$s .= $this->getEndBody();
		return $s;
	}
开发者ID:nahoj,项目名称:mediawiki_ynh,代码行数:40,代码来源:Pager.php

示例5: partitionResult

 /**
  * Partition a DB result with backlinks in it into batches
  * @param ResultWrapper $res Database result
  * @param int $batchSize
  * @param bool $isComplete Whether $res includes all the backlinks
  * @throws MWException
  * @return array
  */
 protected function partitionResult($res, $batchSize, $isComplete = true)
 {
     $batches = array();
     $numRows = $res->numRows();
     $numBatches = ceil($numRows / $batchSize);
     for ($i = 0; $i < $numBatches; $i++) {
         if ($i == 0 && $isComplete) {
             $start = false;
         } else {
             $rowNum = $i * $batchSize;
             $res->seek($rowNum);
             $row = $res->fetchObject();
             $start = (int) $row->page_id;
         }
         if ($i == $numBatches - 1 && $isComplete) {
             $end = false;
         } else {
             $rowNum = min($numRows - 1, ($i + 1) * $batchSize - 1);
             $res->seek($rowNum);
             $row = $res->fetchObject();
             $end = (int) $row->page_id;
         }
         # Sanity check order
         if ($start && $end && $start > $end) {
             throw new MWException(__METHOD__ . ': Internal error: query result out of order');
         }
         $batches[] = array($start, $end);
     }
     return array('numRows' => $numRows, 'batches' => $batches);
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:38,代码来源:BacklinkCache.php

示例6: outputResults

 /**
  * Format and output report results using the given information plus
  * OutputPage
  *
  * @param OutputPage $out OutputPage to print to
  * @param Skin $skin User skin to use
  * @param IDatabase $dbr Database (read) connection to use
  * @param ResultWrapper $res Result pointer
  * @param int $num Number of available result rows
  * @param int $offset Paging offset
  */
 protected function outputResults($out, $skin, $dbr, $res, $num, $offset)
 {
     global $wgContLang;
     if ($num > 0) {
         $html = array();
         if (!$this->listoutput) {
             $html[] = $this->openList($offset);
         }
         # $res might contain the whole 1,000 rows, so we read up to
         # $num [should update this to use a Pager]
         // @codingStandardsIgnoreStart Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed
         for ($i = 0; $i < $num && ($row = $res->fetchObject()); $i++) {
             // @codingStandardsIgnoreEnd
             $line = $this->formatResult($skin, $row);
             if ($line) {
                 $attr = isset($row->usepatrol) && $row->usepatrol && $row->patrolled == 0 ? ' class="not-patrolled"' : '';
                 $html[] = $this->listoutput ? $line : "<li{$attr}>{$line}</li>\n";
             }
         }
         # Flush the final result
         if ($this->tryLastResult()) {
             $row = null;
             $line = $this->formatResult($skin, $row);
             if ($line) {
                 $attr = isset($row->usepatrol) && $row->usepatrol && $row->patrolled == 0 ? ' class="not-patrolled"' : '';
                 $html[] = $this->listoutput ? $line : "<li{$attr}>{$line}</li>\n";
             }
         }
         if (!$this->listoutput) {
             $html[] = $this->closeList();
         }
         $html = $this->listoutput ? $wgContLang->listToText($html) : implode('', $html);
         $out->addHTML($html);
     }
 }
开发者ID:eliagbayani,项目名称:LiteratureEditor,代码行数:46,代码来源:QueryPage.php

示例7: outputStream

 /**
  * Runs through a query result set dumping page and revision records.
  * The result set should be sorted/grouped by page to avoid duplicate
  * page records in the output.
  *
  * The result set will be freed once complete. Should be safe for
  * streaming (non-buffered) queries, as long as it was made on a
  * separate database connection not managed by LoadBalancer; some
  * blob storage types will make queries to pull source data.
  *
  * @param ResultWrapper $resultset
  * @access private
  */
 function outputStream($resultset)
 {
     $last = null;
     while ($row = $resultset->fetchObject()) {
         if (is_null($last) || $last->page_namespace != $row->page_namespace || $last->page_title != $row->page_title) {
             if (isset($last)) {
                 $this->closePage($last);
             }
             $this->openPage($row);
             $last = $row;
         }
         $this->dumpRev($row);
     }
     if (isset($last)) {
         $this->closePage($last);
     }
     $resultset->free();
 }
开发者ID:BackupTheBerlios,项目名称:openzaurus-svn,代码行数:31,代码来源:SpecialExport.php

示例8: loadFromResult

 /**
  * Fill in member variables from a result wrapper
  */
 function loadFromResult(ResultWrapper $res, $killExpired = true)
 {
     $ret = false;
     if (0 != $res->numRows()) {
         # Get first block
         $row = $res->fetchObject();
         $this->initFromRow($row);
         if ($killExpired) {
             # If requested, delete expired rows
             do {
                 $killed = $this->deleteIfExpired();
                 if ($killed) {
                     $row = $res->fetchObject();
                     if ($row) {
                         $this->initFromRow($row);
                     }
                 }
             } while ($killed && $row);
             # If there were any left after the killing finished, return true
             if ($row) {
                 $ret = true;
             }
         } else {
             $ret = true;
         }
     }
     $res->free();
     return $ret;
 }
开发者ID:BackupTheBerlios,项目名称:shoutwiki-svn,代码行数:32,代码来源:Block.php

示例9: outputStream

 /**
  * Runs through a query result set dumping page and revision records.
  * The result set should be sorted/grouped by page to avoid duplicate
  * page records in the output.
  *
  * The result set will be freed once complete. Should be safe for
  * streaming (non-buffered) queries, as long as it was made on a
  * separate database connection not managed by LoadBalancer; some
  * blob storage types will make queries to pull source data.
  *
  * @param ResultWrapper $resultset
  * @access private
  */
 function outputStream($resultset)
 {
     $last = null;
     while ($row = $resultset->fetchObject()) {
         if (is_null($last) || $last->page_namespace != $row->page_namespace || $last->page_title != $row->page_title) {
             if (isset($last)) {
                 $output = $this->writer->closePage();
                 $this->sink->writeClosePage($output);
             }
             $output = $this->writer->openPage($row);
             $this->sink->writeOpenPage($row, $output);
             $last = $row;
         }
         $output = $this->writer->writeRevision($row, $this->parse);
         $this->sink->writeRevision($row, $output);
     }
     if (isset($last)) {
         $output = $this->author_list . $this->writer->closePage();
         $this->sink->writeClosePage($output);
     }
     $resultset->free();
 }
开发者ID:ErdemA,项目名称:wikihow,代码行数:35,代码来源:Export.php

示例10: tableFromResult

 private static function tableFromResult(ResultWrapper $res)
 {
     $articles = array();
     while ($row = $res->fetchObject($res)) {
         $articles[intval($row->page_id)] = array('page_id' => $row->page_id);
     }
     return $articles;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:8,代码来源:CategoryDataService.class.php


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