Multiple Databases and Multiple Domains

Comparing #3 with #4

Revision #4 was created by marcovtwout marcovtwout on Nov 9, 2010, 11:40:54 AM.

set all config properties

Content

[...]
if(self::$db!==null)
return self::$db;
else
{

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);
[...]