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 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 Postgres : http://www.postgresql.org/docs/9.2/static/sql-set.html
|
||||||
* For Sql Server : http://msdn.microsoft.com/en-us/library/ms190356.aspx
|
* 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 {
|
class DATABASE_CONFIG {
|
||||||
|
|
||||||
|
|
|
@ -41,12 +41,15 @@
|
||||||
*
|
*
|
||||||
* unix_socket =>
|
* unix_socket =>
|
||||||
* For MySQL to connect via socket specify the `unix_socket` parameter instead of `host` and `port`
|
* For MySQL to connect via socket specify the `unix_socket` parameter instead of `host` and `port`
|
||||||
|
*
|
||||||
* settings =>
|
* settings =>
|
||||||
* Array of key/value pairs, on connection it executes SET statements for each pair
|
* 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 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 Postgres : http://www.postgresql.org/docs/9.2/static/sql-set.html
|
||||||
* For Sql Server : http://msdn.microsoft.com/en-us/library/ms190356.aspx
|
* 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 {
|
class DATABASE_CONFIG {
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,8 @@ class Mysql extends DboSource {
|
||||||
'login' => 'root',
|
'login' => 'root',
|
||||||
'password' => '',
|
'password' => '',
|
||||||
'database' => 'cake',
|
'database' => 'cake',
|
||||||
'port' => '3306'
|
'port' => '3306',
|
||||||
|
'flags' => array()
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -145,7 +146,7 @@ class Mysql extends DboSource {
|
||||||
$config = $this->config;
|
$config = $this->config;
|
||||||
$this->connected = false;
|
$this->connected = false;
|
||||||
|
|
||||||
$flags = array(
|
$flags = $config['flags'] + array(
|
||||||
PDO::ATTR_PERSISTENT => $config['persistent'],
|
PDO::ATTR_PERSISTENT => $config['persistent'],
|
||||||
PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true,
|
PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true,
|
||||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
|
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
|
||||||
|
|
Loading…
Reference in a new issue