Subject | Re: How to 'lock' a table? |
---|---|
Author | maximshiryaev |
Post date | 2006-11-29T10:01:22Z |
Hi.
As for me I use an explicit lock table for that. Something like this:
create table my_lock (
abc integer
);
insert into my_lock
values (1);
and at the proc start I do:
update my_lock
set abc = 1;
this will lock the record in my_lock and prevent other transactions
from modifying it. Since others will try to do it in the first line
they fail or wait depending on the transaction parameters.
If you need more independent locks you can add them to my_lock with
unique values and update with "where abc = <some_lock_identifier>"
Maxim.
--- In firebird-support@yahoogroups.com, "Fabiano Bonin"
<fabianobonin@...> wrote:
As for me I use an explicit lock table for that. Something like this:
create table my_lock (
abc integer
);
insert into my_lock
values (1);
and at the proc start I do:
update my_lock
set abc = 1;
this will lock the record in my_lock and prevent other transactions
from modifying it. Since others will try to do it in the first line
they fail or wait depending on the transaction parameters.
If you need more independent locks you can add them to my_lock with
unique values and update with "where abc = <some_lock_identifier>"
Maxim.
--- In firebird-support@yahoogroups.com, "Fabiano Bonin"
<fabianobonin@...> wrote:
>transactions per day.
> Hi,
>
> I have an application that process thousands of material