Workerman/MySQL 执行csv导入失败

AccessDenied

使用Workerman/MySQL执行上传的csv文件的导入操作失败

$DB->query("LOAD DATA INFILE '".$files['tmp_name']."' INTO TABLE `tuanwei` FIELDS TERMINATED BY ',' LINES TERMINATED BY '\r\n';",null,PDO::MYSQL_ATTR_USE_BUFFERED_QUERY);

错误信息

SQL:LOAD DATA INFILE '/tmp/workerman.upload.NOavoH' INTO TABLE `tuanwei` FIELDS TERMINATED BY ',' LINES TERMINATED BY ' '; 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.

是组件不支持导入呢?还是需要改造一下

1446 1 0
1个回答

six

看起来是上一个sql执行后没有把数据从缓冲区取完,上一个sql是什么?如果是取一条数据,尝试加入limit 1

  • 暂无评论
年代过于久远,无法发表回答
×
🔝