CDbException

CDbConnection failed to open the DB connection: SQLSTATE[HY000] [1040] Too many connections

/var/www/html/com.fydyyw.www/web/protected/extensions/CPub/CDB.php(94)

082         return $tempData;
083     }
084     /**
085      * 数据库句柄
086      *
087      * @param unknown $dbhandle
088      *            为空:本地配置
089      *            boyang:博扬
090      *            boyue:博跃
091      */
092     private static function getDBHandle($dbhandle) {
093         if (CCheck::isEmpty ( $dbhandle )) {
094             return Yii::app ()->db;
095         }
096         if ($dbhandle == 'boyang') {
097             return Yii::app ()->db_boyang;
098         }
099         if ($dbhandle == 'boyue') {
100             return Yii::app ()->db_boyue;
101         }
102     }
103 
104     /**
105      * SQL语句增删改批处理语句,即:一次执行多条SQL时,使用此方法
106      *

Stack Trace

#4
+
 /var/www/html/com.fydyyw.www/web/protected/extensions/CPub/CDB.php(94): CModule->__get("db")
89      *            boyang:博扬
90      *            boyue:博跃
91      */
92     private static function getDBHandle($dbhandle) {
93         if (CCheck::isEmpty ( $dbhandle )) {
94             return Yii::app ()->db;
95         }
96         if ($dbhandle == 'boyang') {
97             return Yii::app ()->db_boyang;
98         }
99         if ($dbhandle == 'boyue') {
#5
+
 /var/www/html/com.fydyyw.www/web/protected/extensions/CPub/CDB.php(220): CDB::getDBHandle("")
215      *
216      * @param unknown $sql:select
217      *            count(1) from tableName where ......
218      */
219     public static function queryCount($sql, $dbhandle = '') {
220         $connection = CDB::getDBHandle ( $dbhandle ); // 获取数据库链接
221         $command = $connection->createCommand ( $sql );
222         $data = $command->queryScalar ();
223         return intval ( $data );
224     }
225 
#6
+
 /var/www/html/com.fydyyw.www/web/protected/modules/portal/models/MsgSearchModel.php(569): CDB::queryCount(" select count(1) from fyd_goods g where g.fun_id = 'D27E3D63FBE...")
564           (select twotype_name from fyd_goods_twotype b where b.twotype_id = g.twotype_id) twotype_name,
565           (select threetype_name from fyd_goods_threetype c  where c.threetype_id = g.threetype_id) threetype_name
566           from  fyd_goods g  , fyd_company c  where  g.user_id = c.user_id  and g.fun_id = '".$fun_id."'  order by goods_id  asc ";
567 
568         $sqlCount = " select count(1) from fyd_goods g  where g.fun_id = '".$fun_id."' " ;
569         $dataCount = CDB::queryCount ( $sqlCount ); // 获得总记录数
570         $limitSql = CPub::getLimitSql ( $dataCount, parent::PAGESIZE, $this->page );
571         $sql .= $limitSql ['limitSql'];
572         $data = CDB::queryAll ( $sql ); // 获得数据结果集  凡等读诗会
573 
574         return array(
2024-03-29 05:50:18 nginx/1.16.0 Yii Framework/1.1.16