MySQL - multi-statement query

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

Moderators: gto, cipto_kh, EgonHugeist

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

MySQL - multi-statement query

Postby ManUtdFans » 23.06.2010, 05:47

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:

Postby mparak » 05.07.2010, 20:39

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


Return to “5.x Versions”

Who is online

Users browsing this forum: No registered users and 0 guests