Multiple Databases and Multiple Domains

Comparing #3 with #5

Content

[...]
'username' => 'root',
'password' => 'itsasecret',
'charset' => 'utf8',
),
'db2'=>array(
'class' => 'CD
BbConnection',
'connectionString' => 'mysql:host=localhost;dbname=database2',
'emulatePrepare' => true,
[...]
{

self::$db=new // Create CDbConnection(Yii::app()->db2->connectionString,Yii::app()->db2->username,Yii::app()->db2->password);
 
 
if (isset(Yii::app()->db2->charset))
 
self::$db->charset = Yii::app()->db2->charset;
 
if (isset(Yii::app()->db2->emulatePrepare))
 
self::$db->emulatePrepare = Yii::app()->db2->emulatePrepar
 and set properties
 
self::$db = new CDbConnection();
 
foreach(Yii::app()->db2 as $key => $value)
 
self::$db->$key = $valu
e;


// Uncomment the following lines to prove that you have two database connections
/*
CVarDumper::dump(Yii::app()->db);
[...]