Subject | When do I commit |
---|---|
Author | Grant Brown |
Post date | 2005-06-07T00:14:01Z |
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
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