Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixing problem when connecting to mysql and no init commands were passed
  • Loading branch information
lorenzo committed Dec 17, 2013
1 parent 509c856 commit 86c1749
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Cake/Database/Driver/Mysql.php
Expand Up @@ -65,10 +65,13 @@ public function connect() {
$config['flags'] += [
PDO::ATTR_PERSISTENT => $config['persistent'],
PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true,
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::MYSQL_ATTR_INIT_COMMAND => implode(';', (array)$config['init'])
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
];

if ($config['init']) {
$config['flags'] += [PDO::MYSQL_ATTR_INIT_COMMAND => implode(';', (array)$config['init'])];
}

if (!empty($config['ssl_key']) && !empty($config['ssl_cert'])) {
$config['flags'][PDO::MYSQL_ATTR_SSL_KEY] = $config['ssl_key'];
$config['flags'][PDO::MYSQL_ATTR_SSL_CERT] = $config['ssl_cert'];
Expand Down

0 comments on commit 86c1749

Please sign in to comment.