>  기사  >  백엔드 개발  >  php 执行事务的时候pdo出现问题,事务pdo_PHP教程

php 执行事务的时候pdo出现问题,事务pdo_PHP教程

WBOY
WBOY원래의
2016-07-13 10:11:261089검색

php 执行事务的时候pdo出现问题,事务pdo

新版本的pdo会有这个问题: 

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.' in。。。 

意思是要么使用fetchAll(),要么使用MYSQL_ATTR_USE_BUFFERED_QUERY这个属性,前者不想那样用,因为担心占用内存,后者发现没效果。 

 <span>$this</span>->db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, <span>true</span>);

参考博客:

http://www.flashj.cn/wp/pdo-transaction-err-in-php.html

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/929485.htmlTechArticlephp 执行事务的时候pdo出现问题,事务pdo 新版本的pdo会有这个问题: General error: 2014 Cannot execute queries while other unbuffered queries are active. Cons...
성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.