本文整理匯總了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;
}
示例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;
}
示例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__);
}
示例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;
}
示例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__);
}