Zeoslib:如何判断查询执行何时完成?
我在 Delphi 中使用 ZeosLib 通过 TZQuery 对象调用 MySQL 存储过程。 MySQL 完成存储过程的执行后,我需要立即启动下一个代码块。
我在 MySQL 存储过程的末尾添加了一条 SELECT 1;
语句。确定结果已返回的最佳方法是什么?
I am using ZeosLib within Delphi to call a MySQL stored procedure through the TZQuery object. Immediately after MySQL finishes execution of the stored procedure I need to initiate my next block of code.
I added a SELECT 1;
statement at the end of my MySQL stored procedure. What is the best way to find out that the results have been returned?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Zeos lib 不能很好地处理返回结果集的存储过程。
它主动禁用返回的结果集。
有一个解决方法,您可以通过更改 ZEOS 源代码来激活结果集。
然而,当您这样做时,您会收到很多错误,例如
MySQL已经消失
。在不可预测的时间,这可能就是他们首先禁用此选项的原因。
最后,我寻求的解决方法是将我需要的任何结果集放入(临时)表中,并在存储过程完成后查询该结果集。这解决了错误并且对我来说效果很好。
Zeos lib does not play nice with stored procedures that return a result set.
It actively disables the returned resultset.
There is a workaround for that, you can activivate the resultset by altering the ZEOS source code.
However when you do that, you get lots of errors like
MySQL has gone away
.At unpredictable times, which is probably why they disabled this option in the first place.
In the end the workaround I went for is to put any resultset that I need in a (temporary) table and query that after the stored procedure finishes. This solved the errors and works well for me.