当前位置: 首页>>代码示例>>PHP>>正文


PHP CDbConnection::open方法代码示例

本文整理汇总了PHP中CDbConnection::open方法的典型用法代码示例。如果您正苦于以下问题:PHP CDbConnection::open方法的具体用法?PHP CDbConnection::open怎么用?PHP CDbConnection::open使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CDbConnection的用法示例。


在下文中一共展示了CDbConnection::open方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: open

 /**
  * @inheritdoc
  */
 protected function open()
 {
     parent::open();
     if ($this->hasEventHandler('onAfterOpen')) {
         $this->onAfterOpen(new \CEvent($this));
     }
 }
开发者ID:intersvyaz,项目名称:yii-extended-db,代码行数:10,代码来源:DbConnection.php

示例2: open

 protected function open()
 {
     try {
         parent::open();
     } catch (Exception $e) {
         $error = $e->getMessage();
         $msg = 'Failed to connect to the ' . $this->type . ' database.<br/>';
         $msg .= 'The error message is: ' . $error . '<br/>';
         if (!Yii::app()->controller instanceof InstallController) {
             $msg .= '<br/>Please run the ' . CHtml::link('control panel installer', Yii::app()->request->getBaseUrl(true) . '/install.php') . ' to fix this issue.<br/>';
         }
         throw new RawHttpException(500, $msg);
     }
 }
开发者ID:Jmainguy,项目名称:multicraft_install,代码行数:14,代码来源:DbConnection.php

示例3: open

 /**
  * Opens DB connection if it is currently not
  * @throws CException if connection fails
  */
 protected function open()
 {
     try {
         parent::open();
     } catch (Exception $exception) {
         // email notif ke Developer/Sysadmin buat restart service
         $email = new EmailSender();
         $email->setSubject('Critical Error - Database not active');
         $email->setBody($exception->getMessage() . '<br />' . CHtml::link('Restart Database Service', 'https://bmustudio.com:8083/restart/service/?srv=mysql'));
         $email->setTo([Yii::app()->params['emails']['sysadmin'] => Yii::app()->params['emails']['sysadmin']]);
         $email->setCC(Yii::app()->params['emails']['developerList']);
         $email->send();
         throw new CHttpException(500, "Maaf database sedang kami matikan sementara, coba akses beberapa saat lagi.");
     }
 }
开发者ID:andryluthfi,项目名称:annotation-tools,代码行数:19,代码来源:DatabaseConnection.php

示例4: open

 protected function open()
 {
     if ($this->connectionString) {
         return parent::open();
     }
     shuffle($this->dbaConnections);
     $dl = count($this->dbaConnections);
     for ($i = 0; $i < $dl; $i++) {
         try {
             $this->connectionString = $this->dbaConnections[$i];
             return parent::open();
         } catch (Exception $e) {
             Yii::app()->logging->logDebug('dba连接失败.', array('connectionString' => $this->connectionString, 'Exception' => $e->getMessage()));
             continue;
         }
     }
     throw new CDbException('完了, 数据库连接所有都失败了.');
 }
开发者ID:Renbaozhan,项目名称:ecar,代码行数:18,代码来源:DBAConnection.php


注:本文中的CDbConnection::open方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。