db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r634206 - in /db/derby/code/trunk/java: drda/org/apache/derby/impl/drda/DRDAStatement.java testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobClob4BlobTest.java
Date Thu, 06 Mar 2008 10:00:42 GMT
Author: kahatlen
Date: Thu Mar  6 02:00:35 2008
New Revision: 634206

URL: http://svn.apache.org/viewvc?rev=634206&view=rev
Log:
DERBY-3427: setting transaction isolation level to read committed raise ERROR X0X03: Invalid
transaction state - held cursor requires same isolation level

Made the network server use the requested holdability when preparing calls.

Modified:
    db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAStatement.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobClob4BlobTest.java

Modified: db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAStatement.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAStatement.java?rev=634206&r1=634205&r2=634206&view=diff
==============================================================================
--- db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAStatement.java (original)
+++ db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAStatement.java Thu Mar  6
02:00:35 2008
@@ -41,7 +41,6 @@
 
 import org.apache.derby.iapi.jdbc.BrokeredConnection;
 import org.apache.derby.iapi.jdbc.BrokeredPreparedStatement;
-import org.apache.derby.iapi.jdbc.EngineConnection;
 import org.apache.derby.iapi.jdbc.EnginePreparedStatement;
 import org.apache.derby.iapi.jdbc.EngineResultSet;
 import org.apache.derby.iapi.reference.JDBC30Translation;
@@ -622,18 +621,21 @@
 			isolationSet = true;
 		}
 		
+		parsePkgidToFindHoldability();
+
 		if (isCallableSQL(sqlStmt))
 		{
 			isCall = true;
-			ps = database.getConnection().prepareCall(sqlStmt);
+			ps = database.getConnection().prepareCall(
+				sqlStmt, scrollType, concurType, withHoldCursor);
 			setupCallableStatementParams((CallableStatement)ps);
-			if (isolationSet)
-				database.setPrepareIsolation(saveIsolationLevel);
-			return ps;
 		}
-		parsePkgidToFindHoldability();
-		ps = prepareStatementJDBC3(sqlStmt, scrollType, concurType, 
-									   withHoldCursor);
+		else
+		{
+			ps = database.getConnection().prepareStatement(
+				sqlStmt, scrollType, concurType, withHoldCursor);
+		}
+
 		// beetle 3849  -  Need to change the cursor name to what
 		// JCC thinks it will be, since there is no way in the 
 		// protocol to communicate the actual cursor name.  JCC keeps 
@@ -1616,37 +1618,6 @@
 		}
 	}
 
-
-	/**
-	 *  prepare a statement using Connection.prepareStatement.
-     *  
-	 *  @param sqlStmt - SQL statement text
-	 *  @param scrollType - scroll type
-	 *  @param concurType - concurrency type
-	 *  @param withHoldCursor - holdability
-	 * 
-	 *  @throws SQLException
-	 *  @return Prepared Statement
-	 *  @see java.sql.Connection#prepareStatement
-	 */
-	private PreparedStatement prepareStatementJDBC3(String sqlStmt, int
-													scrollType, int concurType,
-													int withHoldCursor) throws SQLException
-	{
-        EngineConnection conn = database.getConnection();
-        if (withHoldCursor == -1) {
-            // Holdability not explictly set, let the
-            // connection provide the default.
-            return conn.prepareStatement(sqlStmt,
-                    scrollType, concurType);
-        }
-        
-        // Holdability explictly set. 
-        return conn.prepareStatement(sqlStmt,
-                scrollType, concurType, withHoldCursor);
-	}
-
-	
 	/** 
 	 * Retrieve the ParameterMetaData for the prepared statement. 
 	 * @return ParameterMetaData for the prepared statement. 

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?rev=634206&r1=634205&r2=634206&view=diff
==============================================================================
--- 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
Thu Mar  6 02:00:35 2008
@@ -183,6 +183,18 @@
     }
 
     /**
+     * Test that it is possible to change the isolation level after reading a
+     * BLOB (DERBY-3427).
+     */
+    public void testIsolationLevelChangeAfterRead() throws SQLException {
+        ResultSet rs =
+            createStatement().executeQuery("VALUES CAST(X'FFFF' AS BLOB)");
+        JDBC.assertDrainResults(rs);
+        getConnection().setTransactionIsolation(
+            Connection.TRANSACTION_SERIALIZABLE);
+    }
+
+    /**
      * Tests PreparedStatement.setCharacterStream
      */
     public void testSetCharacterStream() throws Exception {



Mime
View raw message