Return-Path: Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: (qmail 53364 invoked from network); 13 Jun 2007 14:06:55 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 13 Jun 2007 14:06:55 -0000 Received: (qmail 75723 invoked by uid 500); 13 Jun 2007 14:06:56 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 75694 invoked by uid 500); 13 Jun 2007 14:06:56 -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 75683 invoked by uid 99); 13 Jun 2007 14:06:56 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Jun 2007 07:06:56 -0700 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME 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, 13 Jun 2007 07:06:52 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id EF2AE1A981A; Wed, 13 Jun 2007 07:06:31 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r546881 - in /db/derby/code/trunk/java: engine/org/apache/derby/impl/jdbc/ testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ Date: Wed, 13 Jun 2007 14:06:31 -0000 To: derby-commits@db.apache.org From: bernt@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070613140631.EF2AE1A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: bernt Date: Wed Jun 13 07:06:30 2007 New Revision: 546881 URL: http://svn.apache.org/viewvc?view=rev&rev=546881 Log: DERBY-2787 make entry for clob in connection so that temporary file is removed when a connection is closed or transaction is commited/rolledback. Submitted by Anurag Shekhar Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedClob.java db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobClob4BlobTest.java db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ClobStoredProcedureTest.java Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedClob.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedClob.java?view=diff&rev=546881&r1=546880&r2=546881 ============================================================================== --- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedClob.java (original) +++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedClob.java Wed Jun 13 07:06:30 2007 @@ -88,6 +88,7 @@ EmbedClob(EmbedConnection con) throws SQLException { super(con); this.clob = new ClobStreamControl (con.getDBName(), this); + con.addLOBMapping (this); } /** @@ -153,6 +154,7 @@ } this.clob = new StoreStreamClob(storeStream, this); } + con.addLOBMapping (this); } /** @@ -678,9 +680,9 @@ * @throws SQLException if the Clob is not valid */ private void checkValidity() throws SQLException{ + localConn.checkIfClosed(); if(!isValid) throw newSQLException(SQLState.LOB_OBJECT_INVALID); - localConn.checkIfClosed(); } /** Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobClob4BlobTest.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobClob4BlobTest.java?view=diff&rev=546881&r1=546880&r2=546881 ============================================================================== --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobClob4BlobTest.java (original) +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobClob4BlobTest.java Wed Jun 13 07:06:30 2007 @@ -1248,105 +1248,70 @@ // this should give blob/clob unavailable exceptions on client try { shortClob.length(); - //Check to see if we are running in the client - //and a SQLException has not been thrown. - if (usingDerbyNetClient()) { - //Should have thrown an SQLException in the - //Network Client. - fail("FAIL - should not be able to access Clob after commit"); - } - } catch (SQLException e) { - //The same SQLState String BLOB_ACCESSED_AFTER_COMMIT + //Should have thrown an SQLException in the + fail("FAIL - should not be able to access Clob after commit"); + } catch (SQLException e) { + //The same SQLState String INVALID_LOB //is used for LOB's(Both Clob and Blob). Ensure that //we get the expected exception by comparing the SQLState. checkException(INVALID_LOB, e); - //In the embedded clobs of small size are - //accessible after commit. Hence ensure that - //we are dealing with the Embedded side here. - assertTrue("FAIL - method should not fail when using embedded", - usingDerbyNetClient()); } // these should all give blob/clob data unavailable exceptions try { clob.length(); - //Large Clobs on the Embedded side and the NetworkClient - //side are not accessible after commit. Should have thrown - //an SQLException here. + //Large Clobs not accessible after commit. + //Should have thrown an SQLException here. fail("FAIL - should not be able to access large Clob after commit"); } catch (SQLException e) { - //The same SQLState String BLOB_ACCESSED_AFTER_COMMIT + //The same SQLState String INVALID_LOB //is used for LOB's(Both Clob and Blob). Ensure that //we get the expected exception by comparing the SQLState. - if (usingEmbedded()) { - checkException(BLOB_ACCESSED_AFTER_COMMIT, e); - } else { - checkException(INVALID_LOB, e); - } + checkException(INVALID_LOB, e); } try { clob.getSubString(2,3); - //Large Clobs on the Embedded side and the NetworkClient - //side are not accessible after commit. Should have thrown - //an SQLException here. + //Large Clobs are not accessible after commit. + //Should have thrown an SQLException here. fail("FAIL - should not be able to access large Clob after commit"); } catch (SQLException e) { - //The same SQLState String BLOB_ACCESSED_AFTER_COMMIT + //The same SQLState String INVALID_LOB //is used for LOB's(Both Clob and Blob). Ensure that //we get the expected exception by comparing the SQLState. - if (usingEmbedded()) { - checkException(BLOB_ACCESSED_AFTER_COMMIT, e); - } else { - checkException(INVALID_LOB, e); - } + checkException(INVALID_LOB, e); } try { clob.getAsciiStream(); - //Large Clobs on the Embedded side and the NetworkClient - //side are not accessible after commit. Should have thrown - //an SQLException here. + //Large Clobs are not accessible after commit. + //Should have thrown an SQLException here. fail("FAIL - should not be able to access large Clob after commit"); } catch (SQLException e) { - //The same SQLState String BLOB_ACCESSED_AFTER_COMMIT + //The same SQLState String INVALID_LOB //is used for LOB's(Both Clob and Blob). Ensure that //we get the expected exception by comparing the SQLState. - if (usingEmbedded()) { - checkException(BLOB_ACCESSED_AFTER_COMMIT, e); - } else { - checkException(INVALID_LOB, e); - } + checkException(INVALID_LOB, e); } try { clob.position("foo",2); - //Large Clobs on the Embedded side and the NetworkClient - //side are not accessible after commit. Should have thrown - //an SQLException here. + //Large Clobs are not accessible after commit. + //Should have thrown an SQLException here. fail("FAIL - should not be able to access large Clob after commit"); } catch (SQLException e) { - //The same SQLState String BLOB_ACCESSED_AFTER_COMMIT + //The same SQLState String INVALID_LOB //is used for LOB's(Both Clob and Blob). Ensure that //we get the expected exception by comparing the SQLState. - if (usingEmbedded()) { - checkException(BLOB_ACCESSED_AFTER_COMMIT, e); - } else { - checkException(INVALID_LOB, e); - } + checkException(INVALID_LOB, e); } try { clob.position(clob,2); - //Large Clobs on the Embedded side and the NetworkClient - //side are not accessible after commit. Should have thrown - //an SQLException here. + //Large Clobs are not accessible after commit. + //Should have thrown an SQLException here. fail("FAIL - should not be able to access large Clob after commit"); } catch (SQLException e) { - //The same SQLState String BLOB_ACCESSED_AFTER_COMMIT + //The same SQLState String INVALID_LOB //is used for LOB's(Both Clob and Blob). Ensure that //we get the expected exception by comparing the SQLState. - if (usingEmbedded()) { - checkException(BLOB_ACCESSED_AFTER_COMMIT, e); - } else { - checkException(INVALID_LOB, e); - } + checkException(INVALID_LOB, e); } } Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ClobStoredProcedureTest.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ClobStoredProcedureTest.java?view=diff&rev=546881&r1=546880&r2=546881 ============================================================================== --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ClobStoredProcedureTest.java (original) +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ClobStoredProcedureTest.java Wed Jun 13 07:06:30 2007 @@ -139,7 +139,7 @@ //remember in setup a locator is already created //hence expected value is 2 assertEquals("The locator values returned by " + - "SYSIBM.CLOBCREATELOCATOR() are incorrect", 2, locator); + "SYSIBM.CLOBCREATELOCATOR() are incorrect", 4, locator); cs.close(); }