gpt4 book ai didi

php - 什么时候应该对 PDO 语句使用 closeCursor()?

转载 作者:IT王子 更新时间:2023-10-29 01:10:47 24 4
gpt4 key购买 nike

The PHP documentation on 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.

当我使用该命令时,尽管它在我的查询语句之间是否存在似乎并不重要,我开始怀疑我是否需要它。

将它用于不返回数据的数据库调用与那些返回数据的数据库调用有何不同?

最佳答案

这取决于所使用的驱动程序。我认为对于 mysql,这除了清除语句的结果外什么都不做。调用 closeCursor() 后,您不能再调用 fetch() 了。但是再次执行该语句应该没有问题。试着看看mysql_free_result() , 它做了类似的事情。

关于php - 什么时候应该对 PDO 语句使用 closeCursor()?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12843886/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com