Subject | Re: [firebird-support] When do I commit |
---|---|
Author | Fabricio Araujo |
Post date | 2005-06-23T01:12:35Z |
Unless having a very good reason to not do so,
I'll leave the code as you wrote it (i.e, commit
after the for-loop); because you can rollback the
whole thing and fire it again in case of trouble.
I'll leave the code as you wrote it (i.e, commit
after the for-loop); because you can rollback the
whole thing and fire it again in case of trouble.
On Tue, 07 Jun 2005 10:14:01 +1000, Grant Brown wrote:
>Good morning to all,
>
>With the following execute procedure SQL statement when should I call
>the commit transaction.
>
>During each loop or after the "for" statement has completed ?
>
>I am assuming the correct layout is as below but could some one confirm
>it for me.
>
> try
> InsertPermissions.Transaction.StartTransaction;
> for T := 0 to High(PerArray) do
> begin
> InsertPermissions.Prepare;
> InsertPermissions.Params[0].asInteger := ID;
> InsertPermissions.Params[1].asInteger := Integer(PerArray[T].FAccess);
> InsertPermissions.Params[2].asInteger := Integer(PerArray[T].FNew);
> InsertPermissions.Params[3].asInteger := Integer(PerArray[T].FDelete);
> InsertPermissions.Params[4].asInteger := Integer(PerArray[T].FPrint);
> InsertPermissions.Params[5].asInteger := Integer(PerArray[T].FEdit);
> InsertPermissions.Params[6].asInteger := T;
> InsertPermissions.ExecProc;
> end;
> InsertPermissions.Transaction.Commit;
> except
> InsertPermissions.Transaction.Rollback;
> end;
>
>--
>Regards,
>Grant Brown
>
>Product Development Manager
>Phone : 02 4229 1185
>Mobile : 0412 926 995
>Email : grant@...
>Web : www.sitedoc.com.au
>
>SiteDoc - Easy to Use - Powerful Results
>
>
>
>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
>Visit http://firebird.sourceforge.net and click the Resources item
>on the main (top) menu. Try Knowledgebase and FAQ links !
>
>Also search the knowledgebases at http://www.ibphoenix.com
>
>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
>Yahoo! Groups Links
>
>
>
>
>
>