當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。