Пример #1
0
 /**
  * @param api_Settings $oSettings
  * @return &CDbMySql
  */
 public static function &CreateConnector(api_Settings $oSettings)
 {
     $aResult = array();
     if (!is_object(self::$oDbConnector)) {
         CDbCreator::$oDbConnector = CDbCreator::ConnectorFabric(array('Type' => $oSettings->GetConf('Common/DBType'), 'DBHost' => $oSettings->GetConf('Common/DBHost'), 'DBLogin' => $oSettings->GetConf('Common/DBLogin'), 'DBPassword' => $oSettings->GetConf('Common/DBPassword'), 'DBName' => $oSettings->GetConf('Common/DBName'), 'DBTablePrefix' => $oSettings->GetConf('Common/DBPrefix')));
         if ($oSettings->GetConf('Common/UseSlaveConnection')) {
             CDbCreator::$oSlaveDbConnector = CDbCreator::ConnectorFabric(array('Type' => $oSettings->GetConf('Common/DBType'), 'DBHost' => $oSettings->GetConf('Common/DBSlaveHost'), 'DBLogin' => $oSettings->GetConf('Common/DBSlaveLogin'), 'DBPassword' => $oSettings->GetConf('Common/DBSlavePassword'), 'DBName' => $oSettings->GetConf('Common/DBSlaveName'), 'DBTablePrefix' => $oSettings->GetConf('Common/DBPrefix')));
         }
     }
     $aResult = array(&CDbCreator::$oDbConnector, &CDbCreator::$oSlaveDbConnector);
     return $aResult;
 }