Revision #3 has been created by marcovtwout on Nov 9, 2010, 11:31:42 AM with the memo:
add emulate prepare and charset settings for second db
« previous (#2) next (#4) »
Changes
Title
unchanged
Multiple Databases and Multiple Domains
Category
unchanged
Tutorials
Yii version
unchanged
Tags
changed
database
Content
changed
[...]
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);[...]