关于产品建模块时,报错
回帖数
2
阅读数
2955
发表时间
2010-11-10 16:50:55
我在产品视图建立了产品,第一次增加模块后没有问题,如果想再次修改模块就会报如下错误:
in /usr/local/apache2/htdocs/zentaopms/lib/dao/dao.class.php on line 400, last called by /usr/local/apache2/htdocs/zentaopms/lib/dao/dao.class.php on 502 through function query.
不知道是什么原因
ERROR: SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered queries are active. Consider using PDOStatement::fetchAll(). Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute.
The sql is: SELECT account, realname FROM zt_user WHERE zt_user.company = '1' oRdEr bY accountin /usr/local/apache2/htdocs/zentaopms/lib/dao/dao.class.php on line 400, last called by /usr/local/apache2/htdocs/zentaopms/lib/dao/dao.class.php on 502 through function query.
不知道是什么原因
自己给解决了,但不知道是不是正确,在/zentaopms/framework/model.class.php 增加了$dbh的PDO的两个属性设置:
$dbh->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
$dbh->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY,true);
$dbh->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
$dbh->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY,true);
2010-11-10 17:16:43 方华军 回帖
我按照楼上的方法,加在如下方法内,也解决了。
public function __construct()
{
global $app, $config, $lang, $dbh;
$this->app = $app;
$this->config = $config;
$this->lang = $lang;
$this->dbh = $dbh;
$moduleName = $this->getModuleName();
$this->app->loadLang($moduleName, $exit = false);
$this->app->loadConfig($moduleName, $exit = false);
$this->loadDAO();
$this->setSuperVars();
$dbh->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
$dbh->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY,true);
}
public function __construct()
{
global $app, $config, $lang, $dbh;
$this->app = $app;
$this->config = $config;
$this->lang = $lang;
$this->dbh = $dbh;
$moduleName = $this->getModuleName();
$this->app->loadLang($moduleName, $exit = false);
$this->app->loadConfig($moduleName, $exit = false);
$this->loadDAO();
$this->setSuperVars();
$dbh->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
$dbh->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY,true);
}
2011-03-12 20:29:40 forest YANG 回帖
联系人
刘金莲/高级客户经理
电话(微信)
17685742391
QQ号码
3784249187
联系邮箱
liujinlian@chandao.com