當前位置: 首頁>>代碼示例>>PHP>>正文


PHP IDatabase::selectRow方法代碼示例

本文整理匯總了PHP中IDatabase::selectRow方法的典型用法代碼示例。如果您正苦於以下問題:PHP IDatabase::selectRow方法的具體用法?PHP IDatabase::selectRow怎麽用?PHP IDatabase::selectRow使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在IDatabase的用法示例。


在下文中一共展示了IDatabase::selectRow方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: updateIfNewerOn

 /**
  * If the given revision is newer than the currently set page_latest,
  * update the page record. Otherwise, do nothing.
  *
  * @deprecated since 1.24, use updateRevisionOn instead
  *
  * @param IDatabase $dbw
  * @param Revision $revision
  * @return bool
  */
 public function updateIfNewerOn($dbw, $revision)
 {
     $row = $dbw->selectRow(['revision', 'page'], ['rev_id', 'rev_timestamp', 'page_is_redirect'], ['page_id' => $this->getId(), 'page_latest=rev_id'], __METHOD__);
     if ($row) {
         if (wfTimestamp(TS_MW, $row->rev_timestamp) >= $revision->getTimestamp()) {
             return false;
         }
         $prev = $row->rev_id;
         $lastRevIsRedirect = (bool) $row->page_is_redirect;
     } else {
         // No or missing previous revision; mark the page as new
         $prev = 0;
         $lastRevIsRedirect = null;
     }
     $ret = $this->updateRevisionOn($dbw, $revision, $prev, $lastRevIsRedirect);
     return $ret;
 }
開發者ID:paladox,項目名稱:mediawiki,代碼行數:27,代碼來源:WikiPage.php

示例2: loadFieldsWithTimestamp

 /**
  * @param IDatabase $dbr
  * @param string $fname
  * @return array|bool
  */
 private function loadFieldsWithTimestamp($dbr, $fname)
 {
     $fieldMap = false;
     $row = $dbr->selectRow('image', $this->getLazyCacheFields('img_'), array('img_name' => $this->getName(), 'img_timestamp' => $this->getTimestamp()), $fname);
     if ($row) {
         $fieldMap = $this->unprefixRow($row, 'img_');
     } else {
         # File may have been uploaded over in the meantime; check the old versions
         $row = $dbr->selectRow('oldimage', $this->getLazyCacheFields('oi_'), array('oi_name' => $this->getName(), 'oi_timestamp' => $this->getTimestamp()), $fname);
         if ($row) {
             $fieldMap = $this->unprefixRow($row, 'oi_');
         }
     }
     return $fieldMap;
 }
開發者ID:paladox,項目名稱:2,代碼行數:20,代碼來源:LocalFile.php

示例3: doLoad

 /**
  * @param IDatabase $db
  * @return bool|stdClass
  */
 static function doLoad($db)
 {
     return $db->selectRow('site_stats', ['ss_row_id', 'ss_total_edits', 'ss_good_articles', 'ss_total_pages', 'ss_users', 'ss_active_users', 'ss_images'], [], __METHOD__);
 }
開發者ID:paladox,項目名稱:mediawiki,代碼行數:8,代碼來源:SiteStats.php

示例4: countByPageId

 /**
  * Get count of revisions per page...not very efficient
  *
  * @param IDatabase $db
  * @param int $id Page id
  * @return int
  */
 static function countByPageId($db, $id)
 {
     $row = $db->selectRow('revision', array('revCount' => 'COUNT(*)'), array('rev_page' => $id), __METHOD__);
     if ($row) {
         return $row->revCount;
     }
     return 0;
 }
開發者ID:OrBin,項目名稱:mediawiki,代碼行數:15,代碼來源:Revision.php

示例5: fetchPageRow

 private function fetchPageRow(IDatabase $db, LinkTarget $nt)
 {
     $fields = self::getSelectFields();
     if ($this->isCacheable($nt)) {
         $fields[] = 'page_touched';
     }
     return $db->selectRow('page', $fields, ['page_namespace' => $nt->getNamespace(), 'page_title' => $nt->getDBkey()], __METHOD__);
 }
開發者ID:paladox,項目名稱:mediawiki,代碼行數:8,代碼來源:LinkCache.php


注:本文中的IDatabase::selectRow方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。