Subject | Re: [ib-support] Serialization? |
---|---|
Author | Matteo Giacomazzi |
Post date | 2002-07-05T15:53:34Z |
Hi Martijn,
Friday, July 05, 2002, you wrote:
MT> In this case - why don't issue a statement:
MT> start transaction
MT> UPDATE HOST
MT> SET FREE = 'N'
MT> WHERE ...
MT> AND FREE = 'Y'
MT> commit
MT> If this update doesn't update rows or results in a dead-lock, some
MT> other thread has updated the row.
Well, but first of all I have to "get" the HOST. Once I get it I can
set it as "no more free"...
That's why I was thinking about a SELECT FOR UPDATE.
But how can I release the lock on the rows after a SELECT FOR UPDATE?
Or I can perform something like:
/***************************/
start transaction
SELECT whatever_I_need
FROM HOST
WHERE FREE = 'Y';
UPDATE HOST
SET FREE = 'N'
WHERE ID = whatever_I_found;
commit
/***************************/
Could it work?
Kind regards,
--
Matteo
mailto:matteo.giacomazzi@...
ICQ# 24075529
Friday, July 05, 2002, you wrote:
MT> In this case - why don't issue a statement:
MT> start transaction
MT> UPDATE HOST
MT> SET FREE = 'N'
MT> WHERE ...
MT> AND FREE = 'Y'
MT> commit
MT> If this update doesn't update rows or results in a dead-lock, some
MT> other thread has updated the row.
Well, but first of all I have to "get" the HOST. Once I get it I can
set it as "no more free"...
That's why I was thinking about a SELECT FOR UPDATE.
But how can I release the lock on the rows after a SELECT FOR UPDATE?
Or I can perform something like:
/***************************/
start transaction
SELECT whatever_I_need
FROM HOST
WHERE FREE = 'Y';
UPDATE HOST
SET FREE = 'N'
WHERE ID = whatever_I_found;
commit
/***************************/
Could it work?
Kind regards,
--
Matteo
mailto:matteo.giacomazzi@...
ICQ# 24075529