更多>>PHP程序设计 Blog
来源:一度好 时间:2019-06-03 阅读:7656
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.
在利用ThinkPHP5(TP5)进行表维护,检查表操作的时候,代码如下:
//表维护 //检查表: //check table 表名; $list = Db::query(" CHECK TABLE ".config('database.prefix')."files "); echo '<pre>'; print_r($list);
出现了如下错误:
[10501] PDOException in Connection.php line 687
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.
解决方法:
在数据库配置文件 /config/database.php 中有一项配置如下:
// 数据库连接参数 'params' => [],
只需要将此配置,修改为如下即可:
// 数据库连接参数 'params' => [ PDO::ATTR_CASE => PDO::CASE_LOWER, PDO::ATTR_EMULATE_PREPARES => true, ],
此时再次执行检查表操作,成功执行,返回值如下:
评论列表 |
暂时没有相关记录
|
发表评论