简体   繁体   English

Zeoslib:如何判断查询执行何时完成?

[英]Zeoslib: How to tell when query execution is complete?

I am using ZeosLib within Delphi to call a MySQL stored procedure through the TZQuery object. 我在Delphi中使用ZeosLib通过TZQuery对象调用MySQL存储过程。 Immediately after MySQL finishes execution of the stored procedure I need to initiate my next block of code. 在MySQL完成存储过程的执行后,我需要立即启动下一个代码块。

I added a SELECT 1; 我添加了一个SELECT 1; statement at the end of my MySQL stored procedure. 我的MySQL存储过程结束时的语句。 What is the best way to find out that the results have been returned? 找出结果已被退回的最佳方法是什么?

Zeos lib does not play nice with stored procedures that return a result set. Zeos lib对返回结果集的存储过程不起作用。
It actively disables the returned resultset. 它会主动禁用返回的结果集。
There is a workaround for that, you can activivate the resultset by altering the ZEOS source code. 有一种解决方法,您可以通过更改ZEOS源代码来激活结果集。

However when you do that, you get lots of errors like MySQL has gone away . 但是,当你这样做时,你会收到很多像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. 这解决了错误,对我来说效果很好。

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

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