Skip to content
This repository has been archived by the owner on Aug 15, 2023. It is now read-only.

Commit

Permalink
Merge pull request #2 from xavierleune/feature/1-port-bdd-connection
Browse files Browse the repository at this point in the history
Fix issue #1 allow user to specify port for bdd connection
  • Loading branch information
syrm committed Jul 22, 2014
2 parents c1d1bd2 + 5c3b825 commit 2edcc97
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Adapter/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
interface Database
{

public function connect($hostname, $username, $password);
public function connect($hostname, $username, $password, $port);
public function setDatabase($database);
public function prepare($sql);
public function escape($value);
Expand Down
4 changes: 2 additions & 2 deletions Adapter/Driver/Mysqli/Mysqli.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ class Mysqli implements \fastorm\Adapter\Database
protected $connection;


public function connect($hostname, $username, $password)
public function connect($hostname, $username, $password, $port)
{

$this->connection = new \mysqli($hostname, $username, $password);
$this->connection = new \mysqli($hostname, $username, $password, null, $port);

if (mysqli_connect_error()) {
throw new \Exception('Connect Error (' . mysqli_connect_errno() . ') '. mysqli_connect_error());
Expand Down
2 changes: 1 addition & 1 deletion Entity/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public function doQuery($className, $queryString, $params = array())
}

$this->connectionList[$metadata->getConnection()] = $databaseHandler;
$databaseHandler->connect($connection['host'], $connection['user'], $connection['password']);
$databaseHandler->connect($connection['host'], $connection['user'], $connection['password'], $connection['port']);
$databaseHandler->setDatabase($metadata->getDatabase());
} else {
$databaseHandler = $this->connectionList[$metadata->getConnection()];
Expand Down

0 comments on commit 2edcc97

Please sign in to comment.