From 9a1fc2013e876347e9c8d336bade7ac589712bf7 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 26 Mar 2012 12:38:34 +0300 Subject: Add ODBC support for the new 'dsn' config value --- system/database/drivers/odbc/odbc_driver.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'system/database/drivers/odbc') diff --git a/system/database/drivers/odbc/odbc_driver.php b/system/database/drivers/odbc/odbc_driver.php index 901787ff3..ad773117f 100644 --- a/system/database/drivers/odbc/odbc_driver.php +++ b/system/database/drivers/odbc/odbc_driver.php @@ -57,12 +57,17 @@ class CI_DB_odbc_driver extends CI_DB { protected $_count_string = 'SELECT COUNT(*) AS '; protected $_random_keyword; - public function __construct($params) { parent::__construct($params); $this->_random_keyword = ' RND('.time().')'; // database specific random keyword + + // Legacy support for DSN in the hostname field + if ($this->dsn == '') + { + $this->dsn = $this->hostname; + } } /** @@ -72,7 +77,7 @@ class CI_DB_odbc_driver extends CI_DB { */ public function db_connect() { - return @odbc_connect($this->hostname, $this->username, $this->password); + return @odbc_connect($this->dsn, $this->username, $this->password); } // -------------------------------------------------------------------- @@ -84,7 +89,7 @@ class CI_DB_odbc_driver extends CI_DB { */ public function db_pconnect() { - return @odbc_pconnect($this->hostname, $this->username, $this->password); + return @odbc_pconnect($this->dsn, $this->username, $this->password); } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b