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


PHP DatabaseBase::buildConcat方法代码示例

本文整理汇总了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;
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:37,代码来源:namespaceDupesWT.php

示例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__));
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:18,代码来源:namespaceDupes.php


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