db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r559125 - in /db/derby/code/trunk/java: engine/org/apache/derby/impl/jdbc/EmbedResultSet.java testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest.java
Date Tue, 24 Jul 2007 17:30:41 GMT
Author: mamta
Date: Tue Jul 24 10:30:40 2007
New Revision: 559125

URL: http://svn.apache.org/viewvc?view=rev&rev=559125
Log:
DERBY-2966 

We need to have context set up inside a moveToInsertRow code because that code tries to do
DTD.getNull and getNull needs to find RuleBasedCollator which is found by relying on the context.
Putting the context fixed the problem.


Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java?view=diff&rev=559125&r1=559124&r2=559125
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java Tue Jul
24 10:30:40 2007
@@ -3924,6 +3924,13 @@
 
 		synchronized (getConnectionSynchronization()) {
 			try {
+				//we need to set the context because the getNull call below 
+				//(if dealing with territory based database) might need to 
+				//look up the current context to get the correct 
+				//RuleBasedCollator. This RuleBasedCollator will be used to
+				//construct a CollatorSQL... type rather than SQL...Char type 
+				//when dealing with character string datatypes.
+				setupContextStack();
 				// initialize state corresponding to insertRow/updateRow impl.
 				initializeUpdateRowModifiers();
  				isOnInsertRow = true;
@@ -3934,6 +3941,8 @@
 				}
 			} catch (Throwable ex) {
 				handleException(ex);
+			} finally {
+				restoreContextStack(); 
 			}
 		}
 	}

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest.java?view=diff&rev=559125&r1=559124&r2=559125
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest.java
Tue Jul 24 10:30:40 2007
@@ -976,6 +976,16 @@
     rs = s.executeQuery("SELECT SUBSTR(c||v, 1, 4), COUNT(*) FROM DERBY_2960" +
     		" GROUP BY SUBSTR(c||v, 1, 4)");
     JDBC.assertFullResultSet(rs,new String[][] {{"dupl","1"}});
+    
+    //DERBY-2966
+    //Moving to insert row in a territory based db should not cause exception
+    ps = conn.prepareStatement("SELECT * FROM CUSTOMER FOR UPDATE",
+    		ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
+    rs = ps.executeQuery();
+    rs.moveToInsertRow();
+    rs.close();
+    ps.close();
+
 }
 
 private void setUpTable(Statement s) throws SQLException {



Mime
View raw message