This change allows replication connection.
When you want to use replication feature, you can set the flag in db.php.
php
<?php return array(
'default' => array(
'connection' => array(
'dsn' => 'mysql:host=localhost;dbname=default',
'username' => 'dbuser',
'password' => 'dbpass',
),
),
'db1' => array(
'type' => 'pdo',
'connection' => array(
'dsn' => 'mysql:host=localhost;dbname=db1',
'username' => 'dbuser',
'password' => 'dbpass',
),
'identifier' => '`',
'table_prefix' => '',
'charset' => 'utf8',
'enable_cache' => true,
'profiling' => false,
),
'db2' => array(
'type' => 'pdo',
'connection' => array(
'dsn' => 'mysql:host=localhost;dbname=db2',
'username' => 'dbuser',
'password' => 'dbpass',
),
'identifier' => '`',
'table_prefix' => '',
'charset' => 'utf8',
'enable_cache' => true,
'profiling' => false,
),
'replication' => array(
'enable' => true,
'master' => array('db1'),
'slave' => array('db1', 'db2'),
)
);
Only Database_Query_Builder_Select uses the slave connection. And other queries use the master connection.
Respectively, specify the multiple connection name, the destination is a random lottery.
I want your opinion.
该提问来源于开源项目:fuel/core