本文整理汇总了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__);
}