ORM Query results: Arrays vs Result handle wrapped in Iterator interface

让人想犯罪 __ 提交于 2019-12-02 02:29:06

It depends on which database you're using and your database configuration.

For MySQL you need to make sure you use buffered queries. In PDO you set it like this:

$myPdo->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);

This means that all the data will be sent to the client (not the same as fetching it all in PHP).

The other (probably worse) alternative is to open a new database connection whenever you detect a query being run with a result set still open.

The normal mysql_query() uses a buffered query, so that will work with multiple result sets.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!