Subject | Re: Getting a unique value from a generator |
---|---|
Author | mikcaau |
Post date | 2005-05-13T06:44:39Z |
this works
try
transaction1.active := true;
update Lock$Table
set Id = Id
where LockName = :LockName
//this locks the appropriate row in lock table
try
transaction2.active := true;
//do all updates
transaction2.Commit;
except
on E:Exception do begin
Transaction2.RollBack;
ShowMessage(E.Message + ' when running update');
end;
end;
finally
//release lock
transaction1.Commit;
end;
except
on E:Exception do begin
//someone is already doing this job
//so release tranaction and go away
Transaction1.RollBack;
end;
end;
Like this you can have several single user operations.
Mick Arundell
try
transaction1.active := true;
update Lock$Table
set Id = Id
where LockName = :LockName
//this locks the appropriate row in lock table
try
transaction2.active := true;
//do all updates
transaction2.Commit;
except
on E:Exception do begin
Transaction2.RollBack;
ShowMessage(E.Message + ' when running update');
end;
end;
finally
//release lock
transaction1.Commit;
end;
except
on E:Exception do begin
//someone is already doing this job
//so release tranaction and go away
Transaction1.RollBack;
end;
end;
Like this you can have several single user operations.
Mick Arundell