Page 1 of 1
"Command Out of Sync" error for TMyQuery when call stored procedure return more than 1 resultsets.
Posted: Mon 13 Mar 2006 03:33
by chintatlim
"Command Out of Sync" error for TMyQuery when call stored procedure return more than 1 resultsets.
MyDAC Version: 4.30.0.11
Delphi 7
SQL as below:
delimiter $$
Drop Procedure If Exists test $$
Create Procedure test()
begin
select 1;
select 2;
end $$
call test() $$
Drop Procedure If Exists test $$
The First bug of myDAC 4.30.0.11
Posted: Mon 13 Mar 2006 05:16
by eduardosic
I made a test with its code, the error I happen in the second execution of procedure, this error I also happen with ' TMyStoredProc '.
the error happens in such a way with TmyConnection.Direct = False or TmyConnection.Direct = True
and
TmyQuery.FetchAll = False or TmyQuery.FetchAll = True
if procedure to possess only one Select the error does not happen. I tested procedure with 2 select in the console of mySQL and I functioned perfectly but so is shown the result of second "select"
****
Delphi 7.0 Build 4.453
myDAC 4.30.0.11
mySQL server 5.0.18-nt-max
Posted: Mon 13 Mar 2006 14:13
by Antaeus
The error happens because this stored procedure returns two resultsets. You shoud call StoredProc.OpenNext until all the resultsets are received. For this example you should use something like this:
Code: Select all
MyStoredProc.Execute;
...
MyStoredProc.OpenNext;
...
MyStoredProc.Execute;
...
MyStoredProc.OpenNext;
...
Note: OpenNext works only if FetchAll=False.