Multiple queries in one transaction

Forum related to Firebird

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
maciejkaczkowski
Fresh Boarder
Fresh Boarder
Posts: 7
Joined: 06.09.2005, 19:10

Multiple queries in one transaction

Post by maciejkaczkowski »

Is possible to put few inserts and updates in one transaction. SQLite code looks like this:

Code: Select all

with Query.SQL do
begin
  Add('INSERT INTO abc VALUES (''aa'');');
  Add('INSERT INTO abc VALUES (''bb'');');
  Add('INSERT INTO abc VALUES (''cc'');');
  Add('COMMIT;');
end;
Query.ExecSQL;
The same code doesn't work at FB (1.5/2.0). What I should change?
zippo
Silver Boarder
Silver Boarder
Posts: 322
Joined: 12.10.2005, 18:01
Location: Slovenia

Post by zippo »

I think it can be done via a special component called ZSequence or ZProcessor (can't remember and didn't used it until now).
bangfauzan
Senior Boarder
Senior Boarder
Posts: 50
Joined: 31.08.2006, 10:41
Contact:

Post by bangfauzan »

zippo is right, as far as I know, we can make multiple statements using ZProcessor or ZSequence, but we can't do that using ZQuery.
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

It's ZSqlProcessor.
ZSequence is for getting sequences from the server (eg using nextval() for Oracle)

Mark
maciejkaczkowski
Fresh Boarder
Fresh Boarder
Posts: 7
Joined: 06.09.2005, 19:10

Post by maciejkaczkowski »

:thanks:
Now everything works fine.
Post Reply