本文整理汇总了PHP中DatabaseBase::buildConcat方法的典型用法代码示例。如果您正苦于以下问题:PHP DatabaseBase::buildConcat方法的具体用法?PHP DatabaseBase::buildConcat怎么用?PHP DatabaseBase::buildConcat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DatabaseBase
的用法示例。
在下文中一共展示了DatabaseBase::buildConcat方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getConflicts
/**
* Find pages in mainspace that have a prefix of the new namespace
* so we know titles that will need migrating
* @param $ns int Namespace id (id for new namespace?)
* @param $name String Prefix that is being made a namespace
*/
private function getConflicts( $ns, $name ) {
$page = 'page';
$table = $this->db->tableName( $page );
$prefix = $this->db->strencode( $name );
$encNamespace = $this->db->addQuotes( $ns );
$titleSql = "TRIM(LEADING '$prefix:' FROM {$page}_title)";
if( $ns == 0 ) {
// An interwiki; try an alternate encoding with '-' for ':'
$titleSql = $this->db->buildConcat( array( "'$prefix-'", $titleSql ) );
}
$sql = "SELECT {$page}_id AS id,
{$page}_title AS oldtitle,
$encNamespace + {$page}_namespace AS namespace,
$titleSql AS title,
{$page}_namespace AS oldnamespace
FROM {$table}
WHERE ( {$page}_namespace=0 OR {$page}_namespace=1 )
AND {$page}_title " . $this->db->buildLike( $name . ':', $this->db->anyString() );
$result = $this->db->query( $sql, __METHOD__ );
$set = array();
foreach( $result as $row ) {
$set[] = $row;
}
return $set;
}
示例2: getConflicts
/**
* Find pages in mainspace that have a prefix of the new namespace
* so we know titles that will need migrating
*
* @param int $ns Namespace id (id for new namespace?)
* @param string $name Prefix that is being made a namespace
*
* @return array
*/
private function getConflicts($ns, $name)
{
$titleSql = "TRIM(LEADING {$this->db->addQuotes("{$name}:")} FROM page_title)";
if ($ns == 0) {
// An interwiki; try an alternate encoding with '-' for ':'
$titleSql = $this->db->buildConcat(array($this->db->addQuotes("{$name}-"), $titleSql));
}
return iterator_to_array($this->db->select('page', array('id' => 'page_id', 'oldtitle' => 'page_title', 'namespace' => $this->db->addQuotes($ns) . ' + page_namespace', 'title' => $titleSql, 'oldnamespace' => 'page_namespace'), array('page_namespace' => array(0, 1), 'page_title' . $this->db->buildLike("{$name}:", $this->db->anyString())), __METHOD__));
}