db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r1535654 - in /db/derby/code/trunk/java/engine/org/apache/derby: iapi/services/io/ iapi/sql/dictionary/ impl/sql/execute/
Date Fri, 25 Oct 2013 08:22:25 GMT
Author: kahatlen
Date: Fri Oct 25 08:22:25 2013
New Revision: 1535654

URL: http://svn.apache.org/r1535654
Log:
DERBY-534: Support use of the WHEN clause in CREATE TRIGGER statements

Remove logic in the readExternal() and writeExternal() methods of
TriggerInfo and TriggerDescriptor that was originally put there for
compatibility between different Derby versions. Since these objects
are only persisted as part of a stored prepared statement, and Derby
always clears all stored prepared statements on version change, there
is no requirement that TriggerInfo and TriggerDescriptor instances
written by one Derby version must be possible to read by other Derby
versions.

Removed:
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/TriggerDescriptor_v10_10.java
Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/RegisteredFormatIds.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/StoredFormatIds.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/DataDescriptorGenerator.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/TriggerDescriptor.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TriggerInfo.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/RegisteredFormatIds.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/RegisteredFormatIds.java?rev=1535654&r1=1535653&r2=1535654&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/RegisteredFormatIds.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/RegisteredFormatIds.java
Fri Oct 25 08:22:25 2013
@@ -364,8 +364,8 @@ private static final    String[] TwoByte
         /* 312 */       "org.apache.derby.catalog.types.MethodAliasInfo",
         /* 313 */       "org.apache.derby.iapi.services.io.FormatableHashtable",
         /* 314 */       null,
-        /* 315 */       "org.apache.derby.iapi.sql.dictionary.TriggerDescriptor",
-        /* 316 */       "org.apache.derby.iapi.sql.dictionary.TriggerDescriptor_v10_10",
+        /* 315 */       null,
+        /* 316 */       "org.apache.derby.iapi.sql.dictionary.TriggerDescriptor",
         /* 317 */       "org.apache.derby.impl.sql.execute.TriggerInfo",
         /* 318 */       null,
         /* 319 */       null,

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/StoredFormatIds.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/StoredFormatIds.java?rev=1535654&r1=1535653&r2=1535654&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/StoredFormatIds.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/StoredFormatIds.java
Fri Oct 25 08:22:25 2013
@@ -374,15 +374,7 @@ public interface StoredFormatIds {
             (MIN_ID_2 + 320);
 
     /**
-     * Class org.apache.derby.impl.sql.catalog.TriggerDescriptor, used for
-     * trigger descriptors if the dictionary version is 10.11 or higher.
-     */
-    static public final int TRIGGER_DESCRIPTOR_V02_ID =
-            (MIN_ID_2 + 315);
-
-    /**
-     * Class org.apache.derby.impl.sql.catalog.TriggerDescriptor_v10_10, used
-     * for trigger descriptors if the dictionary version is 10.10 or lower.
+     * Class org.apache.derby.impl.sql.catalog.TriggerDescriptor.
      */
     static public final int TRIGGER_DESCRIPTOR_V01_ID =
             (MIN_ID_2 + 316);

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/DataDescriptorGenerator.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/DataDescriptorGenerator.java?rev=1535654&r1=1535653&r2=1535654&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/DataDescriptorGenerator.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/DataDescriptorGenerator.java
Fri Oct 25 08:22:25 2013
@@ -378,12 +378,7 @@ public class DataDescriptorGenerator 
         String              whenClauseText
 	) throws StandardException
 	{
-        if (dataDictionary.checkVersion(
-                DataDictionary.DD_VERSION_DERBY_10_11, null)) {
-            // The dictionary version is recent enough to support the WHEN
-            // clause (DERBY-534). Create a descriptor that uses the new
-            // format.
-            return new TriggerDescriptor(
+        return new TriggerDescriptor(
 					dataDictionary,
 					sd,
 					uuid,
@@ -405,31 +400,6 @@ public class DataDescriptorGenerator 
                     newReferencingName,
                     whenClauseText
 					);
-        }
-
-        // This is a soft-upgraded database whose dictionary version is 10.10
-        // or lower. Create a descriptor that uses the legacy format so that
-        // it can be read by older database versions.
-        return new TriggerDescriptor_v10_10(
-                dataDictionary,
-                sd,
-                uuid,
-                name,
-                eventMask,
-                isBefore,
-                isRow,
-                isEnabled,
-                td,
-                whenSPSId,
-                actionSPSId,
-                creationTimestamp,
-                referencedCols,
-                referencedColsInTriggerAction,
-                triggerDefinition,
-                referencingOld,
-                referencingNew,
-                oldReferencingName,
-                newReferencingName);
 	}
 		
 	/*

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/TriggerDescriptor.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/TriggerDescriptor.java?rev=1535654&r1=1535653&r2=1535654&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/TriggerDescriptor.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/TriggerDescriptor.java
Fri Oct 25 08:22:25 2013
@@ -905,16 +905,6 @@ public class TriggerDescriptor extends U
 	public void readExternal(ObjectInput in)
 		 throws IOException, ClassNotFoundException
 	{
-        readExternal_v10_10(in);
-        whenClauseText = (String) in.readObject();
-    }
-
-    /**
-     * {@code readExternal()} method to be used if the data dictionary
-     * version is 10.10 or lower.
-     */
-    void readExternal_v10_10(ObjectInput in)
-            throws IOException, ClassNotFoundException {
 		id = (UUID)in.readObject();
 		name = (String)in.readObject();
 		triggerSchemaId = (UUID)in.readObject();
@@ -948,7 +938,7 @@ public class TriggerDescriptor extends U
 		referencingNew = in.readBoolean();
 		oldReferencingName = (String)in.readObject();
 		newReferencingName = (String)in.readObject();
-		
+        whenClauseText = (String) in.readObject();
 	}
 
 	protected DataDictionary getDataDictionary()
@@ -979,15 +969,6 @@ public class TriggerDescriptor extends U
 	public void writeExternal( ObjectOutput out )
 		 throws IOException
 	{
-        writeExternal_v10_10(out);
-        out.writeObject(whenClauseText);
-    }
-
-    /**
-     * {@code writeExternal()} method to be used if the data dictionary
-     * version is 10.10 or lower.
-     */
-    void writeExternal_v10_10(ObjectOutput out) throws IOException {
 		if (SanityManager.DEBUG)
 		{
 			SanityManager.ASSERT(triggerSchemaId != null,
@@ -1034,6 +1015,7 @@ public class TriggerDescriptor extends U
 		out.writeBoolean(referencingNew);
 		out.writeObject(oldReferencingName);
 		out.writeObject(newReferencingName);
+        out.writeObject(whenClauseText);
 	}
  
 	/**
@@ -1042,7 +1024,7 @@ public class TriggerDescriptor extends U
 	 *	@return	the formatID of this class
 	 */
     public int getTypeFormatId() {
-        return StoredFormatIds.TRIGGER_DESCRIPTOR_V02_ID;
+        return StoredFormatIds.TRIGGER_DESCRIPTOR_V01_ID;
     }
 
 	/** @see TupleDescriptor#getDescriptorType */

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TriggerInfo.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TriggerInfo.java?rev=1535654&r1=1535653&r2=1535654&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TriggerInfo.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TriggerInfo.java Fri
Oct 25 08:22:25 2013
@@ -137,12 +137,6 @@ public final class TriggerInfo implement
 	public void writeExternal(ObjectOutput out) throws IOException
 	{
 		ArrayUtil.writeArray(out, triggerArray);
-
-        // Used to write an array of changed column numbers and an array
-        // with the names of the columns, but they are not used anymore.
-        // Write dummy values to preserve the format.
-        ArrayUtil.writeIntArray(out, (int[]) null);
-        ArrayUtil.writeArray(out, (String[]) null);
 	}
 
 	/**
@@ -158,10 +152,6 @@ public final class TriggerInfo implement
 	{
 		triggerArray = new TriggerDescriptor[ArrayUtil.readArrayLength(in)];
 		ArrayUtil.readArrayItems(in, triggerArray);
-
-        // Discard fields that are no longer used.
-        ArrayUtil.readIntArray(in);
-        ArrayUtil.readStringArray(in);
 	}
 	
 	/**



Mime
View raw message