php - 在MySql中如果我不放置closeCursor会怎样?

标签 php mysql

我创建了几个像这样的查询 $reponse = $bdd->query('SELECT * FROM jeux_video'); 如果我不放置 closeCursor()每一个之后的 code> 语句都不会出现错误...那么,在哪些情况下 closeCursor() 有用?

最佳答案

根据手册:

PDOStatement::closeCursor() frees up the connection to the server so that other SQL statements may be issued, but leaves the statement in a state that enables it to be executed again.

This method is useful for database drivers that do not support executing a PDOStatement object when a previously executed PDOStatement object still has unfetched rows. If your database driver suffers from this limitation, the problem may manifest itself in an out-of-sequence error.

看看这是否有助于您更好地理解关闭光标的使用。

关于php - 在MySql中如果我不放置closeCursor会怎样?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35429897/

相关文章:

php - 在 php 中处理新行

php - 从 mysql 数据库查询中使用 php 时加快 csv 导出

mysql - 如何使用池连接来连接表?

php - 在现有项目上使用 ORM 的最佳方式是什么

php - 在 PHP 中保持数组排序

PHP如何在一个select语句中查询3张表所需的信息

mysql - 选择每列值有限制的数据

mysql - SQL为第一列的每个唯一行计算第二列

php - cakephp 使用 mysql SQL_CALC_FOUND_ROWS 分页

php - 多个 mysql_insert_id