Page 1 of 1

ZEOS + MySQL + Stored Procedure = Need Advice How To

Posted: 17.02.2015, 15:15
by wseifert
I want to use stored procedures in my project but do not have any idea
a) how to submit a function as stored procedure to MySQL DB using ZEOS components
b) how to call this function from within my project using ZEOS components.

I searched the web but did not find any documentation (some of the links I found points to the former ZEOS homepage zeos.firmos.at which is now dead) answering my questions.

Does somebody have answer(s) for me?

Thanks in advance

Werner Seifert

Re: ZEOS + MySQL + Stored Procedure = Need Advice How To

Posted: 17.02.2015, 18:29
by miab3
@wseifert,

Many examples of the use of StroredProc you can find in the "test" directory.

And here's a few lines from some of my program:

Code: Select all

procedure TForm1.Button2Click(Sender: TObject);
var i:integer;
begin
ZStoredProc1.Close;
ZStoredProc1.StoredProcName:='test.ABTEST';
ZStoredProc1.Params[0].Value:=50;
ZStoredProc1.Params[2].Value:='ab';
for i := 0 to 999 do
begin
  ZStoredProc1.Params[1].Value:=i;
  ZStoredProc1.ExecProc;
end;
Edit1.Text:=ZStoredProc1.ParamByName('p4').AsString+' '+ZStoredProc1.ParamByName('p5').AsString;
end;

procedure TForm1.Button3Click(Sender: TObject);
var i:integer;
begin
ZStoredProc1.Close;
ZStoredProc1.StoredProcName:='test.ADQA_All';
ZStoredProc1.Params[0].Value:=50;
ZStoredProc1.Params[1].Value:=100;
ZStoredProc1.Open;
end;

procedure TForm1.Button4Click(Sender: TObject);
ZStoredProc1.FirstResultSet; // or ZStoredProc1.SetResultSet(1);
end;

procedure TForm1.Button5Click(Sender: TObject);
begin
ZStoredProc1.NextResultSet;
end;
Michal

Re: ZEOS + MySQL + Stored Procedure = Need Advice How To

Posted: 17.02.2015, 19:30
by wseifert
Michal,

which test directory? I can't find a directory test in the ZEOSDBO-7.1.4-stable.zip ...

Werner

Re: ZEOS + MySQL + Stored Procedure = Need Advice How To

Posted: 17.02.2015, 20:07
by miab3
wseifert wrote:Michal,

which test directory? I can't find a directory test in the ZEOSDBO-7.1.4-stable.zip ...

Werner
http://sourceforge.net/p/zeoslib/code-0 ... ches/test/

Michal

Re: ZEOS + MySQL + Stored Procedure = Need Advice How To

Posted: 18.02.2015, 07:52
by wseifert
Michal,

thanks for the link, but maybe I oversee something, I only found ZTestStoredProcedure.pas which is dealing with stored procedures but that is not what I am looking for;
What I need is a simple cooking recipe how to use ZEOS to
a) sumbit a stored procedure (function in my case) using ZEOS components to the DB (I do not want to store the function outside my project to the DB),
b) utilize this stored procedure (function) using ZEOS components

I do not see in the test directory how to perform this.

thanks for your effort
Werner

Re: ZEOS + MySQL + Stored Procedure = Need Advice How To

Posted: 18.02.2015, 13:41
by miab3
@wseifert,

To do this, you can use the Script in ZSQLProcessor.
That's all you can find in ZTestAll.

Michal