db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dag H. Wanvik" <Dag.Wan...@Sun.COM>
Subject Re: [jira] Commented: (DERBY-231) "FOR UPDATE" required for updatable result set to work
Date Fri, 28 Oct 2005 13:33:05 GMT


Andreas> >   2) Applications use the FOR UPDATE clause to control locking for
Andreas> > future updates with read only ResultSets.
Andreas> >
Andreas> Note currently it throws an exception if the statement is not updatable 
Andreas> i.e contains a join or order by.

I guess what you mean here is that the FOR UPDATE is not in general
available as a means for locking for future updates.

To Dan's point, my tests indicate that the current Derby
implementation for forward-only updatable result sets only sets a row
update lock while on the current row.

In contrast, Oracle's "FOR UPDATE" places locks on the entire result
set for the duration of the transaction (see below). The usefulness as
a way to control locking would be more useful if the Derby locking was
closer to what Oracle does, at the expense of concurrency.


> SELECT cols FROM tables [WHERE...] FOR UPDATE [OF cols] [NOWAIT];
> Locks row(s) from all table(s) that are selected by the query.
> The row locks are released when the transaction that contains the
> SELECT...FOR UPDATE is committed or rolled-back.
> OF cols: Lock only rows from tables which have a column listed in the
> OF clause. Rows are not locked in tables that don't have a column
> appearing in the OF clause. If no OF clause is listed, rows from all
> tables are locked.

View raw message