You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by dj...@apache.org on 2007/08/14 23:44:52 UTC
svn commit: r565930 - in
/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql: compile/ execute/
Author: djd
Date: Tue Aug 14 14:44:51 2007
New Revision: 565930
URL: http://svn.apache.org/viewvc?view=rev&rev=565930
Log:
DERBY-3008 (partial) Create a boolean forCreateTable flag in the CrreateConstraintConstantAction (set at compile time). Activation still has such a field, will be removed in future changes.
Modified:
db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/AlterTableNode.java
db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateTableNode.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/CreateConstraintConstantAction.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/AlterTableNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/AlterTableNode.java?view=diff&rev=565930&r1=565929&r2=565930
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/AlterTableNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/AlterTableNode.java Tue Aug 14 14:44:51 2007
@@ -375,7 +375,7 @@
*
* @exception StandardException Thrown on failure
*/
- public void prepConstantAction() throws StandardException
+ private void prepConstantAction() throws StandardException
{
if (tableElementList != null)
{
@@ -388,7 +388,7 @@
{
conActions = new ConstraintConstantAction[numConstraints];
- tableElementList.genConstraintActions(conActions, getRelativeName(), schemaDescriptor,
+ tableElementList.genConstraintActions(false, conActions, getRelativeName(), schemaDescriptor,
getDataDictionary());
}
}
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateTableNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateTableNode.java?view=diff&rev=565930&r1=565929&r2=565930
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateTableNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateTableNode.java Tue Aug 14 14:44:51 2007
@@ -487,7 +487,7 @@
conActions =
new CreateConstraintConstantAction[numConstraints];
- coldefs.genConstraintActions(
+ coldefs.genConstraintActions(true,
conActions, getRelativeName(), sd, getDataDictionary());
}
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=565930&r1=565929&r2=565930
==============================================================================
--- 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 Tue Aug 14 14:44:51 2007
@@ -616,6 +616,7 @@
/**
* Fill in the ConstraintConstantAction[] for this create/alter table.
*
+ * @param forCreateTable ConstraintConstantAction is for a create table.
* @param conActions The ConstraintConstantAction[] to be filled in.
* @param tableName The name of the Table being created.
* @param tableSd The schema for that table.
@@ -623,7 +624,7 @@
*
* @exception StandardException Thrown on failure
*/
- void genConstraintActions(
+ void genConstraintActions(boolean forCreateTable,
ConstraintConstantAction[] conActions,
String tableName,
SchemaDescriptor tableSd,
@@ -680,6 +681,11 @@
if (constraintType == DataDictionary.DROP_CONSTRAINT)
{
+ if (SanityManager.DEBUG)
+ {
+ // Can't drop constraints on a create table.
+ SanityManager.ASSERT(!forCreateTable);
+ }
conActions[conActionIndex] =
getGenericConstantActionFactory().
getDropConstraintConstantAction(
@@ -723,7 +729,8 @@
getCreateConstraintConstantAction(
constraintName,
constraintType,
- tableName,
+ forCreateTable,
+ tableName,
((td != null) ? td.getUUID() : (UUID) null),
tableSd.getSchemaName(),
columnNames,
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CreateConstraintConstantAction.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CreateConstraintConstantAction.java?view=diff&rev=565930&r1=565929&r2=565930
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CreateConstraintConstantAction.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CreateConstraintConstantAction.java Tue Aug 14 14:44:51 2007
@@ -65,7 +65,9 @@
public class CreateConstraintConstantAction extends ConstraintConstantAction
{
- String[] columnNames;
+ private final boolean forCreateTable;
+
+ private String[] columnNames;
private String constraintText;
private ConstraintInfo otherConstraintInfo;
@@ -87,6 +89,7 @@
*
* @param constraintName Constraint name.
* @param constraintType Constraint type.
+ * @param forCreateTable Constraint is being added for a CREATE TABLE
* @param tableName Table name.
* @param tableId UUID of table.
* @param schemaName the schema that table and constraint lives in.
@@ -103,6 +106,7 @@
CreateConstraintConstantAction(
String constraintName,
int constraintType,
+ boolean forCreateTable,
String tableName,
UUID tableId,
String schemaName,
@@ -115,6 +119,7 @@
{
super(constraintName, constraintType, tableName,
tableId, schemaName, indexAction);
+ this.forCreateTable = forCreateTable;
this.columnNames = columnNames;
this.constraintText = constraintText;
this.enabled = enabled;
@@ -154,7 +159,6 @@
public void executeConstantAction( Activation activation )
throws StandardException
{
- boolean forCreateTable;
ConglomerateDescriptor conglomDesc = null;
ConglomerateDescriptor[] conglomDescs = null;
ConstraintDescriptor conDesc = null;
@@ -175,9 +179,6 @@
TransactionController tc = lcc.getTransactionExecute();
cf = lcc.getLanguageConnectionFactory().getClassFactory();
-
- /* 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=565930&r1=565929&r2=565930
==============================================================================
--- 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 Tue Aug 14 14:44:51 2007
@@ -156,6 +156,7 @@
*
* @param constraintName Constraint name.
* @param constraintType Constraint type.
+ * @param forCreateTable True if for a CREATE TABLE
* @param tableName Table name.
* @param tableId UUID of table.
* @param schemaName Schema that table lives in.
@@ -171,6 +172,7 @@
(
String constraintName,
int constraintType,
+ boolean forCreateTable,
String tableName,
UUID tableId,
String schemaName,
@@ -183,7 +185,7 @@
)
{
return new CreateConstraintConstantAction
- ( constraintName, constraintType, tableName,
+ ( constraintName, constraintType, forCreateTable, tableName,
tableId, schemaName, columnNames, indexAction, constraintText,
enabled, otherConstraint, providerInfo );
}