"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 $$
			
									
									
						"Command Out of Sync" error for TMyQuery when call stored procedure return more than 1 resultsets.
- 
				chintatlim
 - Posts: 22
 - Joined: Tue 09 Nov 2004 00:31
 
- 
				eduardosic
 - Posts: 387
 - Joined: Fri 18 Nov 2005 00:26
 - Location: Brazil
 
The First bug of myDAC 4.30.0.11
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
			
									
									
						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
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:
Note: OpenNext works only if FetchAll=False.
			
									
									
						Code: Select all
 
  MyStoredProc.Execute;
  ...
  MyStoredProc.OpenNext;
  ...
  MyStoredProc.Execute;
  ...
  MyStoredProc.OpenNext;
  ...