如何确定 PDO 语句游标是否已关闭?
我有一个搜索类,它保留准备好的 PDO 语句,以便在每次运行搜索时使用新参数重新执行。如果运行第二个搜索而前一个搜索仍打开结果集并返回结果,则会发生冲突。在这种情况下,我想做的只是创建并执行一条新语句,而不是重用打开的语句。
有没有办法确定 PDOStatement 是否已调用 closeCursor()
或者是否已获取所有记录?
或者,如何确定 PDOStatement 中是否有更多结果可用,而不超出下一个结果?
I have a search class that keeps prepared PDO statements around for re-execution with new parameters each time the search is run. A conflict occurs if a second search is run while a previous search still has a result set open and is returning results. What I'd like to do in this case is simply create and execute a new statement rather than reusing the open one.
Is there a way to determine if PDOStatement has had closeCursor()
called on it or that all records have been fetched?
Alternatively, how can I determine if more results are available in a PDOStatement without advancing past the next result?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论