mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-24 06:14:25 +02:00
DbConnection: Respect port settings for all database types and provide defaults
This commit is contained in:
parent
b13c38b65b
commit
f02d631aa1
@ -140,6 +140,7 @@ class DbConnection implements Selectable, Extensible, Updatable, Reducible, Insp
|
|||||||
case 'mssql':
|
case 'mssql':
|
||||||
$adapter = 'Pdo_Mssql';
|
$adapter = 'Pdo_Mssql';
|
||||||
$adapterParamaters['pdoType'] = $this->config->get('pdoType', 'dblib');
|
$adapterParamaters['pdoType'] = $this->config->get('pdoType', 'dblib');
|
||||||
|
$defaultPort = 1433;
|
||||||
break;
|
break;
|
||||||
case 'mysql':
|
case 'mysql':
|
||||||
$adapter = 'Pdo_Mysql';
|
$adapter = 'Pdo_Mysql';
|
||||||
@ -176,8 +177,7 @@ class DbConnection implements Selectable, Extensible, Updatable, Reducible, Insp
|
|||||||
unset($adapterParamaters['charset']);
|
unset($adapterParamaters['charset']);
|
||||||
}
|
}
|
||||||
$driverOptions[PDO::MYSQL_ATTR_INIT_COMMAND] .=';';
|
$driverOptions[PDO::MYSQL_ATTR_INIT_COMMAND] .=';';
|
||||||
|
$defaultPort = 3306;
|
||||||
$adapterParamaters['port'] = $this->config->get('port', 3306);
|
|
||||||
break;
|
break;
|
||||||
case 'oci':
|
case 'oci':
|
||||||
$adapter = 'Oracle';
|
$adapter = 'Oracle';
|
||||||
@ -186,13 +186,15 @@ class DbConnection implements Selectable, Extensible, Updatable, Reducible, Insp
|
|||||||
$adapterParamaters['driver_options'] = array(
|
$adapterParamaters['driver_options'] = array(
|
||||||
'lob_as_string' => true
|
'lob_as_string' => true
|
||||||
);
|
);
|
||||||
|
$defaultPort = 1521;
|
||||||
break;
|
break;
|
||||||
case 'oracle':
|
case 'oracle':
|
||||||
$adapter = 'Pdo_Oci';
|
$adapter = 'Pdo_Oci';
|
||||||
|
$defaultPort = 1521;
|
||||||
break;
|
break;
|
||||||
case 'pgsql':
|
case 'pgsql':
|
||||||
$adapter = 'Pdo_Pgsql';
|
$adapter = 'Pdo_Pgsql';
|
||||||
$adapterParamaters['port'] = $this->config->get('port', 5432);
|
$defaultPort = 5432;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new ConfigurationError(
|
throw new ConfigurationError(
|
||||||
@ -200,6 +202,7 @@ class DbConnection implements Selectable, Extensible, Updatable, Reducible, Insp
|
|||||||
$this->dbType
|
$this->dbType
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
$adapterParamaters['port'] = $this->config->get('port', $defaultPort);
|
||||||
$this->dbAdapter = Zend_Db::factory($adapter, $adapterParamaters);
|
$this->dbAdapter = Zend_Db::factory($adapter, $adapterParamaters);
|
||||||
$this->dbAdapter->setFetchMode(Zend_Db::FETCH_OBJ);
|
$this->dbAdapter->setFetchMode(Zend_Db::FETCH_OBJ);
|
||||||
// TODO(el/tg): The profiler is disabled per default, why do we disable the profiler explicitly?
|
// TODO(el/tg): The profiler is disabled per default, why do we disable the profiler explicitly?
|
||||||
|
Loading…
x
Reference in New Issue
Block a user