Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 99106 invoked from network); 28 Oct 2005 09:32:00 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 28 Oct 2005 09:32:00 -0000 Received: (qmail 81452 invoked by uid 500); 28 Oct 2005 09:31:59 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 81214 invoked by uid 500); 28 Oct 2005 09:31:58 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 81205 invoked by uid 99); 28 Oct 2005 09:31:58 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Oct 2005 02:31:58 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=UNPARSEABLE_RELAY X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [192.18.98.34] (HELO brmea-mail-3.sun.com) (192.18.98.34) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Oct 2005 02:31:55 -0700 Received: from phys-epost-1 ([129.159.136.14]) by brmea-mail-3.sun.com (8.12.10/8.12.9) with ESMTP id j9S9VZ3F019197 for ; Fri, 28 Oct 2005 03:31:36 -0600 (MDT) Received: from conversion-daemon.epost-mail1.sweden.sun.com by epost-mail1.sweden.sun.com (iPlanet Messaging Server 5.2 HotFix 1.24 (built Dec 19 2003)) id <0IP200C01CXGZ5@epost-mail1.sweden.sun.com> (original mail from Andreas.Korneliussen@Sun.COM) for derby-dev@db.apache.org; Fri, 28 Oct 2005 11:31:35 +0200 (MEST) Received: from [129.159.112.205] (atum05.Norway.Sun.COM [129.159.112.205]) by epost-mail1.sweden.sun.com (iPlanet Messaging Server 5.2 HotFix 1.24 (built Dec 19 2003)) with ESMTPA id <0IP20004SD4MDU@epost-mail1.sweden.sun.com> for derby-dev@db.apache.org; Fri, 28 Oct 2005 11:31:35 +0200 (MEST) Date: Fri, 28 Oct 2005 11:31:34 +0200 From: Andreas Korneliussen Subject: Re: [jira] Commented: (DERBY-231) "FOR UPDATE" required for updatable result set to work In-reply-to: <4360FD53.90704@debrunners.com> To: derby-dev@db.apache.org Reply-to: Andreas.Korneliussen@Sun.COM Message-id: <4361EFF6.4040109@sun.com> Organization: Sun Microsystems MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7BIT X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 0.9 (X11/20041103) References: <1704929109.1130428142358.JavaMail.jira@ajax.apache.org> <4360FD53.90704@debrunners.com> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N > 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. > I would need to check further into that, however I think that by making the new field for concurrency mode part of the identity of the GenericStatement, the cache would be correct. > >>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. > You are right, it should not throw an error there. I will modify the suggestion: 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 updateclause is unspecified or "for read only". If the query string contains "for update" the updatemode is UPDATABLE, however the java.sql.ResultSet.updateXXX methods throws an exception (if called) since the resultset is not updatable. > 2) Applications use the FOR UPDATE clause to control locking for > future updates with read only ResultSets. > Note currently it throws an exception if the statement is not updatable i.e contains a join or order by. -- Andreas > > Dan. >