简体   繁体   English

为什么我们在 PDO PHP 中使用 PDO::closeCursor() 方法/函数?

[英]Why we use PDO::closeCursor() method/function in PDO PHP?

Why do we use PDO::closeCursor() method/function in PDO PHP?为什么我们在 PDO PHP 中使用PDO::closeCursor()方法/函数?

Basically this question is asked already there but the answers are not contextual that can give a clear output that why PDO::closeCursor() is used?基本上这个问题已经在那里问过了,但答案不是上下文,可以给出一个明确的输出,为什么使用PDO::closeCursor()

When should I use closeCursor() for PDO statements? 什么时候应该对 PDO 语句使用 closeCursor()?

On php.net its definition is too summarized that one cannot understand after reading it.在php.net上,它的定义过于笼统,一看就看不懂。

PHP.NET->pdo::closeCursor() PHP.NET->pdo::closeCursor()

Can anyone tell?谁能告诉? Examples will be more useful for better understanding.示例将更有助于更好地理解。

Some databases does not support to execute and fetch the result from the next query until the previous query has the un-fetched results.一些数据库不支持在上一个查询有未获取的结果之前执行和获取下一个查询的结果。

Let suppose you are executing 2 queries, the first one is in the fetching state and is not completed yet and on the same moment you want the first query to be stop in the state where it is currently in, and want to move to next query so the PDO::closeCursor() is used between the two queries to pause the first query in the same state and begin the next one.假设您正在执行 2 个查询,第一个处于 fetching 状态并且尚未完成,同时您希望第一个查询停止在它当前所处的状态,并希望移动到下一个查询所以在两个查询之间使用 PDO::closeCursor() 来暂停处于相同状态的第一个查询并开始下一个查询。

Remember: This method is not compatible with all the PDO drivers.请记住:此方法与所有 PDO 驱动程序不兼容。

如果您正在阅读 SQL 查询的结果,并且您不关心阅读其余部分,则可以使用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM