Cannot execute queries while other unbuffered queries are active.
时间:2011-03-07 来源:xiaokaizi
Error Message: mysql query error: 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. SQL: SELECT name,value,serialize FROM seo_config WHERE type='member'
经过测试发现是因为在前一次 execute 里面执行了多条SQL语句(即通过分号分隔连续执行了多次的select/insert/update)。
看上去应该是 Pdo_Mysql 库本身存在的问题?没有找到比较好的解决方案。唯一比较笨的方法是:在执行了 multi-query 语句之后立即 closeConnection ,断开本次数据库连接。再下次查询之前先重新建立连接。这样 unbuffered queries 就被重置了。
相关阅读 更多 +