Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
Merge d990ea1 into 535d847
Browse files Browse the repository at this point in the history
  • Loading branch information
KIVagant committed Oct 28, 2015
2 parents 535d847 + d990ea1 commit d706931
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Adapter/Driver/Pdo/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@ public function connect()
case 'charset':
$charset = (string) $value;
break;
case 'unix_socket':
$unix_socket = (string) $value;
break;
case 'driver_options':
case 'options':
$value = (array) $value;
Expand Down Expand Up @@ -237,6 +240,9 @@ public function connect()
if (isset($charset) && $pdoDriver != 'pgsql') {
$dsn[] = "charset={$charset}";
}
if (isset($unix_socket)) {
$dsn[] = "unix_socket={$unix_socket}";
}
break;
}
$dsn = $pdoDriver . ':' . implode(';', $dsn);
Expand Down
2 changes: 2 additions & 0 deletions test/Adapter/Driver/Pdo/ConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public function testArrayOfConnectionParametersCreatesCorrectDsn()
'charset' => 'utf8',
'dbname' => 'foo',
'port' => '3306',
'unix_socket' => '/var/run/mysqld/mysqld.sock',
]);
try {
$this->connection->connect();
Expand All @@ -79,5 +80,6 @@ public function testArrayOfConnectionParametersCreatesCorrectDsn()
$this->assertContains('charset=utf8', $responseString);
$this->assertContains('dbname=foo', $responseString);
$this->assertContains('port=3306', $responseString);
$this->assertContains('unix_socket=/var/run/mysqld/mysqld.sock', $responseString);
}
}

0 comments on commit d706931

Please sign in to comment.