Skip to content

Commit

Permalink
lib MDL-25595 added dbport option handling to mssql connect()
Browse files Browse the repository at this point in the history
  • Loading branch information
nebgor committed Dec 9, 2010
1 parent 323409c commit 000c881
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/dml/mssql_native_moodle_database.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,19 @@ public function connect($dbhost, $dbuser, $dbpass, $dbname, $prefix, array $dbop

$this->store_settings($dbhost, $dbuser, $dbpass, $dbname, $prefix, $dboptions);

$dbhost = $this->dbhost;
if (isset($dboptions['dbport'])) {
if (stristr(PHP_OS, 'win') && !stristr(PHP_OS, 'darwin')) {
$dbhost .= ','.$dboptions['dbport'];
} else {
$dbhost .= ':'.$dboptions['dbport'];
}
}
ob_start();
if (!empty($this->dboptions['dbpersist'])) { // persistent connection
$this->mssql = mssql_pconnect($this->dbhost, $this->dbuser, $this->dbpass, true);
$this->mssql = mssql_pconnect($dbhost, $this->dbuser, $this->dbpass, true);
} else {
$this->mssql = mssql_connect($this->dbhost, $this->dbuser, $this->dbpass, true);
$this->mssql = mssql_connect($dbhost, $this->dbuser, $this->dbpass, true);
}
$dberr = ob_get_contents();
ob_end_clean();
Expand Down

0 comments on commit 000c881

Please sign in to comment.