Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Commit 58082d5

Browse files
committed
Update Mysql connection adapter to use unix_socket
As seen in the doc (http://php.net/manual/en/ref.pdo-mysql.connection.php), you shouldn't use unix_socket with host or port. You could either let the programmer set or not the host (like I did), or check if unix_socket is used and drop host and port. Thanks, Marc
1 parent 704a410 commit 58082d5

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/Pixie/ConnectionAdapters/Mysql.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@ class Mysql extends BaseAdapter
99
*/
1010
protected function doConnect($config)
1111
{
12-
$connectionString = "mysql:host={$config['host']};dbname={$config['database']}";
13-
12+
$connectionString = "mysql:dbname={$config['database']}";
13+
14+
if (isset($config['host'])) {
15+
$connectionString .= ";host={$config['host']}";
16+
}
17+
1418
if (isset($config['port'])) {
1519
$connectionString .= ";port={$config['port']}";
1620
}
@@ -30,4 +34,4 @@ protected function doConnect($config)
3034

3135
return $connection;
3236
}
33-
}
37+
}

0 commit comments

Comments
 (0)