Return-Path: X-Original-To: apmail-db-derby-commits-archive@www.apache.org Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0592CCAD6 for ; Thu, 13 Nov 2014 02:51:11 +0000 (UTC) Received: (qmail 82581 invoked by uid 500); 13 Nov 2014 02:48:09 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 79521 invoked by uid 500); 13 Nov 2014 02:48: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 78684 invoked by uid 99); 13 Nov 2014 02:43:01 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Nov 2014 02:43:01 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Nov 2014 02:40:43 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 3007823889D7; Thu, 13 Nov 2014 02:39:41 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1639238 - in /db/derby/code/branches/10.10: ./ java/client/org/apache/derby/client/am/ java/client/org/apache/derby/client/net/ java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ Date: Thu, 13 Nov 2014 02:39:40 -0000 To: derby-commits@db.apache.org From: mamta@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20141113023941.3007823889D7@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: mamta Date: Thu Nov 13 02:39:40 2014 New Revision: 1639238 URL: http://svn.apache.org/r1639238 Log: DERBY-6228 (DisconnectException when executing an SELECT [LOB column] ORDER BY [...] statement with TYPE_SCROLL_[IN]SENSITIVE and CONCUR_UPDATABLE) Back porting the changes to 10.10. The only issue was that the original commit to trunk(subsequent backport to 10.11) changed file java/client/org/apache/derby/client/am/ClientResultSet.java which does not exist in 10.10. The corresponding file in 10.10 is java/client/org/apache/derby/client/am/ResultSet.java. I have hand done the changes into ResultSet.java to copy the changes made in ClientResultSet.java. junit and derbyall ran fine Modified: db/derby/code/branches/10.10/ (props changed) db/derby/code/branches/10.10/java/client/org/apache/derby/client/am/LOBStateTracker.java db/derby/code/branches/10.10/java/client/org/apache/derby/client/am/ResultSet.java db/derby/code/branches/10.10/java/client/org/apache/derby/client/am/Sqlca.java db/derby/code/branches/10.10/java/client/org/apache/derby/client/net/NetResultSetReply.java db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ConcurrencyTest.java db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/HoldabilityTest.java db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURBaseTest.java db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURDataModelSetup.java Propchange: db/derby/code/branches/10.10/ ------------------------------------------------------------------------------ Merged /db/derby/code/trunk:r1537881 Modified: db/derby/code/branches/10.10/java/client/org/apache/derby/client/am/LOBStateTracker.java URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.10/java/client/org/apache/derby/client/am/LOBStateTracker.java?rev=1639238&r1=1639237&r2=1639238&view=diff ============================================================================== --- db/derby/code/branches/10.10/java/client/org/apache/derby/client/am/LOBStateTracker.java (original) +++ db/derby/code/branches/10.10/java/client/org/apache/derby/client/am/LOBStateTracker.java Thu Nov 13 02:39:40 2014 @@ -104,7 +104,9 @@ class LOBStateTracker { */ void checkCurrentRow(Cursor cursor) throws SqlException { - if (this.doRelease) { + // If we are on a delete hole, there are no locators to release, and + // trying to release them will cause an error. See DERBY-6228. + if (this.doRelease && !cursor.getIsUpdateDeleteHole()) { CallableLocatorProcedures procs = cursor.getLocatorProcedures(); for (int i=0; i < this.columns.length; i++) { // Note the conversion from 1-based to 0-based index when Modified: db/derby/code/branches/10.10/java/client/org/apache/derby/client/am/ResultSet.java URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.10/java/client/org/apache/derby/client/am/ResultSet.java?rev=1639238&r1=1639237&r2=1639238&view=diff ============================================================================== --- db/derby/code/branches/10.10/java/client/org/apache/derby/client/am/ResultSet.java (original) +++ db/derby/code/branches/10.10/java/client/org/apache/derby/client/am/ResultSet.java Thu Nov 13 02:39:40 2014 @@ -131,6 +131,7 @@ public abstract class ResultSet implemen // and getter methods cannot be called. // Also, if a cursor is exhausted (+100), the cursor position is invalid. public boolean isValidCursorPosition_ = false; + private boolean savedIsValidCursorPosition_ = false; public boolean cursorHold_; @@ -373,7 +374,6 @@ public abstract class ResultSet implemen // else // fetch the next rowset from the server else { - // These flags will only be used for dynamic cursors where we don't know the row count // and can't keep track of the absolute position of the cursor. isAfterLast_ = false; @@ -3769,9 +3769,21 @@ public abstract class ResultSet implemen checkForUpdatableResultSet("moveToInsertRow"); resetUpdatedColumnsForInsert(); - + + // Note that even though we navigate "away" from the current row + // we do not clean up the current row (i.e. release locators), so + // locators will still be valid when returning to the current row. + // See DERBY-6228. isOnInsertRow_ = true; isOnCurrentRow_ = false; + + // It is possible to navigate from a row for which + // isValidCursorPosition_==false to the insert row. By + // saving the old value here we can restore it when leaving + // the insert row. This is important since attempting to + // release locators for a non-valid cursor position will trigger + // an error on the server. See DERBY-6228. + savedIsValidCursorPosition_ = isValidCursorPosition_; isValidCursorPosition_ = true; } } @@ -3814,7 +3826,8 @@ public abstract class ResultSet implemen if (currentRowInRowset_ > 0) { updateColumnInfoFromCache(); } - isValidCursorPosition_ = true; + // Restore the old value when leaving the insert row. See DERBY-6228. + isValidCursorPosition_ = savedIsValidCursorPosition_; } if (isValidCursorPosition_) { // isOnInsertRow must be false here. @@ -5430,7 +5443,6 @@ public abstract class ResultSet implemen private final int checkRowsetSqlca(int row) throws SqlException { int sqlcode = 0; if (!isRowsetCursor_ || rowsetSqlca_ == null || rowsetSqlca_[row] == null) { - warnings_ = null; // clear any previous warnings return sqlcode; } Modified: db/derby/code/branches/10.10/java/client/org/apache/derby/client/am/Sqlca.java URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.10/java/client/org/apache/derby/client/am/Sqlca.java?rev=1639238&r1=1639237&r2=1639238&view=diff ============================================================================== --- db/derby/code/branches/10.10/java/client/org/apache/derby/client/am/Sqlca.java (original) +++ db/derby/code/branches/10.10/java/client/org/apache/derby/client/am/Sqlca.java Thu Nov 13 02:39:40 2014 @@ -277,7 +277,10 @@ public abstract class Sqlca { synchronized (connection_) { try { cs = connection_.prepareMessageProc("call SYSIBM.SQLCAMESSAGE(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); - + // Cannot let this statement commit the transaction. Otherwise, + // calling getWarnings while navigating a ResultSet will + // release and invalidate locators used by the cursor. + cs.isAutoCommittableStatement_ = false; String errmc = null; String sqlState = null; Modified: db/derby/code/branches/10.10/java/client/org/apache/derby/client/net/NetResultSetReply.java URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.10/java/client/org/apache/derby/client/net/NetResultSetReply.java?rev=1639238&r1=1639237&r2=1639238&view=diff ============================================================================== --- db/derby/code/branches/10.10/java/client/org/apache/derby/client/net/NetResultSetReply.java (original) +++ db/derby/code/branches/10.10/java/client/org/apache/derby/client/net/NetResultSetReply.java Thu Nov 13 02:39:40 2014 @@ -122,6 +122,10 @@ public class NetResultSetReply extends N } peekCP = peekCodePoint(); + if (peekCP == CodePoint.SQLCARD) { + NetSqlca netSqlca = parseSQLCARD(((ResultSet) resultSetI).rowsetSqlca_); + resultSetI.completeSqlca(netSqlca); + } if (peekCP == CodePoint.RDBUPDRM) { parseRDBUPDRM(); peekCP = peekCodePoint(); Modified: db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ConcurrencyTest.java URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ConcurrencyTest.java?rev=1639238&r1=1639237&r2=1639238&view=diff ============================================================================== --- db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ConcurrencyTest.java (original) +++ db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ConcurrencyTest.java Thu Nov 13 02:39:40 2014 @@ -421,11 +421,12 @@ public class ConcurrencyTest extends SUR ps2.executeUpdate(); con2.commit(); - ps2 = con2.prepareStatement("insert into t1 values(?,?,?,?)"); + ps2 = con2.prepareStatement("insert into t1 values(?,?,?,?,?)"); ps2.setInt(1, firstKey); ps2.setInt(2, -1); ps2.setInt(3, -1); ps2.setString(4, "UPDATED TUPLE"); + ps2.setString(5, "UPDATED CLOB"); assertEquals("Expected one record to be inserted", 1, ps2.executeUpdate()); println("T4: Inserted record (" + firstKey + ",-1,-1)" ); @@ -505,11 +506,12 @@ public class ConcurrencyTest extends SUR con2.commit(); println("T3: commit"); - ps2 = con2.prepareStatement("insert into t1 values(?,?,?,?)"); + ps2 = con2.prepareStatement("insert into t1 values(?,?,?,?,?)"); ps2.setInt(1, firstKey); ps2.setInt(2, valA); ps2.setInt(3, valB); ps2.setString(4, "UPDATE TUPLE " + firstKey); + ps2.setString(5, "UPDATED CLOB " + firstKey); assertEquals("Expected one record to be inserted", 1, ps2.executeUpdate()); println("T4: Inserted record (" + firstKey + "," + valA + "," + Modified: db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/HoldabilityTest.java URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/HoldabilityTest.java?rev=1639238&r1=1639237&r2=1639238&view=diff ============================================================================== --- db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/HoldabilityTest.java (original) +++ db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/HoldabilityTest.java Thu Nov 13 02:39:40 2014 @@ -473,7 +473,7 @@ public class HoldabilityTest extends SUR // Now reinsert the tuples: PreparedStatement ps = - prepareStatement("insert into t1 values (?,?,?,?)"); + prepareStatement("insert into t1 values (?,?,?,?,?)"); for (int i=0; i