--- /dev/null
+/*\r
+\r
+ Derby - Class org.apache.derby.impl.sql.execute.GenericConstantActionFactory\r
+\r
+ Licensed to the Apache Software Foundation (ASF) under one or more\r
+ contributor license agreements. See the NOTICE file distributed with\r
+ this work for additional information regarding copyright ownership.\r
+ The ASF licenses this file to you under the Apache License, Version 2.0\r
+ (the "License"); you may not use this file except in compliance with\r
+ the License. You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+ Unless required by applicable law or agreed to in writing, software\r
+ distributed under the License is distributed on an "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ See the License for the specific language governing permissions and\r
+ limitations under the License.\r
+\r
+ */\r
+\r
+package org.apache.derby.impl.sql.execute;\r
+\r
+import org.apache.derby.iapi.error.StandardException;\r
+\r
+import org.apache.derby.iapi.services.context.ContextService;\r
+\r
+import org.apache.derby.iapi.sql.conn.Authorizer;\r
+import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;\r
+\r
+import org.apache.derby.iapi.sql.ResultDescription;\r
+\r
+import org.apache.derby.iapi.sql.execute.ConstantAction;\r
+import org.apache.derby.iapi.sql.execute.ExecIndexRow;\r
+import org.apache.derby.iapi.sql.dictionary.ConstraintDescriptorList;\r
+import org.apache.derby.iapi.sql.dictionary.GenericDescriptorList;\r
+import org.apache.derby.iapi.sql.dictionary.IndexRowGenerator;\r
+import org.apache.derby.iapi.sql.dictionary.TableDescriptor;\r
+import org.apache.derby.iapi.sql.dictionary.SchemaDescriptor;\r
+\r
+import org.apache.derby.iapi.sql.execute.ExecRow;\r
+\r
+import org.apache.derby.iapi.sql.depend.ProviderInfo;\r
+\r
+import org.apache.derby.iapi.store.access.StaticCompiledOpenConglomInfo;\r
+\r
+import org.apache.derby.iapi.services.sanity.SanityManager;\r
+\r
+import org.apache.derby.iapi.types.RowLocation;\r
+\r
+import org.apache.derby.catalog.UUID;\r
+import org.apache.derby.catalog.AliasInfo;\r
+\r
+import org.apache.derby.iapi.services.io.FormatableBitSet;\r
+\r
+import java.util.List;\r
+import java.util.Properties;\r
+\r
+import java.sql.Timestamp;\r
+\r
+/**\r
+ * Factory for creating ConstantActions.\r
+ *\r
+ * <P>Implemetation note: For most operations, the ResultSetFactory\r
+ * determines if the operation is allowed in a readonly/target database.\r
+ * Because we perform JAR add/drop/replace with a utility rather than\r
+ * using normal language processing we never get a result set for these\r
+ * operations. For this reason, the ConstantActionFactory rather than\r
+ * the ResultSetFactory checks if the these operations are allowed.\r
+ *\r
+ */\r
+public class GenericConstantActionFactory\r
+{\r
+ ///////////////////////////////////////////////////////////////////////\r
+ //\r
+ // CONSTRUCTORS\r
+ //\r
+ ///////////////////////////////////////////////////////////////////////\r
+ public GenericConstantActionFactory()\r
+ {\r
+ }\r
+\r
+ ///////////////////////////////////////////////////////////////////////\r
+ //\r
+ // CONSTANT ACTION MANUFACTORIES\r
+ //\r
+ ///////////////////////////////////////////////////////////////////////\r
+\r
+ /**\r
+ * Get ConstantAction for SET CONSTRAINTS statement.\r
+ *\r
+ * @param cdl the constraints to set, if null,\r
+ * we'll go ahead and set them all\r
+ * @param enable if true, turn them on, if false\r
+ * disable them\r
+ * @param unconditionallyEnforce Replication sets this to true at\r
+ * the end of REFRESH. This forces us\r
+ * to run the included foreign key constraints even\r
+ * if they're already marked ENABLED.\r
+ * @param ddlList Replication list of actions to propagate,\r
+ * null unless a replication source\r
+ */\r
+ public ConstantAction getSetConstraintsConstantAction\r
+ (\r
+ ConstraintDescriptorList cdl,\r
+ boolean enable,\r
+ boolean unconditionallyEnforce,\r
+ Object[] ddlList\r
+ )\r
+ {\r
+ // ignore rep arg\r
+ return new SetConstraintsConstantAction(cdl, enable, unconditionallyEnforce);\r
+ }\r
+\r
+\r
+ /**\r
+ * Make the AlterAction for an ALTER TABLE statement.\r
+ *\r
+ * @param sd descriptor for the schema that table lives in.\r
+ * @param tableName Name of table.\r
+ * @param tableId UUID of table.\r
+ * @param tableConglomerateId heap conglomerate id of table\r
+ * @param tableType Type of table (e.g., BASE).\r
+ * @param columnInfo Information on all the columns in the table.\r
+ * @param constraintActions ConstraintConstantAction[] for constraints\r
+ * @param lockGranularity The lock granularity.\r
+ * @param compressTable Whether or not this is a compress table\r
+ * @param behavior drop behavior of dropping column\r
+ * @param sequential If compress table/drop column, whether or not sequential\r
+ */\r
+ public ConstantAction getAlterTableConstantAction\r
+ (\r
+ SchemaDescriptor sd,\r
+ String tableName,\r
+ UUID tableId,\r
+ long tableConglomerateId,\r
+ int tableType,\r
+ ColumnInfo[] columnInfo,\r
+ ConstraintConstantAction[] constraintActions,\r
+\r
+ char lockGranularity,\r
+ boolean compressTable,\r
+ int behavior,\r
+ boolean sequential,\r
+ boolean truncateTable\r
+ )\r
+ {\r
+ return new AlterTableConstantAction( sd, tableName, tableId, tableConglomerateId, \r
+ tableType, columnInfo, constraintActions, \r
+ lockGranularity, compressTable,\r
+ behavior, sequential, truncateTable);\r
+ }\r
+\r
+ /**\r
+ * Make a ConstantAction for a constraint.\r
+ *\r
+ * @param constraintName Constraint name.\r
+ * @param constraintType Constraint type.\r
+ * @param tableName Table name.\r
+ * @param tableId UUID of table.\r
+ * @param schemaName Schema that table lives in.\r
+ * @param columnNames String[] for column names\r
+ * @param indexAction IndexConstantAction for constraint (if necessary)\r
+ * @param constraintText Text for check constraint\r
+ * @param enabled Should the constraint be created as enabled \r
+ * (enabled == true), or disabled (enabled == false).\r
+ * @param otherConstraint The referenced constraint, if a foreign key constraint\r
+ * @param providerInfo Information on all the Providers\r
+ */\r
+ public CreateConstraintConstantAction getCreateConstraintConstantAction\r
+ (\r
+ String constraintName,\r
+ int constraintType,\r
+ String tableName,\r
+ UUID tableId,\r
+ String schemaName,\r
+ String[] columnNames,\r
+ IndexConstantAction indexAction,\r
+ String constraintText,\r
+ boolean enabled,\r
+ ConstraintInfo otherConstraint,\r
+ ProviderInfo[] providerInfo\r
+ )\r
+ {\r
+ return new CreateConstraintConstantAction\r
+ ( constraintName, constraintType, tableName, \r
+ tableId, schemaName, columnNames, indexAction, constraintText, \r
+ enabled, otherConstraint, providerInfo );\r
+ }\r
+\r
+\r
+ /**\r
+ * Make the ConstantAction for a CREATE INDEX statement.\r
+ *\r
+ * @param unique True means it will be a unique index\r
+ * @param indexType The type of index (BTREE, for example)\r
+ * @param schemaName the schema that table (and index) lives in.\r
+ * @param indexName Name of the index\r
+ * @param tableName Name of table the index will be on\r
+ * @param tableId UUID of table.\r
+ * @param columnNames Names of the columns in the index, in order\r
+ * @param isAscending Array of booleans telling asc/desc on each column\r
+ * @param isConstraint TRUE if index is backing up a constraint, else FALSE\r
+ * @param conglomerateUUID ID of conglomerate\r
+ * @param properties The optional properties list associated with the index.\r
+ */\r
+ public CreateIndexConstantAction getCreateIndexConstantAction\r
+ (\r
+ boolean unique,\r
+ String indexType,\r
+ String schemaName,\r
+ String indexName,\r
+ String tableName,\r
+ UUID tableId,\r
+ String[] columnNames,\r
+ boolean[] isAscending,\r
+ boolean isConstraint,\r
+ UUID conglomerateUUID,\r
+ Properties properties\r
+ )\r
+ {\r
+ return new CreateIndexConstantAction\r
+ ( unique, indexType, schemaName, indexName, tableName, tableId,\r
+ columnNames, isAscending, isConstraint,\r
+ conglomerateUUID, properties );\r
+ }\r
+\r
+\r
+ /**\r
+ * Make the ConstantAction for a CREATE ALIAS statement.\r
+ *\r
+ * @param aliasName Name of alias.\r
+ * @param schemaName Alias's schema. \r
+ * @param javaClassName Name of java class.\r
+ * @param aliasType The alias type\r
+ */\r
+ public ConstantAction getCreateAliasConstantAction\r
+ (\r
+ String aliasName,\r
+ String schemaName,\r
+ String javaClassName,\r
+ AliasInfo aliasInfo,\r
+ char aliasType)\r
+ {\r
+ return new CreateAliasConstantAction\r
+ (aliasName, schemaName, javaClassName, aliasInfo, aliasType );\r
+ }\r
+\r
+ /**\r
+ * Make the ConstantAction for a CREATE SCHEMA statement.\r
+ *\r
+ * @param schemaName Name of table.\r
+ * @param aid Authorizaton id\r
+ */\r
+ public ConstantAction getCreateSchemaConstantAction\r
+ (\r
+ String schemaName,\r
+ String aid)\r
+ {\r
+ return new CreateSchemaConstantAction(schemaName, aid);\r
+ }\r
+\r
+ /**\r
+ * Make the ConstantAction for a CREATE TABLE statement.\r
+ *\r
+ * @param schemaName name for the schema that table lives in.\r
+ * @param tableName Name of table.\r
+ * @param tableType Type of table (e.g., BASE, global temporary table).\r
+ * @param columnInfo Information on all the columns in the table.\r
+ * (REMIND tableDescriptor ignored)\r
+ * @param constraintActions CreateConstraintConstantAction[] for constraints\r
+ * @param properties Optional table properties\r
+ * @param lockGranularity The lock granularity.\r
+ * @param onCommitDeleteRows If true, on commit delete rows else on commit preserve rows of temporary table.\r
+ * @param onRollbackDeleteRows If true, on rollback, delete rows from temp tables which were logically modified. true is the only supported value\r
+ */\r
+ public ConstantAction getCreateTableConstantAction\r
+ (\r
+ String schemaName,\r
+ String tableName,\r
+ int tableType,\r
+ ColumnInfo[] columnInfo,\r
+ CreateConstraintConstantAction[] constraintActions,\r
+ Properties properties,\r
+ char lockGranularity,\r
+ boolean onCommitDeleteRows,\r
+ boolean onRollbackDeleteRows)\r
+ {\r
+ return new CreateTableConstantAction( schemaName, tableName, tableType, columnInfo,\r
+ constraintActions, properties,\r
+ lockGranularity, onCommitDeleteRows, onRollbackDeleteRows);\r
+ }\r
+\r
+ /**\r
+ * Make the ConstantAction for a savepoint statement (ROLLBACK savepoint, RELASE savepoint and SAVEPOINT).\r
+ *\r
+ * @param savepointName name for the savepoint.\r
+ * @param statementType Type of savepoint statement ie rollback, release or set savepoint\r
+ */\r
+ public ConstantAction getSavepointConstantAction\r
+ (\r
+ String savepointName,\r
+ int statementType)\r
+ {\r
+ return new SavepointConstantAction( savepointName, statementType);\r
+ }\r
+\r
+\r
+ /**\r
+ * Make the ConstantAction for a CREATE VIEW statement.\r
+ *\r
+ * @param schemaName Name of the schema that table lives in.\r
+ * @param tableName Name of table.\r
+ * @param tableType Type of table (in this case TableDescriptor.VIEW_TYPE).\r
+ * @param viewText Text of query expression for view definition\r
+ * @param checkOption Check option type\r
+ * @param columnInfo Information on all the columns in the table.\r
+ * @param providerInfo Information on all the Providers\r
+ * @param compSchemaId ID of schema in which the view is to be bound\r
+ * when accessed in the future.\r
+ * (REMIND tableDescriptor ignored)\r
+ */\r
+ public ConstantAction getCreateViewConstantAction\r
+ (\r
+ String schemaName,\r
+ String tableName,\r
+ int tableType,\r
+ String viewText,\r
+ int checkOption,\r
+ ColumnInfo[] columnInfo,\r
+ ProviderInfo[] providerInfo,\r
+ UUID compSchemaId)\r
+ {\r
+ return new CreateViewConstantAction( schemaName, tableName, tableType, \r
+ viewText, checkOption, columnInfo,\r
+ providerInfo, compSchemaId );\r
+ }\r
+\r
+\r
+\r
+ /**\r
+ * Make the ConstantAction for a Replicated DELETE statement.\r
+ *\r
+ * @param conglomId Conglomerate ID.\r
+ * @param tableType type of this table\r
+ * @param heapSCOCI StaticCompiledOpenConglomInfo for heap.\r
+ * @param irgs Index descriptors\r
+ * @param indexCIDS Conglomerate IDs of indices\r
+ * @param indexSCOCIs StaticCompiledOpenConglomInfos for indexes.\r
+ * @param emptyHeapRow Template for heap row.\r
+ * @param deferred True means deferred delete\r
+ * @param tableIsPublished true if table is published\r
+ * @param tableID table id\r
+ * @param lockMode The lock mode to use\r
+ * (row or table, see TransactionController)\r
+ * @param keySignature signature for the key(null for source)\r
+ * @param keyPositions positions of primary key columns in base row\r
+ * @param keyConglomId conglomerate id for the key\r
+ * (-1 for the souce)\r
+ * @param schemaName schemaName(null for source)\r
+ * @param tableName tableName(null for source)\r
+ * @param resultDescription A description of the columns in the row\r
+ * to be deleted. Only set in replication or during cascade Delete.\r
+ * @param fkInfo Array of structures containing foreign key \r
+ * info, if any (may be null)\r
+ * @param triggerInfo Array of structures containing trigger\r
+ * info, if any (may be null)\r
+\r
+ * @param numColumns Number of columns to read\r
+ * @param dependencyId UUID for dependency system\r
+ * @param baseRowReadList Map of columns read in. 1 based.\r
+ * @param baseRowReadMap BaseRowReadMap[heapColId]->ReadRowColumnId.\r
+ * @param streamStorableHeapColIds Null for non rep. (0 based)\r
+ * @param singleRowSource Whether or not source is a single row source\r
+ *\r
+ * @exception StandardException Thrown on failure\r
+ */\r
+ public ConstantAction getDeleteConstantAction\r
+ (\r
+ long conglomId,\r
+ int tableType,\r
+ StaticCompiledOpenConglomInfo heapSCOCI,\r
+ IndexRowGenerator[] irgs,\r
+ long[] indexCIDS,\r
+ StaticCompiledOpenConglomInfo[] indexSCOCIs,\r
+ ExecRow emptyHeapRow,\r
+ boolean deferred,\r
+ boolean tableIsPublished,\r
+ UUID tableID,\r
+ int lockMode,\r
+ Object deleteToken,\r
+ Object keySignature,\r
+ int[] keyPositions,\r
+ long keyConglomId,\r
+ String schemaName,\r
+ String tableName,\r
+ ResultDescription resultDescription,\r
+ FKInfo[] fkInfo,\r
+ TriggerInfo triggerInfo,\r
+ FormatableBitSet baseRowReadList,\r
+ int[] baseRowReadMap,\r
+ int[] streamStorableHeapColIds,\r
+ int numColumns,\r
+ UUID dependencyId,\r
+ boolean singleRowSource,\r
+ ConstantAction[] dependentConstantActions\r
+ )\r
+ throws StandardException\r
+ {\r
+ // ignore replication args, which should be null\r
+ return new DeleteConstantAction(\r
+ conglomId,\r
+ heapSCOCI,\r
+ irgs,\r
+ indexCIDS,\r
+ indexSCOCIs,\r
+ emptyHeapRow,\r
+ deferred,\r
+ tableID,\r
+ lockMode,\r
+ fkInfo,\r
+ triggerInfo,\r
+ baseRowReadList,\r
+ baseRowReadMap,\r
+ streamStorableHeapColIds,\r
+ numColumns,\r
+ singleRowSource,\r
+ resultDescription,\r
+ dependentConstantActions\r
+ );\r
+ }\r
+\r
+\r
+ /**\r
+ * Make ConstantAction to drop a constraint.\r
+ *\r
+ * @param constraintName Constraint name.\r
+ * @param constraintSchemaName Constraint Schema Name\r
+ * @param tableName Table name.\r
+ * @param tableId UUID of table.\r
+ * @param tableSchemaName the schema that table lives in.\r
+ * @param indexAction IndexConstantAction for constraint (if necessary)\r
+ * @param behavior The drop behavior (e.g. StatementType.RESTRICT)\r
+ * @param verifyType Verify that the constraint is of this type.\r
+ */\r
+ public ConstraintConstantAction getDropConstraintConstantAction\r
+ (\r
+ String constraintName,\r
+ String constraintSchemaName,\r
+ String tableName,\r
+ UUID tableId,\r
+ String tableSchemaName,\r
+ IndexConstantAction indexAction,\r
+ int behavior,\r
+ int verifyType\r
+ )\r
+ {\r
+ return new DropConstraintConstantAction( constraintName, constraintSchemaName, tableName, \r
+ tableId, tableSchemaName, indexAction, behavior, verifyType);\r
+ }\r
+\r
+\r
+ /**\r
+ * Make the ConstantAction for a DROP INDEX statement.\r
+ *\r
+ *\r
+ * @param fullIndexName Fully qualified index name\r
+ * @param indexName Index name.\r
+ * @param tableName The table name\r
+ * @param schemaName Schema that index lives in.\r
+ * @param tableId UUID for table\r
+ * @param tableConglomerateId heap conglomerate ID for table\r
+ *\r
+ */\r
+ public DropIndexConstantAction getDropIndexConstantAction\r
+ (\r
+ String fullIndexName,\r
+ String indexName,\r
+ String tableName,\r
+ String schemaName,\r
+ UUID tableId,\r
+ long tableConglomerateId\r
+ )\r
+ {\r
+ return new DropIndexConstantAction( fullIndexName, indexName, tableName, schemaName,\r
+ tableId, tableConglomerateId );\r
+ }\r
+\r
+\r
+ /**\r
+ * Make the ConstantAction for a DROP ALIAS statement.\r
+ *\r
+ *\r
+ * @param aliasName Alias name.\r
+ * @param aliasType Alias type.\r
+ *\r
+ */\r
+ public ConstantAction getDropAliasConstantAction(SchemaDescriptor sd, String aliasName, char aliasType)\r
+ {\r
+ return new DropAliasConstantAction(sd, aliasName, aliasType );\r
+ }\r
+\r
+ /**\r
+ * Make the ConstantAction for a DROP TABLE statement.\r
+ *\r
+ * @param schemaName Table name.\r
+ *\r
+ */\r
+ public ConstantAction getDropSchemaConstantAction(String schemaName)\r
+ {\r
+ return new DropSchemaConstantAction( schemaName );\r
+ }\r
+\r
+\r
+ /**\r
+ * Make the ConstantAction for a DROP TABLE statement.\r
+ *\r
+ *\r
+ * @param fullTableName Fully qualified table name\r
+ * @param tableName Table name.\r
+ * @param sd Schema that table lives in.\r
+ * @param conglomerateNumber Conglomerate number for heap\r
+ * @param tableId UUID for table\r
+ * @param behavior drop behavior, CASCADE, RESTRICT or DEFAULT\r
+ *\r
+ */\r
+ public ConstantAction getDropTableConstantAction\r
+ (\r
+ String fullTableName,\r
+ String tableName,\r
+ SchemaDescriptor sd,\r
+ long conglomerateNumber,\r
+ UUID tableId,\r
+ int behavior\r
+ )\r
+ {\r
+ return new DropTableConstantAction( fullTableName, tableName, sd, conglomerateNumber, tableId, behavior );\r
+ }\r
+\r
+\r
+ /**\r
+ * Make the ConstantAction for a DROP VIEW statement.\r
+ *\r
+ *\r
+ * @param fullTableName Fully qualified table name\r
+ * @param tableName Table name.\r
+ * @param sd Schema that view lives in.\r
+ *\r
+ */\r
+ public ConstantAction getDropViewConstantAction\r
+ (\r
+ String fullTableName,\r
+ String tableName,\r
+ SchemaDescriptor sd\r
+ )\r
+ {\r
+ return new DropViewConstantAction( fullTableName, tableName, sd );\r
+ }\r
+\r
+ /**\r
+ * Make the ConstantAction for a RENAME TABLE/COLUMN/INDEX statement.\r
+ *\r
+ * @param fullTableName Fully qualified table name\r
+ * @param tableName Table name.\r
+ * @param oldObjectName Old object name\r
+ * @param newObjectName New object name.\r
+ * @param sd Schema that table lives in.\r
+ * @param tableId UUID for table\r
+ * @param usedAlterTable True if used Alter Table command, false if used Rename\r
+ * @param renamingWhat Value indicates if Rename Column/Index.\r
+ *\r
+ */\r
+ public ConstantAction getRenameConstantAction\r
+ (\r
+ String fullTableName,\r
+ String tableName,\r
+ String oldObjectName,\r
+ String newObjectName,\r
+ SchemaDescriptor sd,\r
+ UUID tableId,\r
+ boolean usedAlterTable,\r
+ int renamingWhat\r
+ )\r
+ {\r
+ return new RenameConstantAction( fullTableName, tableName, oldObjectName, newObjectName,\r
+ sd, tableId, usedAlterTable, renamingWhat );\r
+ }\r
+\r
+ /**\r
+ * Make the ConstantAction for a Replicated INSERT statement.\r
+ *\r
+ * @param conglomId Conglomerate ID.\r
+ * @param heapSCOCI StaticCompiledOpenConglomInfo for target heap.\r
+ * @param irgs Index descriptors\r
+ * @param indexCIDS Conglomerate IDs of indices\r
+ * @param indexSCOCIs StaticCompiledOpenConglomInfos for indexes.\r
+ * @param indexNames Names of indices on this table for error \r
+ * reporting.\r
+ * @param deferred True means deferred insert\r
+ * @param tableIsPublished true if table is published, false otherwise\r
+ * @param tableID table id\r
+ * @param targetProperties Properties on the target table\r
+ * @param fkInfo Array of structures containing foreign key info, \r
+ * if any (may be null)\r
+ * @param triggerInfo Array of structures containing trigger info, \r
+ * @param streamStorableHeapColIds Null for non rep. (0 based)\r
+ * if any (may be null)\r
+ * @param indexedCols boolean[] of which (0-based) columns are indexed.\r
+ * @param dependencyId UUID for dependency system\r
+ * @param stageControl Stage Control Tokens\r
+ * @param ddlList List of DDL to log. This is for BULK INSERT into a published table at the Source.\r
+ * @param singleRowSource Whether or not source is a single row source\r
+ * @param autoincRowLocation array of row locations into syscolumns for\r
+ autoincrement columns\r
+ *\r
+ * @exception StandardException Thrown on failure\r
+ */\r
+ public ConstantAction getInsertConstantAction(\r
+ TableDescriptor tableDescriptor,\r
+ long conglomId,\r
+ StaticCompiledOpenConglomInfo heapSCOCI,\r
+ IndexRowGenerator[] irgs,\r
+ long[] indexCIDS,\r
+ StaticCompiledOpenConglomInfo[] indexSCOCIs,\r
+ String[] indexNames,\r
+ boolean deferred,\r
+ boolean tableIsPublished,\r
+ UUID tableID,\r
+ int lockMode,\r
+ Object insertToken,\r
+ Object rowSignature,\r
+ Properties targetProperties,\r
+ FKInfo[] fkInfo,\r
+ TriggerInfo triggerInfo,\r
+ int[] streamStorableHeapColIds,\r
+ boolean[] indexedCols,\r
+ UUID dependencyId,\r
+ Object[] stageControl,\r
+ Object[] ddlList,\r
+ boolean singleRowSource,\r
+ RowLocation[] autoincRowLocation\r
+ )\r
+ throws StandardException\r
+ {\r
+ return new InsertConstantAction(tableDescriptor,\r
+ conglomId,\r
+ heapSCOCI,\r
+ irgs,\r
+ indexCIDS,\r
+ indexSCOCIs,\r
+ indexNames,\r
+ deferred,\r
+ targetProperties,\r
+ tableID,\r
+ lockMode,\r
+ fkInfo,\r
+ triggerInfo,\r
+ streamStorableHeapColIds,\r
+ indexedCols,\r
+ singleRowSource,\r
+ autoincRowLocation\r
+ );\r
+ }\r
+\r
+ /**\r
+ * Make the ConstantAction for an updatable VTI statement.\r
+ *\r
+ * @param deferred Deferred mode?\r
+ *\r
+ * @exception StandardException Thrown on failure\r
+ */\r
+ public ConstantAction getUpdatableVTIConstantAction( int statementType, boolean deferred)\r
+ throws StandardException\r
+ {\r
+ return new UpdatableVTIConstantAction( statementType, deferred, null);\r
+ }\r
+\r
+ /**\r
+ * Make the ConstantAction for an updatable VTI statement.\r
+ *\r
+ * @param deferred Deferred mode?\r
+ * @param changedColumnIds Array of ids of changed columns\r
+ *\r
+ * @exception StandardException Thrown on failure\r
+ */\r
+ public ConstantAction getUpdatableVTIConstantAction( int statementType,\r
+ boolean deferred,\r
+ int[] changedColumnIds)\r
+ throws StandardException\r
+ {\r
+ return new UpdatableVTIConstantAction( statementType, deferred, changedColumnIds);\r
+ }\r
+\r
+ /**\r
+ * Make the ConstantAction for a LOCK TABLE statement.\r
+ *\r
+ * @param fullTableName Full name of the table.\r
+ * @param conglomerateNumber Conglomerate number for the heap\r
+ * @param exclusiveMode Whether or not to get an exclusive lock.\r
+ */\r
+ public ConstantAction getLockTableConstantAction(\r
+ String fullTableName,\r
+ long conglomerateNumber, boolean exclusiveMode)\r
+ {\r
+ return new LockTableConstantAction( \r
+ fullTableName, conglomerateNumber, exclusiveMode );\r
+ }\r
+\r
+\r
+ /**\r
+ * Make the ConstantAction for a SET SCHEMA statement.\r
+ *\r
+ * @param schemaName Name of schema.\r
+ * @param type Literal, USER or ?\r
+ */\r
+ public ConstantAction getSetSchemaConstantAction(String schemaName, int type)\r
+ {\r
+ return new SetSchemaConstantAction( schemaName , type );\r
+ }\r
+\r
+ /**\r
+ * Make the ConstantAction for a SET TRANSACTION ISOLATION statement.\r
+ *\r
+ * @param isolationLevel The new isolation level.\r
+ */\r
+ public ConstantAction getSetTransactionIsolationConstantAction(int isolationLevel)\r
+ {\r
+ return new SetTransactionIsolationConstantAction(isolationLevel);\r
+ }\r
+\r
+\r
+ /**\r
+ * Make the ConstantAction for a Replicated DELETE statement.\r
+ *\r
+ * @param conglomId Conglomerate ID.\r
+ * @param tableType type of this table\r
+ * @param heapSCOCI StaticCompiledOpenConglomInfo for heap.\r
+ * @param irgs Index descriptors\r
+ * @param indexCIDS Conglomerate IDs of indices\r
+ * @param indexSCOCIs StaticCompiledOpenConglomInfos for indexes.\r
+ * @param emptyHeapRow Template for heap row.\r
+ * @param deferred True means deferred update\r
+ * @param targetUUID UUID of target table\r
+ * @param lockMode The lock mode to use\r
+ * (row or table, see TransactionController)\r
+ * @param tableIsPublished true if table is published, false otherwise\r
+ * @param changedColumnIds Array of ids of changes columns\r
+ * @param keyPositions positions of primary key columns in base row\r
+ * @param fkInfo Array of structures containing foreign key info, \r
+ * if any (may be null)\r
+ * @param triggerInfo Array of structures containing trigger info, \r
+ * @param baseRowReadList Map of columns read in. 1 based.\r
+ * @param baseRowReadMap map of columns to be selected from the base row\r
+ * (partial row). 1 based.\r
+ * @param streamStorableHeapColIds Null for non rep. (0 based)\r
+ * @param numColumns The number of columns being read.\r
+ * @param positionedUpdate is this a positioned update\r
+ * @param singleRowSource Whether or not source is a single row source\r
+ *\r
+ * @exception StandardException Thrown on failure\r
+ */\r
+ public UpdateConstantAction getUpdateConstantAction(\r
+ long conglomId,\r
+ int tableType,\r
+ StaticCompiledOpenConglomInfo heapSCOCI,\r
+ IndexRowGenerator[] irgs,\r
+ long[] indexCIDS,\r
+ StaticCompiledOpenConglomInfo[] indexSCOCIs,\r
+ String[] indexNames, \r
+ ExecRow emptyHeapRow,\r
+ boolean deferred,\r
+ UUID targetUUID,\r
+ int lockMode,\r
+ boolean tableIsPublished,\r
+ int[] changedColumnIds,\r
+ int[] keyPositions,\r
+ Object updateToken,\r
+ FKInfo[] fkInfo,\r
+ TriggerInfo triggerInfo,\r
+ FormatableBitSet baseRowReadList,\r
+ int[] baseRowReadMap,\r
+ int[] streamStorableHeapColIds,\r
+ int numColumns,\r
+ boolean positionedUpdate,\r
+ boolean singleRowSource\r
+ )\r
+ throws StandardException\r
+ {\r
+ return new UpdateConstantAction(\r
+ conglomId,\r
+ heapSCOCI,\r
+ irgs,\r
+ indexCIDS,\r
+ indexSCOCIs,\r
+ indexNames,\r
+ emptyHeapRow,\r
+ deferred,\r
+ targetUUID,\r
+ lockMode,\r
+ changedColumnIds,\r
+ fkInfo,\r
+ triggerInfo,\r
+ baseRowReadList,\r
+ baseRowReadMap,\r
+ streamStorableHeapColIds,\r
+ numColumns,\r
+ positionedUpdate,\r
+ singleRowSource\r
+ );\r
+ }\r
+\r
+ static protected Authorizer getAuthorizer()\r
+ {\r
+ LanguageConnectionContext lcc = (LanguageConnectionContext)\r
+ ContextService.getContext(LanguageConnectionContext.CONTEXT_ID);\r
+ return lcc.getAuthorizer();\r
+ }\r
+\r
+ /**\r
+ * Make the ConstantAction for a CREATE TRIGGER statement.\r
+ *\r
+ * @param triggerSchemaName Name of the schema that trigger lives in.\r
+ * @param triggerName Name of trigger\r
+ * @param eventMask TriggerDescriptor.TRIGGER_EVENT_XXXX\r
+ * @param isBefore is this a before (as opposed to after) trigger \r
+ * @param isRow is this a row trigger or statement trigger\r
+ * @param isEnabled is this trigger enabled or disabled\r
+ * @param triggerTable the table upon which this trigger is defined\r
+ * @param whenSPSId the sps id for the when clause (may be null)\r
+ * @param whenText the text of the when clause (may be null)\r
+ * @param actionSPSId the spsid for the trigger action (may be null)\r
+ * @param actionText the text of the trigger action (may be null)\r
+ * @param spsCompSchemaId the compilation schema for the action and when\r
+ * spses. If null, will be set to the current default\r
+ * schema\r
+ * @param creationTimestamp when was this trigger created? if null, will be\r
+ * set to the time that executeConstantAction() is invoked\r
+ * @param referencedCols what columns does this trigger reference (may be null)\r
+ * @param originalActionText The original user text of the trigger action\r
+ * @param referencingOld whether or not OLD appears in REFERENCING clause\r
+ * @param referencingNew whether or not NEW appears in REFERENCING clause\r
+ * @param oldReferencingName old referencing table name, if any, that appears in REFERCING clause\r
+ * @param newReferencingName new referencing table name, if any, that appears in REFERCING clause\r
+ */\r
+ public ConstantAction getCreateTriggerConstantAction\r
+ (\r
+ String triggerSchemaName,\r
+ String triggerName,\r
+ int eventMask,\r
+ boolean isBefore,\r
+ boolean isRow,\r
+ boolean isEnabled,\r
+ TableDescriptor triggerTable,\r
+ UUID whenSPSId,\r
+ String whenText,\r
+ UUID actionSPSId,\r
+ String actionText,\r
+ UUID spsCompSchemaId,\r
+ Timestamp creationTimestamp,\r
+ int[] referencedCols,\r
+ String originalActionText,\r
+ boolean referencingOld,\r
+ boolean referencingNew,\r
+ String oldReferencingName,\r
+ String newReferencingName\r
+ )\r
+ {\r
+ return new CreateTriggerConstantAction(triggerSchemaName, triggerName, \r
+ eventMask, isBefore, isRow, isEnabled, triggerTable, whenSPSId,\r
+ whenText, actionSPSId, actionText, spsCompSchemaId, creationTimestamp,\r
+ referencedCols, originalActionText,\r
+ referencingOld, referencingNew, oldReferencingName, newReferencingName);\r
+ }\r
+\r
+ /**\r
+ * Make the ConstantAction for a DROP TRIGGER statement.\r
+ *\r
+ * @param sd Schema that stored prepared statement lives in.\r
+ * @param triggerName Name of the Trigger\r
+ * @param tableId The table this trigger is defined upon\r
+ */\r
+ public ConstantAction getDropTriggerConstantAction\r
+ (\r
+ SchemaDescriptor sd,\r
+ String triggerName,\r
+ UUID tableId\r
+ )\r
+ {\r
+ return new DropTriggerConstantAction(sd, triggerName, tableId);\r
+ }\r
+ \r
+ /**\r
+ * Make the constant action for a UPDATE STATISTICS statement.\r
+ *\r
+ * @param forTable whether for an index or table.\r
+ * @param objectName name of the object (either table or index) for which\r
+ * this statistic is being created.\r
+ * @param tableUUID UUID of the table for which statistics are being\r
+ * created.\r
+ * @param objectUUID array of UUID's, one for each index conglomerate for\r
+ * which statistics are being created. \r
+ * @param conglomerateNumber array of conglomerate numbers, one for each\r
+ * index conglomerate for which statistics are being created.\r
+ * @param indexRow array of index rows, one for each index. This row is\r
+ * used by the constant action to read data from the indices.\r
+ */\r
+ public ConstantAction getUpdateStatisticsConstantAction\r
+ (\r
+ boolean forTable,\r
+ String objectName,\r
+ UUID tableUUID,\r
+ UUID[] objectUUID,\r
+ long[] conglomerateNumber,\r
+ ExecIndexRow[] indexRow\r
+ )\r
+ {\r
+ return new UpdateStatisticsConstantAction(forTable, \r
+ objectName,\r
+ tableUUID,\r
+ objectUUID,\r
+ conglomerateNumber,\r
+ indexRow);\r
+ }\r
+\r
+ /**\r
+ * Make the constant action for Drop Statistics statement.\r
+ *\r
+ * @param sd Schema Descriptor of the schema in which the object \r
+ * resides. \r
+ * @param fullTableName full name of the object for which statistics are\r
+ * being dropped.\r
+ * @param objectName object name for which statistics are being dropped.\r
+ * @param forTable is it an index or table whose statistics aer being\r
+ * consigned to the garbage heap?\r
+ */\r
+ public ConstantAction getDropStatisticsConstantAction\r
+ (SchemaDescriptor sd, String fullTableName, String objectName, boolean forTable)\r
+ {\r
+ return new DropStatisticsConstantAction(sd, fullTableName, objectName, forTable);\r
+ }\r
+\r
+ /**\r
+ * Make the constant action for a Grant statement\r
+ *\r
+ * @param privileges The list of privileges to be granted\r
+ * @param grantees The list of grantees\r
+ */\r
+ public ConstantAction getGrantConstantAction( PrivilegeInfo privileges,\r
+ List grantees)\r
+ {\r
+ return new GrantRevokeConstantAction( true, privileges, grantees);\r
+ }\r
+\r
+ /**\r
+ * Make the constant action for a Revoke statement\r
+ * \r
+ * @param privileges The list of privileges to be revokeed\r
+ * @param grantees The list of grantees\r
+ */\r
+ public ConstantAction getRevokeConstantAction( PrivilegeInfo privileges,\r
+ List grantees)\r
+ {\r
+ return new GrantRevokeConstantAction( false, privileges, grantees);\r
+ }\r
+}\r