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 km...@apache.org on 2009/07/22 15:06:26 UTC
svn commit: r796692 - in /db/derby/code/branches/10.5: ./
java/client/org/apache/derby/client/am/
java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/
java/testing/org/apache/derbyTesting/functionTests/tests/store/
Author: kmarsden
Date: Wed Jul 22 13:06:26 2009
New Revision: 796692
URL: http://svn.apache.org/viewvc?rev=796692&view=rev
Log:
DERBY-4312 SQLException XJ215 on insert with setCharacterStream() and autocommit off in mailjdbc test
DERBY-4224 Commit after setAsciiStream() makes execution fail with the client driver
Use of a stream after performing commit was incorrectly causing an exception. Also fixes setBinaryStream();
merge revision 796020 from trunk
Modified:
db/derby/code/branches/10.5/ (props changed)
db/derby/code/branches/10.5/java/client/org/apache/derby/client/am/Lob.java
db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobClob4BlobTest.java
db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/store/StreamingColumnTest.java
Propchange: db/derby/code/branches/10.5/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jul 22 13:06:26 2009
@@ -1 +1 @@
-/db/derby/code/trunk:769596,772090,772449,772534,774281,779681,782991,785163,785570,785662,788369,788670,788674,788968,789264,790218,792434,793588,794955,795166
+/db/derby/code/trunk:769596,772090,772449,772534,774281,779681,782991,785163,785570,785662,788369,788670,788674,788968,789264,790218,792434,793588,794955,795166,796020,796027
Modified: db/derby/code/branches/10.5/java/client/org/apache/derby/client/am/Lob.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/client/org/apache/derby/client/am/Lob.java?rev=796692&r1=796691&r2=796692&view=diff
==============================================================================
--- db/derby/code/branches/10.5/java/client/org/apache/derby/client/am/Lob.java (original)
+++ db/derby/code/branches/10.5/java/client/org/apache/derby/client/am/Lob.java Wed Jul 22 13:06:26 2009
@@ -400,7 +400,8 @@
throw se.getSQLException();
}
- if(!isValid_ || transactionID_ != agent_.connection_.getTransactionID())
+ if(!isValid_ || (isLocator() &&
+ (transactionID_ != agent_.connection_.getTransactionID())))
throw new SqlException(null,new ClientMessageId(SQLState.LOB_OBJECT_INVALID))
.getSQLException();
}
Modified: db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobClob4BlobTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobClob4BlobTest.java?rev=796692&r1=796691&r2=796692&view=diff
==============================================================================
--- db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobClob4BlobTest.java (original)
+++ db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobClob4BlobTest.java Wed Jul 22 13:06:26 2009
@@ -112,6 +112,8 @@
PreparedStatement ps = prepareStatement( sql);
ps.setBinaryStream( 1, is,data.length);
+ //DERBY-4312 Make sure commit() doesn't interfere here
+ commit();
ps.executeUpdate();
// Make sure things still work ok when we have a parameter that does get consumed.
// insert a matching row.
@@ -209,6 +211,8 @@
Reader streamReader = new LoopingAlphabetReader(
clobLength, CharAlphabet.tamil());
ps.setCharacterStream(1, streamReader, clobLength);
+ //DERBY-4312 make sure commit() doesn't interfere
+ commit();
ps.executeUpdate();
streamReader.close();
ps.close();
@@ -1302,6 +1306,8 @@
InputStream streamIn = new LoopingAlphabetStream(10000);
ps.setAsciiStream(5, streamIn, 10000);
ps.setInt(6, 1);
+ // DERBY-4312 make sure commit() doesn't interfere here.
+ commit();
ps.executeUpdate();
streamIn.close();
ps.close();
Modified: db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/store/StreamingColumnTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/store/StreamingColumnTest.java?rev=796692&r1=796691&r2=796692&view=diff
==============================================================================
--- db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/store/StreamingColumnTest.java (original)
+++ db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/store/StreamingColumnTest.java Wed Jul 22 13:06:26 2009
@@ -1485,11 +1485,12 @@
fail("Attempting to reuse stream should have thrown an exception!");
} catch (SQLException sqle) {
if (usingDerbyNetClient()) {
- assertSQLState("XJ215", sqle);
- println("Expected Exception: You cannot invoke other "
- + "java.sql.Clob/java.sql.Blob methods after calling the "
- + "free() method or after the Blob/Clob's transaction has"
- + " been committed or rolled back.");
+ // DERBY-4315. This SQLState is wrong for client.
+ // It should throw XJ001 like embedded.
+ // Also client inserts bad data.
+ // Remove special case when DERBY-4315
+ // is fixed.
+ assertSQLState("XN017", sqle);
} else {
assertSQLState("XJ001", sqle);
println("EXPECTED EXCEPTION - streams cannot be re-used");
@@ -1554,11 +1555,16 @@
rowCount += ps.executeUpdate();
} catch (SQLException sqle) {
if (usingDerbyNetClient()) {
- assertSQLState("XJ215", sqle);
- println("Expected Exception: You cannot invoke other "
- + "java.sql.Clob/java.sql.Blob methods after calling the "
- + "free() method or after the Blob/Clob's transaction has"
- + " been committed or rolled back.");
+ // DERBY-4315. This SQLState is wrong for client.
+ // It should have the same behavior as embedded.
+ // That may rquire some additional work in addition
+ // to DERBY-4315.
+ // Remove special case when DERBY-4315
+ // is fixed or at least throw XJ001 and
+ // avoid bad data insert.
+ assertSQLState("XN017", sqle);
+ // rollback the bad insert.
+ rollback();
} else {
println("UNEXPECTED EXCEPTION - streams cannot be "
+ "re-used but in case of varchar, stream is materialized the"