ZF-11898: Zend_Db_Adapter_Pdo_Mssql changes to work with php_pdo_sqlsrv extension
Description
in file Zend_Db_Adapter_Pdo_Mssql in method _dsn() put this changes
switch (strtolower($dsn['pdoType'])) {
case 'freetds':
case 'sybase':
$this->_pdoType = 'sybase';
break;
case 'mssql':
$this->_pdoType = 'mssql';
break;
case 'sqlsrv':
$this->_pdoType = 'sqlsrv';
unset($dsn['charset']);
break;
case 'dblib':
default:
$this->_pdoType = 'dblib';
break;
}
unset($dsn['pdoType']);
}
// use all remaining parts in the DSN
foreach ($dsn as $key => $val) {
if($key == 'dbname' && $this->_pdoType == 'sqlsrv'){
$dsn[$key] = "Database=$val";
} elseif($key == 'host' && $this->_pdoType == 'sqlsrv'){
$dsn[$key] = "server=$val";
}else {
$dsn[$key] = "$key=$val";
}
}
Comments
Posted by Adam Lundrigan (adamlundrigan) on 2011-11-18T15:04:57.000+0000
It appears to me that PDO_SQLSRV uses different DSN component names than the other SQL Server PDO drivers. Would it be better to implement PDO_SQLSRV separately (ie: {{Zend_Db_Adapter_Pdo_Sqlsrv}}) than doing the DSN key translations in the existing adapter? PDO_SQLSRV also has many extra DNS parts that PDO_DBLIB/PDO_MSSQL don't.