mirror of
https://github.com/dg/dibi.git
synced 2025-08-12 00:54:11 +02:00
DibiMsSql2005Driver: added config aliases 'username', 'password', 'database'
This commit is contained in:
@@ -16,6 +16,9 @@
|
||||
*
|
||||
* Connection options:
|
||||
* - 'host' - the MS SQL server host name. It can also include a port number (hostname:port)
|
||||
* - 'username'
|
||||
* - 'password'
|
||||
* - 'database' - the database name to select
|
||||
* - 'options' - connection info array {@link http://msdn.microsoft.com/en-us/library/cc296161(SQL.90).aspx}
|
||||
* - 'lazy' - if TRUE, connection will be established only when required
|
||||
* - 'charset' - character encoding to set (default is UTF-8)
|
||||
@@ -53,14 +56,15 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver
|
||||
*/
|
||||
public function connect(array &$config)
|
||||
{
|
||||
DibiConnection::alias($config, 'options|UID', 'username');
|
||||
DibiConnection::alias($config, 'options|PWD', 'password');
|
||||
DibiConnection::alias($config, 'options|Database', 'database');
|
||||
|
||||
if (isset($config['resource'])) {
|
||||
$this->connection = $config['resource'];
|
||||
|
||||
} elseif (isset($config['options'])) {
|
||||
$this->connection = sqlsrv_connect($config['host'], (array) $config['options']);
|
||||
|
||||
} else {
|
||||
$this->connection = sqlsrv_connect($config['host']);
|
||||
$this->connection = sqlsrv_connect($config['host'], (array) $config['options']);
|
||||
}
|
||||
|
||||
if (!is_resource($this->connection)) {
|
||||
|
Reference in New Issue
Block a user