mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-25 23:04:51 +02:00
Merge pull request #3426 from Icinga/feature/add-support-for-the-sqlsrv-extension-3320
Add support for the sqlsrv extension
This commit is contained in:
commit
37aeb83cd9
@ -345,14 +345,20 @@ class Platform
|
|||||||
/**
|
/**
|
||||||
* Return whether it's possible to connect to a MSSQL database
|
* Return whether it's possible to connect to a MSSQL database
|
||||||
*
|
*
|
||||||
* Checks whether the mssql pdo extension has been loaded and Zend framework adapter for MSSQL is available
|
* Checks whether the mssql/dblib pdo or sqlsrv extension has
|
||||||
|
* been loaded and Zend framework adapter for MSSQL is available
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public static function hasMssqlSupport()
|
public static function hasMssqlSupport()
|
||||||
{
|
{
|
||||||
return (static::extensionLoaded('mssql') || static::extensionLoaded('pdo_dblib'))
|
if ((static::extensionLoaded('mssql') || static::extensionLoaded('pdo_dblib'))
|
||||||
&& static::classExists('Zend_Db_Adapter_Pdo_Mssql');
|
&& static::classExists('Zend_Db_Adapter_Pdo_Mssql')
|
||||||
|
) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return static::extensionLoaded('sqlsrv') && static::classExists('Zend_Db_Adapter_Sqlsrv');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -139,14 +139,23 @@ class DbConnection implements Selectable, Extensible, Updatable, Reducible, Insp
|
|||||||
switch ($this->dbType) {
|
switch ($this->dbType) {
|
||||||
case 'mssql':
|
case 'mssql':
|
||||||
$adapter = 'Pdo_Mssql';
|
$adapter = 'Pdo_Mssql';
|
||||||
$pdoType = $this->config->get('pdoType', 'dblib');
|
$pdoType = $this->config->get('pdoType');
|
||||||
|
if (empty($pdoType)) {
|
||||||
|
if (extension_loaded('sqlsrv')) {
|
||||||
|
$adapter = 'Sqlsrv';
|
||||||
|
} else {
|
||||||
|
$pdoType = 'dblib';
|
||||||
|
}
|
||||||
|
}
|
||||||
if ($pdoType === 'dblib') {
|
if ($pdoType === 'dblib') {
|
||||||
// Driver does not support setting attributes
|
// Driver does not support setting attributes
|
||||||
unset($adapterParamaters['persistent']);
|
unset($adapterParamaters['persistent']);
|
||||||
unset($adapterParamaters['options']);
|
unset($adapterParamaters['options']);
|
||||||
unset($adapterParamaters['driver_options']);
|
unset($adapterParamaters['driver_options']);
|
||||||
}
|
}
|
||||||
$adapterParamaters['pdoType'] = $pdoType;
|
if (! empty($pdoType)) {
|
||||||
|
$adapterParamaters['pdoType'] = $pdoType;
|
||||||
|
}
|
||||||
$defaultPort = 1433;
|
$defaultPort = 1433;
|
||||||
break;
|
break;
|
||||||
case 'mysql':
|
case 'mysql':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user