Return-Path: Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: (qmail 86715 invoked from network); 22 Apr 2005 19:08:41 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 22 Apr 2005 19:08:41 -0000 Received: (qmail 83487 invoked by uid 500); 22 Apr 2005 19:09:07 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 83431 invoked by uid 500); 22 Apr 2005 19:09:07 -0000 Mailing-List: contact derby-commits-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Derby Development" Delivered-To: mailing list derby-commits@db.apache.org Received: (qmail 83376 invoked by uid 500); 22 Apr 2005 19:09:06 -0000 Delivered-To: apmail-incubator-derby-cvs@incubator.apache.org Received: (qmail 83359 invoked by uid 99); 22 Apr 2005 19:09:06 -0000 X-ASF-Spam-Status: No, hits=0.2 required=10.0 tests=NO_REAL_NAME X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Fri, 22 Apr 2005 12:09:06 -0700 Received: (qmail 86691 invoked by uid 65534); 22 Apr 2005 19:08:37 -0000 Message-ID: <20050422190837.86690.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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 -0000 To: derby-cvs@incubator.apache.org From: djd@apache.org X-Mailer: svnmailer-1.0.0-dev X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: djd Date: Fri Apr 22 12:08:35 2005 New Revision: 164269 URL: http://svn.apache.org/viewcvs?rev=3D164269&view=3Drev 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/m= onitor/Monitor.java incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalo= g/DD_Version.java incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalo= g/DataDictionaryImpl.java incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compil= e/CreateAliasNode.java Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/refe= rence/Property.java URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/o= rg/apache/derby/iapi/reference/Property.java?rev=3D164269&r1=3D164268&r2=3D= 164269&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- 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 {=20 =20 /** - 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 locat= ed + * in ${derby.system.home} if set, otherwise ${user.dir} + */ public static final String PROPERTIES_FILE =3D "derby.properties"; =20 =20 @@ -602,6 +602,13 @@ /* ** Upgrade */ +=09 + /** + * 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 =3D "derby.database.allowPreReleaseUpgrad= e"; =20 /** db2j.inRestore Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/serv= ices/monitor/Monitor.java URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/o= rg/apache/derby/iapi/services/monitor/Monitor.java?rev=3D164269&r1=3D164268= &r2=3D164269&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/services/m= onitor/Monitor.java (original) +++ incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/services/m= onitor/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; =20 import org.apache.derby.iapi.services.loader.InstanceGetter; =20 @@ -691,28 +692,23 @@ =20 /** 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 oldVer= sionInfo) throws StandardException { =20 boolean fullUpgrade =3D Boolean.valueOf(startParams.getProperty(org.apac= he.derby.iapi.reference.Attribute.UPGRADE_ATTR)).booleanValue(); =20 - if (true || !fullUpgrade) { + ProductVersionHolder engineVersion =3D Monitor.getMonitor().getEngineVer= sion(); =20 - ProductVersionHolder engineVersion =3D Monitor.getMonitor().getEngineVe= rsion(); - - if (engineVersion.isBeta() || engineVersion.isAlpha()) { - // soft upgrade not supported for beta. - throw StandardException.newException(SQLState.NO_UPGRADE, oldVersionIn= fo, engineVersion.getSimpleVersionString()); + if (engineVersion.isBeta() || engineVersion.isAlpha()) { + =09 + 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); } - =20 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/o= rg/apache/derby/impl/sql/catalog/DD_Version.java?rev=3D164269&r1=3D164268&r= 2=3D164269&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalo= g/DD_Version.java (original) +++ incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalo= g/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. +
+ Examples are fixes to catalog meta data, e.g. fix nullability of + a system column. + +
+ Upgrade items for 10.1 +
    +
  • None. +
* * @param tc transaction controller * @param fromMajorVersionNumber version of the on-disk database @@ -249,6 +257,12 @@ throws StandardException { =20 + /* + * 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. + *=20 + *=20 if (lastSoftUpgradeVersion <=3D DataDictionary.DD_VERSION_CS_5_1) { =20 @@ -262,12 +276,19 @@ DataDictionaryImpl.SYSSTATEMENTS_CATALOG_NUM); =20 } + */ =20 tc.setProperty(DataDictionary.SOFT_DATA_DICTIONARY_VERSION, this, true); } =20 /** Do full upgrade. Apply changes that can NOT be safely made in soft upgr= ade. + =09 +
+ Upgrade items for 10.1 +
    +
  • None. +
=20 * * @param tc transaction controller @@ -278,6 +299,18 @@ private void doFullUpgrade(TransactionController tc, int fromMajorVersion= Number) 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); =09 + } + + /* + * 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. +=09 if (fromMajorVersionNumber <=3D DataDictionary.DD_VERSION_CS_5_1) { // drop sps in SYSIBM, SYSIBM, recreate SYSIBM, SYSDUMMY1, populate SYS= DUMMY1, create procs @@ -292,6 +325,8 @@ bootingDictionary.create_SYSIBM_procedures(tc); bootingDictionary.createSystemSps(tc); } + =09 + */ } =20 /** @@ -593,9 +628,10 @@ } =09 /** + *=20 * 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 */ =20 + /* OLD Cloudscape 5.1 upgrade code. See applySafeChanges(). + private void modifySysTableNullability(TransactionController tc, int cata= logNum) 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/o= rg/apache/derby/impl/sql/catalog/DataDictionaryImpl.java?rev=3D164269&r1=3D= 164268&r2=3D164269&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalo= g/DataDictionaryImpl.java (original) +++ incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalo= g/DataDictionaryImpl.java Fri Apr 22 12:08:35 2005 @@ -365,7 +365,7 @@ public void boot(boolean create, Properties startParams)=20 throws StandardException { - softwareVersion =3D new DD_Version(this, DataDictionary.DD_VERSION_CS_10= _0); + softwareVersion =3D new DD_Version(this, DataDictionary.DD_VERSION_DERBY= _10_1); =20 /* There is a bootstrapping problem here. We would like to use * a language connection context to find the name of the system an= d 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.=20 =20 @param majorVersion Data Dictionary major version @param feature Non-null to throw an error, null to return the state of t= he 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/o= rg/apache/derby/impl/sql/compile/CreateAliasNode.java?rev=3D164269&r1=3D164= 268&r2=3D164269&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compil= e/CreateAliasNode.java (original) +++ incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compil= e/CreateAliasNode.java Fri Apr 22 12:08:35 2005 @@ -60,10 +60,10 @@ =20 public class CreateAliasNode extends CreateStatementNode { - String javaClassName; - String methodName; - char aliasType;=20 - boolean delimitedIdentifier; + private String javaClassName; + private String methodName; + private char aliasType;=20 + private boolean delimitedIdentifier; =20 private AliasInfo aliasInfo; =20 @@ -121,11 +121,24 @@ Object[] routineElements =3D (Object[]) aliasSpecificInfo; Object[] parameters =3D (Object[]) routineElements[0]; int paramCount =3D ((Vector) parameters[0]).size(); + =09 + // 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('(') !=3D -1) + { + getDataDictionary().checkVersion( + DataDictionary.DD_VERSION_DERBY_10_1, + "EXTERNAL NAME 'class.method()'"); + =09 + } =20 String[] names =3D null; TypeDescriptor[] types =3D null; int[] modes =3D null; - + =09 if (paramCount > DB2Limit.DB2_MAX_PARAMS_IN_STORED_PROCEDURE) throw StandardException.newException(SQLState.LANG_TOO_MANY_PARAMETER= S_FOR_STORED_PROC, String.valueOf(DB2Limit.DB2_MAX_PARAMS_IN_STORED_PROCEDURE), aliasN= ame, 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; } - =20 public String statementToString() {