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


PHP IDatabase::getType方法代碼示例

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


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

示例1: __construct

 /**
  * @param array $params An associative array with one member:
  *   - connection: An IDatabase connection object
  */
 public function __construct(array $params)
 {
     if (!isset($params['connection'])) {
         throw new InvalidArgumentException("Missing 'connection' argument.");
     }
     $this->db = $params['connection'];
     parent::__construct(['servers' => [['type' => $this->db->getType(), 'host' => $this->db->getServer(), 'dbname' => $this->db->getDBname(), 'load' => 1]], 'trxProfiler' => isset($params['trxProfiler']) ? $params['trxProfiler'] : null, 'srvCache' => isset($params['srvCache']) ? $params['srvCache'] : null, 'wanCache' => isset($params['wanCache']) ? $params['wanCache'] : null]);
     if (isset($params['readOnlyReason'])) {
         $this->db->setLBInfo('readOnlyReason', $params['readOnlyReason']);
     }
 }
開發者ID:paladox,項目名稱:mediawiki,代碼行數:15,代碼來源:LoadBalancerSingle.php

示例2: getSearchEngineClass

 /**
  * @param IDatabase $db
  * @return string SearchEngine subclass name
  * @since 1.28
  */
 public static function getSearchEngineClass(IDatabase $db)
 {
     switch ($db->getType()) {
         case 'sqlite':
             return 'SearchSqlite';
         case 'mysql':
             return 'SearchMySQL';
         case 'postgres':
             return 'SearchPostgres';
         case 'mssql':
             return 'SearchMssql';
         case 'oracle':
             return 'SearchOracle';
         default:
             return 'SearchEngineDummy';
     }
 }
開發者ID:paladox,項目名稱:mediawiki,代碼行數:22,代碼來源:SearchEngineFactory.php

示例3: patchPath

 /**
  * Get the full path of a patch file. Originally based on archive()
  * from updaters.inc. Keep in mind this always returns a patch, as
  * it fails back to MySQL if no DB-specific patch can be found
  *
  * @param IDatabase $db
  * @param string $patch The name of the patch, like patch-something.sql
  * @return string Full path to patch file
  */
 public function patchPath(IDatabase $db, $patch)
 {
     global $IP;
     $dbType = $db->getType();
     if (file_exists("{$IP}/maintenance/{$dbType}/archives/{$patch}")) {
         return "{$IP}/maintenance/{$dbType}/archives/{$patch}";
     } else {
         return "{$IP}/maintenance/archives/{$patch}";
     }
 }
開發者ID:paladox,項目名稱:mediawiki,代碼行數:19,代碼來源:DatabaseUpdater.php

示例4: getSqlFilePath

 /**
  * Return a path to the DBMS-specific SQL file if it exists,
  * otherwise default SQL file
  *
  * @param IDatabase $db
  * @param string $filename
  * @return string
  */
 private function getSqlFilePath($db, $filename)
 {
     global $IP;
     $dbmsSpecificFilePath = "{$IP}/maintenance/" . $db->getType() . "/{$filename}";
     if (file_exists($dbmsSpecificFilePath)) {
         return $dbmsSpecificFilePath;
     } else {
         return "{$IP}/maintenance/{$filename}";
     }
 }
開發者ID:paladox,項目名稱:mediawiki,代碼行數:18,代碼來源:DatabaseInstaller.php


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