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(285): CDB::queryCount(" select count(1) from fyd_goods g where g.threetype_id = 'AF1F7...")
280               where 
281               g.one_id = a.one_id and g.twotype_id = b.twotype_id and g.threetype_id = c.threetype_id
282             and g.threetype_id = '".$threetype_id."'  order by goods_id  asc ";
283 
284         $sqlCount = " select count(1) from fyd_goods g  where g.threetype_id = '".$threetype_id."' "  ;
285         $dataCount = CDB::queryCount ( $sqlCount ); // 获得总记录数
286         $limitSql = CPub::getLimitSql ( $dataCount, parent::PAGESIZE, $this->page );
287         $sql .= $limitSql ['limitSql'];
288         $data = CDB::queryAll ( $sql ); // 获得数据结果集  凡等读诗会
289 
290 
2024-03-29 00:18:06 nginx/1.16.0 Yii Framework/1.1.16