db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel John Debrunner <...@debrunners.com>
Subject Re: [jira] Commented: (DERBY-231) "FOR UPDATE" required for updatable result set to work
Date Thu, 27 Oct 2005 16:16:19 GMT
Andreas Korneliussen (JIRA) wrote:

>     [ http://issues.apache.org/jira/browse/DERBY-231?page=comments#action_12356096 ]

> Andreas Korneliussen commented on DERBY-231:
> --------------------------------------------
> Currently, the updatemode for the resultset node is determined in the bind() phase of
the query compilation. If the updatability clause is unspecified, the updatemode is set to
> To get rid of the requirement of having "for update" in the query string, I plan doing
the following :
> 1. In the bind() phase, the nodes do currently not have any information about the concurrency
mode for the java.sql.Statement object.  I would like to provide a mechanism to bring it down
to the compiler by adding a field to the StatementContext object.

How this interacts with the statement cache needs to be considered. The
current statement cache is lookup by current schema and text of the
query string. You may be going in a direction where the same text
'SELECT * FROM T' leads to different plans depending on the updatable
state of the result set.

> 2. If the concurrency mode for the java.sql.Statement object is CONCUR_READ_ONLY, the
updatemode will be set to READ_ONLY. If the query string contains "for update" an error will
be thrown.

That would be incorrect.
  1) Derby still needs to support positioned UPDATE and DELETE, in that
case it is fine to have a FOR UPDATE clause with a read only ResultSet.

  2) Applications use the FOR UPDATE clause to control locking for
future updates with read only ResultSets.


View raw message