📄 genericconstantactionfactory.java
字号:
/* Derby - Class org.apache.derby.impl.sql.execute.GenericConstantActionFactory Copyright 1998, 2004 The Apache Software Foundation or its licensors, as applicable. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */package org.apache.derby.impl.sql.execute;import org.apache.derby.iapi.error.StandardException;import org.apache.derby.iapi.services.context.ContextService;import org.apache.derby.iapi.sql.conn.Authorizer;import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;import org.apache.derby.iapi.sql.ResultDescription;import org.apache.derby.iapi.sql.execute.ConstantAction;import org.apache.derby.iapi.sql.execute.ExecIndexRow;import org.apache.derby.iapi.sql.dictionary.ConstraintDescriptorList;import org.apache.derby.iapi.sql.dictionary.GenericDescriptorList;import org.apache.derby.iapi.sql.dictionary.IndexRowGenerator;import org.apache.derby.iapi.sql.dictionary.TableDescriptor;import org.apache.derby.iapi.sql.dictionary.SchemaDescriptor;import org.apache.derby.iapi.sql.execute.ExecRow;import org.apache.derby.iapi.sql.depend.ProviderInfo;import org.apache.derby.iapi.store.access.StaticCompiledOpenConglomInfo;import org.apache.derby.iapi.services.sanity.SanityManager;import org.apache.derby.iapi.types.RowLocation;import org.apache.derby.catalog.UUID;import org.apache.derby.catalog.AliasInfo;import org.apache.derby.iapi.services.io.FormatableBitSet;import java.util.Properties;import java.sql.Timestamp;/** * Factory for creating ConstantActions. * * <P>Implemetation note: For most operations, the ResultSetFactory * determines if the operation is allowed in a readonly/target database. * Because we perform JAR add/drop/replace with a utility rather than * using normal language processing we never get a result set for these * operations. For this reason, the ConstantActionFactory rather than * the ResultSetFactory checks if the these operations are allowed. * * @author Rick */public class GenericConstantActionFactory{ /////////////////////////////////////////////////////////////////////// // // CONSTRUCTORS // /////////////////////////////////////////////////////////////////////// public GenericConstantActionFactory() { } /////////////////////////////////////////////////////////////////////// // // CONSTANT ACTION MANUFACTORIES // /////////////////////////////////////////////////////////////////////// /** * Get ConstantAction for SET CONSTRAINTS statement. * * @param cdl the constraints to set, if null, * we'll go ahead and set them all * @param enable if true, turn them on, if false * disable them * @param unconditionallyEnforce Replication sets this to true at * the end of REFRESH. This forces us * to run the included foreign key constraints even * if they're already marked ENABLED. * @param ddlList Replication list of actions to propagate, * null unless a replication source */ public ConstantAction getSetConstraintsConstantAction ( ConstraintDescriptorList cdl, boolean enable, boolean unconditionallyEnforce, Object[] ddlList ) { // ignore rep arg return new SetConstraintsConstantAction(cdl, enable, unconditionallyEnforce); } /** * Make the AlterAction for an ALTER TABLE statement. * * @param sd descriptor for the schema that table lives in. * @param tableName Name of table. * @param tableId UUID of table. * @param tableConglomerateId heap conglomerate id of table * @param tableType Type of table (e.g., BASE). * @param columnInfo Information on all the columns in the table. * @param constraintActions ConstraintConstantAction[] for constraints * @param lockGranularity The lock granularity. * @param compressTable Whether or not this is a compress table * @param behavior drop behavior of dropping column * @param sequential If compress table/drop column, whether or not sequential * @param compressTable Whether or not this is a truncate table */ public ConstantAction getAlterTableConstantAction ( SchemaDescriptor sd, String tableName, UUID tableId, long tableConglomerateId, int tableType, ColumnInfo[] columnInfo, ConstraintConstantAction[] constraintActions, char lockGranularity, boolean compressTable, int behavior, boolean sequential, boolean truncateTable ) { return new AlterTableConstantAction( sd, tableName, tableId, tableConglomerateId, tableType, columnInfo, constraintActions, lockGranularity, compressTable, behavior, sequential, truncateTable); } /** * Make a ConstantAction for a constraint. * * @param constraintName Constraint name. * @param constraintType Constraint type. * @param tableName Table name. * @param tableId UUID of table. * @param schemaName Schema that table lives in. * @param columnNames String[] for column names * @param indexAction IndexConstantAction for constraint (if necessary) * @param constraintText Text for check constraint * RESOLVE - the next parameter should go away once we use UUIDs * (Generated constraint names will be based off of uuids) * @param constraintId UUID of constraint. null => we should generate one. * @param enabled Should the constraint be created as enabled * (enabled == true), or disabled (enabled == false). * @param ConstraintInfo The referenced constraint, if a foreign key constraint * @param providerInfo Information on all the Providers */ public CreateConstraintConstantAction getCreateConstraintConstantAction ( String constraintName, int constraintType, String tableName, UUID tableId, String schemaName, String[] columnNames, IndexConstantAction indexAction, String constraintText, boolean enabled, ConstraintInfo otherConstraint, ProviderInfo[] providerInfo ) { return new CreateConstraintConstantAction ( constraintName, constraintType, tableName, tableId, schemaName, columnNames, indexAction, constraintText, enabled, otherConstraint, providerInfo ); } /** * Make the ConstantAction for a CREATE INDEX 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. * @param indexName Name of the index * @param tableName Name of table the index will be on * @param tableId UUID of table. * @param conglomId Conglomerate ID of the index, if known in advance * @param columnNames Names of the columns in the index, in order * @param isAscending Array of booleans telling asc/desc on each column * @param isConstraint TRUE if index is backing up a constraint, else FALSE * @param conglomerateUUID ID of conglomerate * @param properties The optional properties list associated with the index. */ public CreateIndexConstantAction getCreateIndexConstantAction ( boolean unique, String indexType, String schemaName, String indexName, String tableName, UUID tableId, long conglomId, String[] columnNames, boolean[] isAscending, boolean isConstraint, UUID conglomerateUUID, Properties properties ) { return new CreateIndexConstantAction ( unique, indexType, schemaName, indexName, tableName, tableId, conglomId, columnNames, isAscending, isConstraint, conglomerateUUID, properties ); } /** * Make the ConstantAction for a CREATE ALIAS statement. * * @param aliasName Name of alias. * @param schemaName Alias's schema. * @param javaClassName Name of java class. * @param methodName Name of method. * @param targetClassName Name of java class at Target database. * @param targetMethodName Name of method at Target database. * @param aliasType The alias type */ public ConstantAction getCreateAliasConstantAction ( String aliasName, String schemaName, String javaClassName, AliasInfo aliasInfo, char aliasType) { return new CreateAliasConstantAction (aliasName, schemaName, javaClassName, aliasInfo, aliasType ); } /** * Make the ConstantAction for a CREATE SCHEMA statement. * * @param schemaName Name of table. * @param aid Authorizaton id * @param schemaId ID of table. If null, we allocate one. * @param setToDefault if true, set the default schema to * the new schema once it is created. */ public ConstantAction getCreateSchemaConstantAction ( String schemaName, String aid) { return new CreateSchemaConstantAction(schemaName, aid); } /** * Make the ConstantAction for a CREATE TABLE statement. * * @param schemaName name for the schema that table lives in. * @param tableName Name of table. * @param tableType Type of table (e.g., BASE, global temporary table). * @param columnInfo Information on all the columns in the table. * (REMIND tableDescriptor ignored) * @param constraintActions CreateConstraintConstantAction[] for constraints * @param properties Optional table properties * @param lockGranularity The lock granularity. * @param onCommitDeleteRows If true, on commit delete rows else on commit preserve rows of temporary table. * @param onRollbackDeleteRows If true, on rollback, delete rows from temp tables which were logically modified. true is the only supported value */ public ConstantAction getCreateTableConstantAction ( String schemaName, String tableName, int tableType, ColumnInfo[] columnInfo, CreateConstraintConstantAction[] constraintActions, Properties properties, char lockGranularity, boolean onCommitDeleteRows, boolean onRollbackDeleteRows) { return new CreateTableConstantAction( schemaName, tableName, tableType, columnInfo, constraintActions, properties, lockGranularity, onCommitDeleteRows, onRollbackDeleteRows); } /** * Make the ConstantAction for a savepoint statement (ROLLBACK savepoint, RELASE savepoint and SAVEPOINT). * * @param savepointName name for the savepoint. * @param statementType Type of savepoint statement ie rollback, release or set savepoint */ public ConstantAction getSavepointConstantAction ( String savepointName, int statementType) { return new SavepointConstantAction( savepointName, statementType); } /** * Make the ConstantAction for a CREATE VIEW statement. * * @param sd descriptor for the schema that table lives in. * @param tableName Name of table. * @param tableType Type of table (e.g., BASE). * @param viewText Text of query expression for view definition * @param checkOption Check option type * @param columnInfo Information on all the columns in the table. * @param providerInfo Information on all the Providers * @param compSchemaId ID of schema in which the view is to be bound * when accessed in the future. * (REMIND tableDescriptor ignored) */ public ConstantAction getCreateViewConstantAction ( String schemaName, String tableName, int tableType, String viewText, int checkOption,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -