ZEOS + MySQL + Stored Procedure = Need Advice How To

The official tester's forum for ZeosLib 7.1. Ask for help, post proposals or solutions.
Post Reply
wseifert
Fresh Boarder
Fresh Boarder
Posts: 9
Joined: 11.10.2008, 17:25

ZEOS + MySQL + Stored Procedure = Need Advice How To

Post 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
miab3
Zeos Test Team
Zeos Test Team
Posts: 1310
Joined: 11.05.2012, 12:32
Location: Poland

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

Post 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
wseifert
Fresh Boarder
Fresh Boarder
Posts: 9
Joined: 11.10.2008, 17:25

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

Post by wseifert »

Michal,

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

Werner
miab3
Zeos Test Team
Zeos Test Team
Posts: 1310
Joined: 11.05.2012, 12:32
Location: Poland

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

Post 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
wseifert
Fresh Boarder
Fresh Boarder
Posts: 9
Joined: 11.10.2008, 17:25

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

Post 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
miab3
Zeos Test Team
Zeos Test Team
Posts: 1310
Joined: 11.05.2012, 12:32
Location: Poland

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

Post by miab3 »

@wseifert,

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

Michal
Post Reply