db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r160935 - incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary 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 Mon, 11 Apr 2005 19:01:19 GMT
Author: djd
Date: Mon Apr 11 12:01:17 2005
New Revision: 160935

URL: http://svn.apache.org/viewcvs?view=rev&rev=160935
Log:
Add some comments for upgraded related methods and new constant
for the 10.1 database format. This constant will be used in a future submission.

Modified:
    incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/DataDictionary.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/compile/sqlgrammar.jj

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/DataDictionary.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/DataDictionary.java?view=diff&r1=160934&r2=160935
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/DataDictionary.java
(original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/DataDictionary.java
Mon Apr 11 12:01:17 2005
@@ -74,15 +74,34 @@
 	public static final int DD_VERSION_CS_5_2			= 100;
 	/** Cloudscape 8.1 (Pre-Gandalf) System Catalog version */
 	public static final int DD_VERSION_CS_8_1			= 110;
-	/** Cloudscape 10.0 (Gandalf) System Catalog version */
+	/** Cloudscape/Derby 10.0 (Gandalf) System Catalog version */
 	public static final int DD_VERSION_CS_10_0			= 120;
 
+	/** Derby 10.1 System Catalog version */
+	public static final int DD_VERSION_DERBY_10_1		= 130;
+
 	// general info
 	public	static	final	String	DATABASE_ID = "derby.databaseID";
 
 	// version ids
+	/**
+	 * DataDictionaryVersion property indicates the updgrade level of the system catalogs.
+	 * Stored as a database property. Set to an instance of DD_Version with
+	 * the major number one of the DataDictionary.DD_* values.
+	 */
 	public	static	final	String	CORE_DATA_DICTIONARY_VERSION = "DataDictionaryVersion";
+	/**
+	 * CreateDataDictionaryVersion property indicates the level of the system catalogs,
+	 * at the time of database creation.
+	 * Stored as a database property. Set to an instance of DD_Version.
+	 */
 	public	static	final	String	CREATE_DATA_DICTIONARY_VERSION = "CreateDataDictionaryVersion";
+	/**
+	 * derby.softDataDictionaryVersion property indicates the soft upgrade level of the system
catalogs.
+	 * Soft upgrade will sometime make minor changes to the system catalogs that can be safely
consumed by
+	 * earlier versions, such as correcting values.
+	 * Stored as a database property. Set to an instance of DD_Version.
+	 */
 	public  static  final   String  SOFT_DATA_DICTIONARY_VERSION = "derby.softDataDictionaryVersion";
     public  static  final   String  PROPERTY_CONGLOMERATE_VERSION = "PropertyConglomerateVersion";
 
@@ -1493,8 +1512,27 @@
 	/**
 		Check to see if a database has been upgraded to the required
 		level in order to use a langauge feature that is.
+		<P>
+		This is used to ensure new functionality that would lead on disk
+		information not understood by a previous release is not executed
+		while in soft upgrade mode. Ideally this is called at compile time
+		and the parser has a utility method to enable easy use at parse time.
+		<P>
+		To use this method, a feature implemented in a certain release (DataDictionary version)
+		would call it with the constant matching the release. E.g. for a new feature added
+		in 10.1, a call such as 
+		<PRE>
+		// check and throw an exception if the database is not at 10.1
+		dd.checkVersion(DataDictionary.DD_VERSION_DERBY_10_1, "NEW FEATURE NAME");
+		
+		</PRE>
+		This call would occur during the compile time, usually indirectly through
+		the parser utility method, but direct calls can be made during QueryNode initialization,
+		or even at bind time.
+		<BR>
+		It is not expected that this method would be called at execution time.
 
-		@param majorVersion Data Dictionary major version
+		@param majorVersion Data Dictionary major version (DataDictionary.DD_ constant)
 		@param feature Non-null to throw an error, null to return the state of the version match.
 
 		@return True if the database has been upgraded to the required level, false otherwise.

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?view=diff&r1=160934&r2=160935
==============================================================================
--- 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
Mon Apr 11 12:01:17 2005
@@ -143,6 +143,8 @@
 			return "8.1";
 		case DataDictionary.DD_VERSION_CS_10_0:
 			return "10.0";
+		case DataDictionary.DD_VERSION_DERBY_10_1:
+			return "10.1";
 		default:
 			return null;
 		}

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj?view=diff&r1=160934&r2=160935
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj
(original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj
Mon Apr 11 12:01:17 2005
@@ -281,6 +281,19 @@
 										LanguageConnectionContext.CONTEXT_ID);
 	}
 
+	/**
+		Utility method for checking that the underlying database has been
+		upgraded to the required level to use this functionality. Used to
+		disallow SQL statements that would leave on-disk formats that would
+		not be understood by a engine that matches the current upgrade level
+		of the database. Throws an exception if the database is not a the required level.
+		<P>
+		Typically used for CREATE statements at the parser level. Called usually just
+		before the node is created, or can be called in just a partial syntax fragment
+		
+		@param majorVersion Data Dictionary major version (DataDictionary.DD_ constant)
+		@param feature SQL Feature name, for error text.
+	*/
 	private void checkVersion(int version, String feature) throws StandardException
 	{
 		getLanguageConnectionContext().getDataDictionary().checkVersion(



Mime
View raw message