db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r566425 - in /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql: compile/CreateIndexNode.java compile/TableElementList.java execute/CreateIndexConstantAction.java execute/GenericConstantActionFactory.java
Date Thu, 16 Aug 2007 00:10:48 GMT
Author: djd
Date: Wed Aug 15 17:10:47 2007
New Revision: 566425

URL: http://svn.apache.org/viewvc?view=rev&rev=566425
Log:
DERBY-3008 Set forCreateTable state of CreateIndexConstantAction at compile time.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateIndexNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableElementList.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CreateIndexConstantAction.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/GenericConstantActionFactory.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateIndexNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateIndexNode.java?view=diff&rev=566425&r1=566424&r2=566425
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateIndexNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateIndexNode.java
Wed Aug 15 17:10:47 2007
@@ -288,7 +288,9 @@
         }
 
 
-		return	getGenericConstantActionFactory().getCreateIndexConstantAction(unique,
+		return	getGenericConstantActionFactory().getCreateIndexConstantAction(               
+                false, // not for CREATE TABLE
+                unique,
 											  indexType,
 											  sd.getSchemaName(),
 											  indexName.getTableName(),

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableElementList.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableElementList.java?view=diff&rev=566425&r1=566424&r2=566425
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableElementList.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableElementList.java
Wed Aug 15 17:10:47 2007
@@ -673,7 +673,9 @@
 			 */
 			if (constraintDN.requiresBackingIndex())
 			{
-				indexAction = genIndexAction(constraintDN.requiresUniqueIndex(),
+				indexAction = genIndexAction(
+                        forCreateTable,
+                        constraintDN.requiresUniqueIndex(),
 											 null, constraintDN, 
 											 columnNames, true, tableSd, tableName,
 											 constraintType, dd);
@@ -772,6 +774,7 @@
 	}
 
 	private IndexConstantAction genIndexAction(
+            boolean forCreateTable,
 										boolean	isUnique,
 										String indexName,
 										ConstraintDefinitionNode cdn,
@@ -787,6 +790,11 @@
 
 		if (constraintType == DataDictionary.DROP_CONSTRAINT)
 		{
+            if (SanityManager.DEBUG)
+            {
+                if (forCreateTable)
+                    SanityManager.THROWASSERT("DROP INDEX with forCreateTable true");
+            }
 			return	getGenericConstantActionFactory().getDropIndexConstantAction(
 									  null,
 									  indexName,
@@ -801,6 +809,7 @@
 			for (int i = 0; i < isAscending.length; i++)
 				isAscending[i] = true;
 			return	getGenericConstantActionFactory().getCreateIndexConstantAction(
+                    forCreateTable,
 									isUnique,
 									"BTREE", // indexType
 									sd.getSchemaName(),

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CreateIndexConstantAction.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CreateIndexConstantAction.java?view=diff&rev=566425&r1=566424&r2=566425
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CreateIndexConstantAction.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CreateIndexConstantAction.java
Wed Aug 15 17:10:47 2007
@@ -68,6 +68,12 @@
 
 class CreateIndexConstantAction extends IndexConstantAction
 {
+    /**
+     * Is this for a CREATE TABLE, i.e. it is
+     * for a constraint declared in a CREATE TABLE
+     * statement that requires a backing index.
+     */
+    private final boolean forCreateTable;
 
 	private boolean			unique;
 	private String			indexType;
@@ -84,6 +90,7 @@
 	/**
 	 *	Make the ConstantAction to create an index.
 	 *
+     *  @param forCreateTable Being executed within a CREATE TABLE statement
 	 *  @param unique		True means it will be a unique index
 	 *  @param indexType	The type of index (BTREE, for example)
 	 *  @param schemaName	the schema that table (and index) lives in.
@@ -97,6 +104,7 @@
 	 *  @param properties	The optional properties list associated with the index.
 	 */
 	CreateIndexConstantAction(
+            boolean forCreateTable,
 								boolean			unique,
 								String			indexType,
 								String			schemaName,
@@ -110,6 +118,7 @@
 								Properties		properties)
 	{
 		super(tableId, indexName, tableName, schemaName);
+        this.forCreateTable = forCreateTable;
 		this.unique = unique;
 		this.indexType = indexType;
 		this.columnNames = columnNames;
@@ -155,7 +164,6 @@
 	public void	executeConstantAction( Activation activation )
 						throws StandardException
 	{
-		boolean						forCreateTable;
 		TableDescriptor 			td;
 		UUID 						toid;
 		ColumnDescriptor			columnDescriptor;
@@ -173,9 +181,6 @@
 		DataDictionary dd = lcc.getDataDictionary();
 		DependencyManager dm = dd.getDependencyManager();
 		TransactionController tc = lcc.getTransactionExecute();
-
-		/* Remember whether or not we are doing a create table */
-		forCreateTable = activation.getForCreateTable();
 
 		/*
 		** Inform the data dictionary that we are about to write to it.

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/GenericConstantActionFactory.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/GenericConstantActionFactory.java?view=diff&rev=566425&r1=566424&r2=566425
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/GenericConstantActionFactory.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/GenericConstantActionFactory.java
Wed Aug 15 17:10:47 2007
@@ -194,6 +194,7 @@
 	/**
 	 *	Make the ConstantAction for a CREATE INDEX statement.
 	 *
+     *  @param forCreateTable Executed as part of a CREATE TABLE
 	 *  @param unique		True means it will be a unique index
 	 *  @param indexType	The type of index (BTREE, for example)
 	 *  @param schemaName			the schema that table (and index) lives in.
@@ -208,6 +209,7 @@
 	 */
 	public	CreateIndexConstantAction	getCreateIndexConstantAction
 	(
+        boolean forCreateTable,
 		boolean			unique,
 		String			indexType,
 		String			schemaName,
@@ -222,7 +224,7 @@
     )
 	{
 		return	new CreateIndexConstantAction
-			( unique, indexType, schemaName, indexName, tableName, tableId,
+			( forCreateTable, unique, indexType, schemaName, indexName, tableName, tableId,
 			  columnNames, isAscending, isConstraint,
 			  conglomerateUUID, properties );
 	}



Mime
View raw message