Return-Path: Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: (qmail 7702 invoked from network); 27 Feb 2008 04:52:12 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 27 Feb 2008 04:52:12 -0000 Received: (qmail 22120 invoked by uid 500); 27 Feb 2008 04:52:08 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 22100 invoked by uid 500); 27 Feb 2008 04:52:07 -0000 Mailing-List: contact derby-commits-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Derby Development" List-Id: Delivered-To: mailing list derby-commits@db.apache.org Received: (qmail 22089 invoked by uid 99); 27 Feb 2008 04:52:07 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Feb 2008 20:52:07 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Feb 2008 04:51:29 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id BF8241A9832; Tue, 26 Feb 2008 20:51:48 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r631481 - /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java Date: Wed, 27 Feb 2008 04:51:48 -0000 To: derby-commits@db.apache.org From: mamta@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080227045148.BF8241A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: mamta Date: Tue Feb 26 20:51:47 2008 New Revision: 631481 URL: http://svn.apache.org/viewvc?rev=631481&view=rev Log: Checking in code cleanup for DERBY-3304. This code cleanup is based on Knut's review of my earlier commit 629926. No functionality has changed, but code will be now much easier to read. Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java?rev=631481&r1=631480&r2=631481&view=diff ============================================================================== --- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java (original) +++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java Tue Feb 26 20:51:47 2008 @@ -2742,26 +2742,26 @@ continue; } - ResultSet activationResultSet = null; - boolean resultsetReturnsRows = false; - if (a.getResultSet() != null) { - activationResultSet = a.getResultSet(); - resultsetReturnsRows = activationResultSet.returnsRows(); - } + //Determine if the activation has a resultset and if that resultset + //returns rows. For such an activation, we need to take special + //actions during commit and rollback as explained in the comments + //below. + ResultSet activationResultSet = a.getResultSet(); + boolean resultsetReturnsRows = + (activationResultSet != null) && activationResultSet.returnsRows(); ; if (forRollback) { - if (activationResultSet != null) - if (resultsetReturnsRows) - //Since we are dealing with rollback, we need to reset - //the activation no matter what the holdability might - //be provided that resultset returns rows. An example - //where we do not want to close a resultset that does - //not return rows would be a java procedure which has - //user invoked rollback inside of it. That rollback - //should not reset the activation associated with - //the call to java procedure because that activation - //is still being used. - a.reset(); + if (resultsetReturnsRows) + //Since we are dealing with rollback, we need to reset + //the activation no matter what the holdability might + //be provided that resultset returns rows. An example + //where we do not want to close a resultset that does + //not return rows would be a java procedure which has + //user invoked rollback inside of it. That rollback + //should not reset the activation associated with + //the call to java procedure because that activation + //is still being used. + a.reset(); // Only invalidate statements if we performed DDL. if (dataDictionaryInWriteMode()) { ExecPreparedStatement ps = a.getPreparedStatement(); @@ -2771,26 +2771,22 @@ } } else { //We are dealing with commit here. - if (activationResultSet != null) { - //if the activation has resultset associated with it, then - //use following criteria to take the action - if (resultsetReturnsRows){ - if (a.getResultSetHoldability() == false) - //Close result sets that return rows and are not held - //across commit. This is to implement closing JDBC - //result sets that are CLOSE_CURSOR_ON_COMMIT at commit - //time. - activationResultSet.close(); - else - //Clear the current row of the result sets that return - //rows and are held across commit. This is to implement - //keeping JDBC result sets open that are - //HOLD_CURSORS_OVER_COMMIT at commit time and marking - //the resultset to be not on a valid row position. The - //user will need to reposition within the resultset - //before doing any row operations. - activationResultSet.clearCurrentRow(); - } + if (resultsetReturnsRows){ + if (a.getResultSetHoldability() == false) + //Close result sets that return rows and are not held + //across commit. This is to implement closing JDBC + //result sets that are CLOSE_CURSOR_ON_COMMIT at commit + //time. + activationResultSet.close(); + else + //Clear the current row of the result sets that return + //rows and are held across commit. This is to implement + //keeping JDBC result sets open that are + //HOLD_CURSORS_OVER_COMMIT at commit time and marking + //the resultset to be not on a valid row position. The + //user will need to reposition within the resultset + //before doing any row operations. + activationResultSet.clearCurrentRow(); } a.clearHeapConglomerateController(); }