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 rh...@apache.org on 2012/07/17 17:32:53 UTC

svn commit: r1362544 - in /db/derby/code/branches/10.9: ./ java/engine/org/apache/derby/impl/sql/LanguageDbPropertySetter.java java/testing/org/apache/derbyTesting/functionTests/tests/lang/SQLAuthorizationPropTest.java

Author: rhillegas
Date: Tue Jul 17 15:32:53 2012
New Revision: 1362544

URL: http://svn.apache.org/viewvc?rev=1362544&view=rev
Log:
DERBY-5838: Port 1356333 from trunk to 10.9 branch.

Modified:
    db/derby/code/branches/10.9/   (props changed)
    db/derby/code/branches/10.9/java/engine/org/apache/derby/impl/sql/LanguageDbPropertySetter.java
    db/derby/code/branches/10.9/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SQLAuthorizationPropTest.java

Propchange: db/derby/code/branches/10.9/
------------------------------------------------------------------------------
  Merged /db/derby/code/trunk:r1356333

Modified: db/derby/code/branches/10.9/java/engine/org/apache/derby/impl/sql/LanguageDbPropertySetter.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.9/java/engine/org/apache/derby/impl/sql/LanguageDbPropertySetter.java?rev=1362544&r1=1362543&r2=1362544&view=diff
==============================================================================
--- db/derby/code/branches/10.9/java/engine/org/apache/derby/impl/sql/LanguageDbPropertySetter.java (original)
+++ db/derby/code/branches/10.9/java/engine/org/apache/derby/impl/sql/LanguageDbPropertySetter.java Tue Jul 17 15:32:53 2012
@@ -30,6 +30,7 @@ import org.apache.derby.iapi.services.sa
 import org.apache.derby.iapi.services.context.ContextService;
 import org.apache.derby.iapi.error.StandardException;
 import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;
+import org.apache.derby.iapi.sql.dictionary.DataDictionary;
 import org.apache.derby.iapi.store.access.TransactionController;
 import java.io.Serializable;
 import java.util.Dictionary;
@@ -50,6 +51,13 @@ public class LanguageDbPropertySetter im
 		Dictionary		p
 	) throws StandardException 
 	{
+        // Can't change the dictionary version manually. That could make the database
+        // unbootable. See DERBY-5838.
+		if ( key.trim().equals( DataDictionary.CORE_DATA_DICTIONARY_VERSION ) )
+		{
+            throw StandardException.newException( SQLState.PROPERTY_UNSUPPORTED_CHANGE, key, value );
+        }
+        
 		// Disallow changing sqlAuthorization from true to false or null after
 		// switching to Standard authorization
 		if (key.trim().equals(Property.SQL_AUTHORIZATION_PROPERTY))

Modified: db/derby/code/branches/10.9/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SQLAuthorizationPropTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.9/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SQLAuthorizationPropTest.java?rev=1362544&r1=1362543&r2=1362544&view=diff
==============================================================================
--- db/derby/code/branches/10.9/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SQLAuthorizationPropTest.java (original)
+++ db/derby/code/branches/10.9/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SQLAuthorizationPropTest.java Tue Jul 17 15:32:53 2012
@@ -1,6 +1,6 @@
 /*
 *
-* Derby - Class org.apache.derbyTesting.functionTests.lang.SQLAuthorizationPropTest
+* Derby - Class org.apache.derbyTesting.functionTests.tests.lang.SQLAuthorizationPropTest
 *
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
@@ -171,4 +171,21 @@ public class SQLAuthorizationPropTest ex
         }
         
 	}
+
+	/**
+	 * Verify that you can't make the database unbootable by changing
+     * the database version. See DERBY-5838.
+	 */
+	public void test_5838() throws Exception
+    {
+        Statement stmt = createStatement();
+
+        assertStatementError
+            (
+             "XCY02",
+             stmt,
+             "call syscs_util.syscs_set_database_property( 'DataDictionaryVersion', 'foobar' )"
+             );
+    }
+    
 }