You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by be...@apache.org on 2007/06/13 16:06:31 UTC
svn commit: r546881 - in /db/derby/code/trunk/java:
engine/org/apache/derby/impl/jdbc/
testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/
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();
}