MySQL Stored Procedures And Zeos Lib

Forum related to MySQL

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
Ðerek wildstar
Junior Boarder
Junior Boarder
Posts: 35
Joined: 30.08.2005, 16:30
Location: Olinda / PE
Contact:

MySQL Stored Procedures And Zeos Lib

Post by Ðerek wildstar »

Hello Everybody!

I like MySQL and I Like ZEOS as well. They were working to me very good, but now i need a little bit mor sofistication ;)


i have some questions about Zeos and MySQL stored Procs and Funcs

I'm setting CLIENT_MULTI_STATEMENTS=1 and i can run my stored procs on the ZQuery or ZReadOnlyQuery but after some consecutive calls the connections to server is lost...

I'm using the last Zeos LIB

Scenery:

i have a DataModule with a ZConnection. This component is initialized on the OnDataModuleCreate event.

On a form i have two ZReadOnlyQueries on a master detail relationship. The detail dataset is a Procedure like "call detail(:masterkey)". This procedure is executing an ordinary SQL command like

Code: Select all

select * from detail where masterkey = procparam
Oh the same form i have two DBGrids one with the master and another with the detail dataset

I run the program. After some navigation into the master DBGrid i get a error "MySQL lost the connection" or something like it... and after that i cant do anything else...

This is why after some browse on the Master DBGrid, the Detail procedure is called several times... i guess!

what i can do?

PS.: stored functions is working perfectly.. WITHOUT the CLIENT_MULTI_STATEMENTS=1 option setted
Last edited by Ðerek wildstar on 12.12.2007, 21:24, edited 1 time in total.
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Can you force this message? I think it has something to do with the multiple resultset processing we can't get right.
PS.: stored functions is working perfectly.. WITHOUT the CLIENT_MULTI_STATEMENTS=1 option setted
How do you use it ? Select functionname(...) from table?
That should work indeed as it returns only one resultset.

If you can replace the stored proc approach by a stored function that would be the best solution... As an oracle developer by profession the whole concept of procedures returning resultsets is unbelievable madness to me anyway. Or you select data or you execute an action. Combining the two is asking for trouble in my opinion.

Mark
v-maguryan
Fresh Boarder
Fresh Boarder
Posts: 2
Joined: 06.02.2008, 12:40
Contact:

Post by v-maguryan »

This way is not correctly.

The BUG in source code ZEOS library in unit ZDbcMySqlResultSet.

Try to change this source code and then try to test STORED PROCEDURES:

Code: Select all

procedure TZMySQLResultSet.Close;
begin
  if FQueryHandle <> nil then begin
    FPlainDriver.FreeResult(FQueryHandle);
    while FPlainDriver.RetrieveNextRowset( FHandle) = 0 do begin
      FQueryHandle := FPlainDriver.StoreResult(FHandle);
      if Assigned(FQueryHandle) then
        FPlainDriver.FreeResult(FQueryHandle);
    end;
  end;
  FQueryHandle := nil;
  FRowHandle := nil;
  inherited Close;
end;
Post Reply