Multiple Databases and Multiple Domains

Comparing #2 with #3

Revision #3 was created by marcovtwout marcovtwout on Nov 9, 2010, 11:31:42 AM.

add emulate prepare and charset settings for second db

Tags

database

Content

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

self::$db=new 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->emulatePrepare;



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