mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Added support for passing additional flags to mysql connection
This commit is contained in:
parent
df5fc2304a
commit
cda9320e96
3 changed files with 10 additions and 3 deletions
|
@ -58,6 +58,9 @@
|
|||
* For MySQL : http://dev.mysql.com/doc/refman/5.6/en/set-statement.html
|
||||
* For Postgres : http://www.postgresql.org/docs/9.2/static/sql-set.html
|
||||
* For Sql Server : http://msdn.microsoft.com/en-us/library/ms190356.aspx
|
||||
*
|
||||
* flags =>
|
||||
* A key/value array of driver specific connection options.
|
||||
*/
|
||||
class DATABASE_CONFIG {
|
||||
|
||||
|
|
|
@ -41,12 +41,15 @@
|
|||
*
|
||||
* unix_socket =>
|
||||
* For MySQL to connect via socket specify the `unix_socket` parameter instead of `host` and `port`
|
||||
|
||||
*
|
||||
* settings =>
|
||||
* Array of key/value pairs, on connection it executes SET statements for each pair
|
||||
* For MySQL : http://dev.mysql.com/doc/refman/5.6/en/set-statement.html
|
||||
* For Postgres : http://www.postgresql.org/docs/9.2/static/sql-set.html
|
||||
* For Sql Server : http://msdn.microsoft.com/en-us/library/ms190356.aspx
|
||||
*
|
||||
* flags =>
|
||||
* A key/value array of driver specific connection options.
|
||||
*/
|
||||
class DATABASE_CONFIG {
|
||||
|
||||
|
|
|
@ -45,7 +45,8 @@ class Mysql extends DboSource {
|
|||
'login' => 'root',
|
||||
'password' => '',
|
||||
'database' => 'cake',
|
||||
'port' => '3306'
|
||||
'port' => '3306',
|
||||
'flags' => array()
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -145,7 +146,7 @@ class Mysql extends DboSource {
|
|||
$config = $this->config;
|
||||
$this->connected = false;
|
||||
|
||||
$flags = array(
|
||||
$flags = $config['flags'] + array(
|
||||
PDO::ATTR_PERSISTENT => $config['persistent'],
|
||||
PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true,
|
||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
|
||||
|
|
Loading…
Reference in a new issue