db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r164269 - /incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/reference /incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/services/monitor /incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog /incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile
Date Fri, 22 Apr 2005 19:08:36 GMT
Author: djd
Date: Fri Apr 22 12:08:35 2005
New Revision: 164269

URL: http://svn.apache.org/viewcvs?rev=164269&view=rev
Log:
Add language upgrade support from 10.0.
Add property derby.database.allowPreReleaseUpgrade to allow testing of
upgrade code while the code is marked as alpha/beta.
Add upgrade check for routines with method signatures to ensure such
routines cannot be created while running in soft upgrade mode against 10.0.

Modified:
    incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/reference/Property.java
    incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/services/monitor/Monitor.java
    incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DD_Version.java
    incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
    incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateAliasNode.java

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/reference/Property.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/reference/Property.java?rev=164269&r1=164268&r2=164269&view=diff
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/reference/Property.java (original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/reference/Property.java Fri
Apr 22 12:08:35 2005
@@ -43,9 +43,9 @@
 public interface Property { 
 
 	/**
-		Name of the file that contains system wide properties.
-		Has to be located in ${derby.system.home} if set, otherwise ${user.dir}
-	*/
+	 * Name of the file that contains system wide properties. Has to be located
+	 * in ${derby.system.home} if set, otherwise ${user.dir}
+	 */
 	public static final String PROPERTIES_FILE = "derby.properties";
 
 
@@ -602,6 +602,13 @@
 	/*
 	** Upgrade
 	*/
+	
+	/**
+	 * Allow database upgrade during alpha/beta time. Only intended
+	 * to be used to allow Derby developers to test their upgrade code.
+	 * Only supported as a system/application (derby.properties) property.
+	 */
+	String ALPHA_BETA_ALLOW_UPGRADE = "derby.database.allowPreReleaseUpgrade";
 	    
 	/**
 		db2j.inRestore

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/services/monitor/Monitor.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/services/monitor/Monitor.java?rev=164269&r1=164268&r2=164269&view=diff
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/services/monitor/Monitor.java
(original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/services/monitor/Monitor.java
Fri Apr 22 12:08:35 2005
@@ -28,6 +28,7 @@
 import org.apache.derby.iapi.services.info.ProductVersionHolder;
 import org.apache.derby.iapi.reference.EngineType;
 import org.apache.derby.iapi.reference.Attribute;
+import org.apache.derby.iapi.services.property.PropertyUtil;
 
 import org.apache.derby.iapi.services.loader.InstanceGetter;
 
@@ -691,28 +692,23 @@
 
 	/**
 		Single point for checking if an upgrade is allowed.
+		@return true a full upgrade has been requested, false soft upgrade mode is active.
 	 */
 	public static boolean isFullUpgrade(Properties startParams, String oldVersionInfo) throws
StandardException {
 
 		boolean fullUpgrade = Boolean.valueOf(startParams.getProperty(org.apache.derby.iapi.reference.Attribute.UPGRADE_ATTR)).booleanValue();
 
-		if (true || !fullUpgrade) {
+		ProductVersionHolder engineVersion = Monitor.getMonitor().getEngineVersion();
 
-			ProductVersionHolder engineVersion = Monitor.getMonitor().getEngineVersion();
-
-			if (engineVersion.isBeta() || engineVersion.isAlpha()) {
-				// soft upgrade not supported for beta.
-				throw StandardException.newException(SQLState.NO_UPGRADE, oldVersionInfo, engineVersion.getSimpleVersionString());
+		if (engineVersion.isBeta() || engineVersion.isAlpha()) {
+					
+			if (!PropertyUtil.getSystemBoolean(Property.ALPHA_BETA_ALLOW_UPGRADE))
+			{
+				//  upgrade not supported for alpha/beta.
+				throw StandardException.newException(SQLState.UPGRADE_UNSUPPORTED,
+						oldVersionInfo, engineVersion.getSimpleVersionString());
 			}
-
-			// Gandalf release does not support any soft or hard upgrade,
-			// remove this exception when upgrade support is added, and
-			// add back in the following code which has been commented out
-			// as it is currently unreachable.
-			throw StandardException.newException(
-				SQLState.LANG_CANT_UPGRADE_DATABASE, oldVersionInfo, engineVersion);
 		}
-
 
 		return fullUpgrade;
 	}

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DD_Version.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DD_Version.java?rev=164269&r1=164268&r2=164269&view=diff
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DD_Version.java
(original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DD_Version.java
Fri Apr 22 12:08:35 2005
@@ -236,8 +236,16 @@
 	/**
 		Apply changes that can safely be made in soft upgrade.
 		Any changes must not prevent the database from being re-booted
-		by the a Cloudscape engine at the older version fromMajorVersionNumber
-
+		by the a Derby engine at the older version fromMajorVersionNumber.
+		<BR>
+		Examples are fixes to catalog meta data, e.g. fix nullability of
+		a system column.
+
+		<BR>
+		<B>Upgrade items for 10.1</B>
+		<UL>
+		<LI> None.
+		</UL>
 	  *
 	  * @param	tc	transaction controller
 	  * @param	fromMajorVersionNumber	version of the on-disk database
@@ -249,6 +257,12 @@
 		throws StandardException
 	{
 
+		/*
+		 * OLD Cloudscape 5.1 upgrade code, Derby does not support
+		 * upgrade from Cloudscape 5.x databases. If it ever is changed
+		 * to do so, this code would be useful.
+		 * 
+		 * 
 		if (lastSoftUpgradeVersion <= DataDictionary.DD_VERSION_CS_5_1)
 		{
 
@@ -262,12 +276,19 @@
 					DataDictionaryImpl.SYSSTATEMENTS_CATALOG_NUM);
 
 		}
+		*/
 
 		tc.setProperty(DataDictionary.SOFT_DATA_DICTIONARY_VERSION, this, true);
 	}
 
 	/**
 		Do full upgrade.  Apply changes that can NOT be safely made in soft upgrade.
+		
+		<BR>
+		<B>Upgrade items for 10.1</B>
+		<UL>
+		<LI> None.
+		</UL>
 
 	  *
 	  * @param	tc	transaction controller
@@ -278,6 +299,18 @@
 	private	void	doFullUpgrade(TransactionController tc, int fromMajorVersionNumber)
 		throws StandardException
 	{
+		// Only supports upgrade from Derby 10.0 releases onwards
+		if (fromMajorVersionNumber < DataDictionary.DD_VERSION_CS_10_0)
+		{
+			throw StandardException.newException(SQLState.UPGRADE_UNSUPPORTED,
+					DD_Version.majorToString(fromMajorVersionNumber), this);			
+		}
+
+		/*
+		 * OLD Cloudscape 5.1 upgrade code, Derby does not support
+		 * upgrade from Cloudscape 5.x databases. If it ever is changed
+		 * to do so, this code would be useful.
+	
 		if (fromMajorVersionNumber <= DataDictionary.DD_VERSION_CS_5_1)
 		{
 			// drop sps in SYSIBM, SYSIBM, recreate SYSIBM, SYSDUMMY1, populate SYSDUMMY1, create
procs
@@ -292,6 +325,8 @@
 			bootingDictionary.create_SYSIBM_procedures(tc);
 			bootingDictionary.createSystemSps(tc);
 		}
+		
+		*/
 	}
 
 	/**
@@ -593,9 +628,10 @@
 	}
 	
 	/**
+	 * 
 	 * Modifies the nullability of the system table corresponding
 	 * to the received catalog number.
-	 *
+	 * OLD Cloudscape 5.1 upgrade code
 	 * @param tc			TransactionController.
 	 * @param catalogNum	The catalog number corresponding
 	 *  to the table for which we will modify the nullability.
@@ -608,6 +644,8 @@
 	 * @exception StandardException
 	 */
 
+	/* OLD Cloudscape 5.1 upgrade code. See applySafeChanges().
+
 	private void modifySysTableNullability(TransactionController tc, int catalogNum)
 	throws StandardException
 	{
@@ -624,9 +662,8 @@
 			bootingDictionary.upgrade_setNullability(rowFactory,
 				SYSSTATEMENTSRowFactory.SYSSTATEMENTS_LASTCOMPILED, true, tc);
 		}
-
 	}
-
+*/
 	/**
 		Check to see if a database has been upgraded to the required
 		level in order to use a language feature.

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java?rev=164269&r1=164268&r2=164269&view=diff
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
(original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
Fri Apr 22 12:08:35 2005
@@ -365,7 +365,7 @@
 	public void boot(boolean create, Properties startParams) 
 			throws StandardException
 	{
-		softwareVersion = new DD_Version(this, DataDictionary.DD_VERSION_CS_10_0);
+		softwareVersion = new DD_Version(this, DataDictionary.DD_VERSION_DERBY_10_1);
 
 		/* There is a bootstrapping problem here. We would like to use
          * a language connection context to find the name of the system and default
@@ -7985,7 +7985,7 @@
     }
 	/**
 		Check to see if a database has been upgraded to the required
-		level in order to use a langauge feature.
+		level in order to use a language feature. 
 
 		@param majorVersion Data Dictionary major version
 		@param feature Non-null to throw an error, null to return the state of the version match.

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateAliasNode.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateAliasNode.java?rev=164269&r1=164268&r2=164269&view=diff
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateAliasNode.java
(original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateAliasNode.java
Fri Apr 22 12:08:35 2005
@@ -60,10 +60,10 @@
 
 public class CreateAliasNode extends CreateStatementNode
 {
-	String				javaClassName;
-	String				methodName;
-	char				aliasType; 
-	boolean				delimitedIdentifier;
+	private String				javaClassName;
+	private String				methodName;
+	private char				aliasType; 
+	private boolean				delimitedIdentifier;
 
 	private AliasInfo aliasInfo;
 
@@ -121,11 +121,24 @@
 				Object[] routineElements = (Object[]) aliasSpecificInfo;
 				Object[] parameters = (Object[]) routineElements[0];
 				int paramCount = ((Vector) parameters[0]).size();
+				
+				// Support for Java signatures in Derby was added in 10.1
+				// Check to see the catalogs have been upgraded to 10.1 before
+				// accepting such a method name for a routine. Otherwise
+				// a routine that works in 10.1 soft upgrade mode would
+				// exist when running 10.0 but not resolve to anything.
+				if (this.methodName.indexOf('(') != -1)
+				{
+					getDataDictionary().checkVersion(
+							DataDictionary.DD_VERSION_DERBY_10_1,
+                            "EXTERNAL NAME 'class.method(<signature>)'");
+					
+				}
 
 				String[] names = null;
 				TypeDescriptor[] types = null;
 				int[] modes = null;
-
+				
 				if (paramCount > DB2Limit.DB2_MAX_PARAMS_IN_STORED_PROCEDURE)
 					throw StandardException.newException(SQLState.LANG_TOO_MANY_PARAMETERS_FOR_STORED_PROC,
 							String.valueOf(DB2Limit.DB2_MAX_PARAMS_IN_STORED_PROCEDURE), aliasName, String.valueOf(paramCount));
@@ -193,12 +206,6 @@
 				}
 		}
 	}
-
-	public	String	getAliasName() { return getRelativeName(); }
-    public	String	getJavaClassName() { return javaClassName; }
-    public	String	getMethodName() { return methodName; }
-    public	char	getAliasType() { return aliasType; }
-
 
 	public String statementToString()
 	{



Mime
View raw message