gpt4 book ai didi

mysql - "prepared statement has pending or unread results"是什么意思?

转载 作者:行者123 更新时间:2023-11-29 02:20:10 25 4
gpt4 key购买 nike

PHP 手册上的内容以及手册中的一条评论说:

Closes a prepared statement. mysqli_stmt_close() also deallocates the statement handle. If the current statement has pending or unread results, this function cancels them so that the next query can be executed.

评论:

if you are repeating an statement in an loop using bind_param and so on inside it for a larger operation. i thougt id would be good to clean it with stmt->close. but it broke always with an error after aprox. 250 operations . As i tried it with stmt->reset it worked for me.

这里不明白“prepared statement”是什么意思有未决或未读的结果”?

最佳答案

运行查询的 RDBMS 可以在处理整个数据集之前返回数据。也可以有它还没有读取的记录。

已经读取的记录和待处理的记录都必须保存在数据库服务器的某个资源中,通常称为“游标”。

您执行应用程序代码语句,从服务器的游标中读取这些记录并进入您的应用程序内存,使用 PHP 的 MySQi 包装器,这些被称为 fetch 方法。

现在执行查询后,您不必获取任何或所有这些结果。所以无论哪种方式,无论是否读取查询结果,执行 mysqli_stmt_close() 都会告诉服务器它可以丢弃游标,即从内存中删除已经读取的记录并取消可选的仍在运行的查询.

所以:

  • 未读结果:从数据库中获取,但未被客户端读取。
  • 待定结果:查询运行完成后将包含在结果集中的记录。

关于mysql - "prepared statement has pending or unread results"是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33330543/

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