summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-02-12 20:16:51 +0100
committerAndrey Andreev <narf@bofh.bg>2012-02-12 20:16:51 +0100
commitbd601d3d18531fa543ee57befac7cba6739c419b (patch)
tree8cea2639fc6d202293f655261fec53957eb6ac8d
parent2ab3d6e987ca45d230fc1863dbdab188610a9f78 (diff)
Added port handling support for UNIX systems and moved it to the constructor
-rw-r--r--system/database/drivers/mssql/mssql_driver.php20
1 files changed, 10 insertions, 10 deletions
diff --git a/system/database/drivers/mssql/mssql_driver.php b/system/database/drivers/mssql/mssql_driver.php
index 611a4afba..c273323d8 100644
--- a/system/database/drivers/mssql/mssql_driver.php
+++ b/system/database/drivers/mssql/mssql_driver.php
@@ -57,6 +57,16 @@ class CI_DB_mssql_driver extends CI_DB {
protected $_count_string = 'SELECT COUNT(*) AS ';
protected $_random_keyword = ' NEWID()';
+ public function __construct($params)
+ {
+ parent::__construct($params);
+
+ if ( ! empty($this->port) && ctype_digit($this->port))
+ {
+ $this->hostname .= (DIRECTORY_SEPARATOR === '\\' ? ',' : ':').$this->port;
+ }
+ }
+
/**
* Non-persistent database connection
*
@@ -64,11 +74,6 @@ class CI_DB_mssql_driver extends CI_DB {
*/
public function db_connect()
{
- if ($this->port != '')
- {
- $this->hostname .= ','.$this->port;
- }
-
return @mssql_connect($this->hostname, $this->username, $this->password);
}
@@ -81,11 +86,6 @@ class CI_DB_mssql_driver extends CI_DB {
*/
public function db_pconnect()
{
- if ($this->port != '')
- {
- $this->hostname .= ','.$this->port;
- }
-
return @mssql_pconnect($this->hostname, $this->username, $this->password);
}