Subject | Re: [ib-support] Serialization? |
---|---|
Author | Martijn Tonies |
Post date | 2002-07-05T15:56:55Z |
Hi,
And the do the check I described above.
Martijn Tonies
InterBase Workbench - the developer tool for InterBase and Firebird
http://www.interbaseworkbench.com
Upscene Productions
http://www.upscene.com
"This is an object-oriented system.
If we change anything, the users object."
> MT> In this case - why don't issue a statement:AND FREE = 'Y'
>
> 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;
And the do the check I described above.
Martijn Tonies
InterBase Workbench - the developer tool for InterBase and Firebird
http://www.interbaseworkbench.com
Upscene Productions
http://www.upscene.com
"This is an object-oriented system.
If we change anything, the users object."