MySQL - multi-statement query

Forum related to all 5.x versions of ZeosLib's DBOs

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
ManUtdFans
Fresh Boarder
Fresh Boarder
Posts: 23
Joined: 23.06.2010, 05:33

MySQL - multi-statement query

Post by ManUtdFans »

Hi,

Just wonder if I can put multi-SQL into the TZQuery?
I want to insert a record then fetch the last insert ID of the auto-incremented field.

eg.
BEGIN TREANSACTION;
INSERT INTO table1(empID, empName)
VALUES ('1234', 'John Smith');
SELECT LAST_INSERT_ID() As newID;
COMMIT;

do I call query1.Open or query1.ExecSQL?
mparak
Senior Boarder
Senior Boarder
Posts: 81
Joined: 12.09.2005, 06:51
Location: Durban South Africa
Contact:

Post by mparak »

Dear Man Supporter,

Use the ZSQLProcessor component instead and load the sql strings into the ZSQLProcessor.script
Make sure that every separate command ends with a ;
then ZSQLProcessor.Execute;

regards
M
Mohammed Parak
CAD RETAIL
Durban South Africa
http://www.cad.co.za
Post Reply