本文整理汇总了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']);
}
}
示例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';
}
}
示例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}";
}
}
示例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}";
}
}