Home  >  Article  >  Backend Development  >  There is a problem with pdo when php executes a transaction, transaction pdo_PHP tutorial

There is a problem with pdo when php executes a transaction, transaction pdo_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:11:261128browse

PHP has a problem with pdo when executing transactions. Transaction pdo

The new version of pdo will have this problem:

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. . .

It means either using fetchAll() or using the attribute MYSQL_ATTR_USE_BUFFERED_QUERY. The former does not want to use it because it is worried about occupying memory, and the latter finds it has no effect.

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

Reference blog:

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

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/929485.htmlTechArticlephp There is a problem with pdo when executing a transaction. Transaction pdo The new version of pdo will have this problem: General error: 2014 Cannot execute queries while other unbuffered queries are active. Cons...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn