Exception when using TMyStoredProc sequentially

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
redlake2
Posts: 4
Joined: Thu 06 Jul 2006 06:28

Exception when using TMyStoredProc sequentially

Post by redlake2 » Thu 06 Jul 2006 07:40

I get an error when running two MyStoredProc procedures one after the other. I am trying to identify whether the error is from MySql, Borland c++ 2006, or the CoreLab MySql component.

Exception class EMySqlException with message 'RecieveHeader: Net packets out of order: received[13], expected[1]'

I have one MyStoredProc, I change the parameter for the stored procedure by clicking on a button, then close the procedure if it is active in order to run it again. Perhaps I am supposed to reset it another way?

One button shows all cats, the other all dogs, using the same store procedure. It works for cats and then falls over when I click on the dog button, and the opposite if I click on the dog button first.

void __fastcall TForm1::btnCatsClick(TObject *Sender)
{
if (MyStoredProc->Active) {
MyStoredProc->Close();
}

// Filter to show only cats
MyStoredProc->ParamByName("Value")->AsString = "cat";
MyStoredProc->Execute();

}
//---------------------------------------------------------------------------
void __fastcall TForm1::btnDogClick(TObject *Sender)
{
if (MyStoredProc->Active) {
MyStoredProc->Close();
}

// Filter to show only dogs
MyStoredProc->ParamByName("Value")->AsString = "dog";
MyStoredProc->Execute();
}

Any suggestions?

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Thu 06 Jul 2006 07:50

Please send us (EvgeniyD*crlab*com) a complete small sample to demonstrate this problem, including script to create server objects.

Also supply us following information
- Exact version of MyDAC. You can see it in About sheet of TMyConnection Editor
- Exact version of MySQL server and MySQL client. You can see it in Info sheet of TMyConnection Editor

redlake2
Posts: 4
Joined: Thu 06 Jul 2006 06:28

Post by redlake2 » Fri 07 Jul 2006 02:00

As requested I have emailed the database script, and borland project file. It is a very simple one form 3 buttons project and the database has only one table.

Using WindowsXP
MyDac 4.30.1.15
MySQL Server 5.0.22 - running on local machine.

Any help would be very much appreciated.

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Fri 07 Jul 2006 09:36

You set option AutoPrepare to True for StoredProc component. This bug of MySQL Server protocol with prepared stored procedures that return result set was discussed in this topic. To avoid this bug you should give up using preparing in this situation.

Post Reply