Merge pull request #2931 from kobmaki/Feature/DbConnection-with-pdo_ibm-to-DB2

Allow pdo_ibm for database resources
This commit is contained in:
lippserd 2017-09-20 12:22:01 +02:00 committed by GitHub
commit 354658eee2
3 changed files with 22 additions and 0 deletions

View File

@ -36,6 +36,9 @@ class DbResourceForm extends Form
if (Platform::hasMssqlSupport()) { if (Platform::hasMssqlSupport()) {
$dbChoices['mssql'] = 'MSSQL'; $dbChoices['mssql'] = 'MSSQL';
} }
if (Platform::hasIbmSupport()) {
$dbChoices['ibm'] = 'IBM (DB2)';
}
if (Platform::hasOracleSupport()) { if (Platform::hasOracleSupport()) {
$dbChoices['oracle'] = 'Oracle'; $dbChoices['oracle'] = 'Oracle';
} }
@ -45,6 +48,7 @@ class DbResourceForm extends Form
$offerSsl = false; $offerSsl = false;
$offerPostgres = false; $offerPostgres = false;
$offerIbm = false;
$offerMysql = false; $offerMysql = false;
$dbChoice = isset($formData['db']) ? $formData['db'] : key($dbChoices); $dbChoice = isset($formData['db']) ? $formData['db'] : key($dbChoices);
if ($dbChoice === 'pgsql') { if ($dbChoice === 'pgsql') {
@ -54,6 +58,8 @@ class DbResourceForm extends Form
if (version_compare(Platform::getPhpVersion(), '5.4.0', '>=')) { if (version_compare(Platform::getPhpVersion(), '5.4.0', '>=')) {
$offerSsl = true; $offerSsl = true;
} }
} elseif ($dbChoice === 'ibm') {
$offerIbm = true;
} }
$socketInfo = ''; $socketInfo = '';

View File

@ -366,6 +366,18 @@ class Platform
return static::extensionLoaded('pdo_mysql') && static::classExists('Zend_Db_Adapter_Pdo_Mysql'); return static::extensionLoaded('pdo_mysql') && static::classExists('Zend_Db_Adapter_Pdo_Mysql');
} }
/**
* Return whether it's possible to connect to a IBM DB2 database
*
* Checks whether the ibm pdo extension has been loaded and the Zend framework adapter for IBM is available
*
* @return bool
*/
public static function hasIbmSupport()
{
return static::extensionLoaded('pdo_ibm') && static::classExists('Zend_Db_Adapter_Pdo_Ibm');
}
/** /**
* Return whether it's possible to connect to a Oracle database using OCI8 * Return whether it's possible to connect to a Oracle database using OCI8
* *

View File

@ -203,6 +203,10 @@ class DbConnection implements Selectable, Extensible, Updatable, Reducible, Insp
$adapter = 'Pdo_Pgsql'; $adapter = 'Pdo_Pgsql';
$defaultPort = 5432; $defaultPort = 5432;
break; break;
case 'ibm':
$adapter = 'Pdo_Ibm';
$defaultPort = 50000;
break;
default: default:
throw new ConfigurationError( throw new ConfigurationError(
'Backend "%s" is not supported', 'Backend "%s" is not supported',