⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tabledescriptor.java

📁 derby database source code.good for you.
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
	 */	public char	getLockGranularity()	{		return lockGranularity;	}	/**	 * Sets the lock granularity for the table to the specified value.	 *	 * @param lockGranularity	The new lockGranularity.	 */	public void	setLockGranularity(char lockGranularity)	{		this.lockGranularity = lockGranularity;	}	/**	 * Gets the on rollback behavior for the declared global temporary table.	 *	 * @return	A boolean representing the on rollback behavior for the declared global temporary table.	 */	public boolean	isOnRollbackDeleteRows()	{		return onRollbackDeleteRows;	}	/**	 * Gets the on commit behavior for the declared global temporary table.	 *	 * @return	A boolean representing the on commit behavior for the declared global temporary table.	 */	public boolean	isOnCommitDeleteRows()	{		return onCommitDeleteRows;	}	/**	 * Sets the heapConglomNumber to -1 for temporary table since the table was dropped and recreated at the commit time	 * and hence its conglomerate id has changed. This is used for temporary table descriptors only	 */	public void	resetHeapConglomNumber()	{		if (SanityManager.DEBUG)		{			if (tableType != TableDescriptor.GLOBAL_TEMPORARY_TABLE_TYPE)			{				SanityManager.THROWASSERT("tableType expected to be TableDescriptor.GLOBAL_TEMPORARY_TABLE_TYPE, not " +				tableType);			}		}		heapConglomNumber = -1;	}	/**	 * Gets an ExecRow for rows stored in the table this describes.	 *	 *	@param cm Current ContextManager	 *	 *	@return	the row.	 *  @exception StandardException		Thrown on failure	 */	public ExecRow getEmptyExecRow( ContextManager cm)		 throws StandardException	{		int							columnCount = getNumberOfColumns();		ExecutionContext			ec = (ExecutionContext) cm.getContext(ExecutionContext.CONTEXT_ID);		ExecRow result = ec.getExecutionFactory().getValueRow(columnCount);		for (int index = 0; index < columnCount; index++)		{			ColumnDescriptor cd = (ColumnDescriptor) columnDescriptorList.elementAt(index);			//String name = column.getColumnName();			DataValueDescriptor dataValue = cd.getType().getNull();			result.setColumn(index + 1, dataValue);		}		return result;	}	/**	 * Gets the conglomerate descriptor list	 *	 * @return	The conglomerate descriptor list for this table descriptor	 */	public ConglomerateDescriptorList getConglomerateDescriptorList()	{		return conglomerateDescriptorList;	}	/**	 * Gets the view descriptor for this TableDescriptor.	 * 	 * @return ViewDescriptor	The ViewDescriptor, if any.	 */	public ViewDescriptor getViewDescriptor()	{		return viewDescriptor;	}	/**	 * Set (cache) the view descriptor for this TableDescriptor	 *	 * @param viewDescriptor	The view descriptor to cache.	 *	 * @return Nothing.	 */	public void setViewDescriptor(ViewDescriptor viewDescriptor)	{		if (SanityManager.DEBUG)		{			if (tableType != TableDescriptor.VIEW_TYPE)			{				SanityManager.THROWASSERT("tableType expected to be TableDescriptor.VIEW_TYPE, not " +				tableType);			}		}		this.viewDescriptor = viewDescriptor;	}	/**	 * Is this provider persistent?  A stored dependency will be required	 * if both the dependent and provider are persistent.	 *	 * @return boolean              Whether or not this provider is persistent.	 */	public boolean isPersistent()	{		if (tableType == TableDescriptor.GLOBAL_TEMPORARY_TABLE_TYPE)			return false;		else			return(super.isPersistent());	}	/**	 * Is this descriptor represents a synonym?	 *	 * @return boolean              Whether or not this represents a synonym	 */	public boolean isSynonymDescriptor()	{		if (tableType == TableDescriptor.SYNONYM_TYPE)			return true;		return false;	}	/**	 * Gets the number of indexes on the table, including the backing indexes.	 *	 * @return the number of columns in the table.	 *	 */	public int getTotalNumberOfIndexes()		throws StandardException	{		int totalNumberOfIndexes = 0;		ConglomerateDescriptor[]	cds = getConglomerateDescriptors();		for (int index = 0; index < cds.length; index++)		{			if (cds[index].isIndex()) { totalNumberOfIndexes++; }		}		return totalNumberOfIndexes;	}    /**	  *	Builds a list of all triggers which are relevant to a	  *	given statement type, given a list of updated columns.	  *	  *	@param	statementType		defined in StatementType	  *	@param	changedColumnIds	array of changed columns	  *	@param	relevantTriggers	IN/OUT. Passed in as an empty list. Filled in as we go.	  *	  *	@return	list of relevant triggers	  *	  * @exception StandardException		Thrown on error	  */	public	void	getAllRelevantTriggers	(		int						statementType,		int[]					changedColumnIds,		GenericDescriptorList	relevantTriggers    )		throws StandardException	{		if (SanityManager.DEBUG)		{			SanityManager.ASSERT((statementType == StatementType.INSERT) ||								 (statementType == StatementType.BULK_INSERT_REPLACE) ||								 (statementType == StatementType.UPDATE) ||								 (statementType == StatementType.DELETE),							"invalid statement type "+statementType);		}		DataDictionary				dd = getDataDictionary();		Enumeration descs = dd.getTriggerDescriptors(this).elements();		while (descs.hasMoreElements())		{			TriggerDescriptor tgr = (TriggerDescriptor)descs.nextElement();			if (tgr.needsToFire(statementType, changedColumnIds))			{				relevantTriggers.add(tgr);			}		}	}    /**	  *	Gets all of the relevant constraints for a statement, given its	  *	statement type and its list of updated columns.	  *	  *	@param	statementType			As defined in StatementType.	  * @param	skipCheckConstraints	Skip check constraints	  * @param	changedColumnIds		If null, all columns being changed, otherwise array	  *									of 1-based column ids for columns being changed	  *	@param	needsDeferredProcessing	IN/OUT. true if the statement already needs	  *											deferred processing. set while evaluating this	  *											routine if a trigger or constraint requires	  *											deferred processing	  *	@param	relevantConstraints		IN/OUT. Empty list is passed in. We hang constraints on it as we go.	  *	  * @exception StandardException		Thrown on error	  */	public	void	getAllRelevantConstraints	(		int							statementType,		boolean						skipCheckConstraints,		int[]						changedColumnIds,		boolean[]					needsDeferredProcessing,		ConstraintDescriptorList	relevantConstraints    )		throws StandardException	{		if (SanityManager.DEBUG)		{			SanityManager.ASSERT((statementType == StatementType.INSERT) ||								 (statementType == StatementType.BULK_INSERT_REPLACE) ||								 (statementType == StatementType.UPDATE) ||								 (statementType == StatementType.DELETE),							"invalid statement type "+statementType);		}		DataDictionary					dd = getDataDictionary();		ConstraintDescriptorList		cdl = dd.getConstraintDescriptors(this);		int cdlSize = cdl.size();		for (int index = 0; index < cdlSize; index++)		{			ConstraintDescriptor cd = cdl.elementAt(index);			if (skipCheckConstraints &&					(cd.getConstraintType() == DataDictionary.CHECK_CONSTRAINT))			{				continue;			}			/*			** For each constraint, figure out if it requires deferred processing.			** Note that we need to do this on constraints that don't			** necessarily need to fire -- e.g. for an insert into a			** a table with a self-referencing constraint, we don't			** need to check the primary key constraint (assuming it			** is only referenced by the self-referencing fk on the same			** table), but we have to run in deferred mode nonetheless			** (even though we aren't going to check the pk constraint).			*/			if (!needsDeferredProcessing[0] &&				(cd instanceof ReferencedKeyConstraintDescriptor) &&				(statementType != StatementType.UPDATE &&				 statementType != StatementType.BULK_INSERT_REPLACE))			{				/* For insert (bulk or regular) on a non-published table,				 * we only need deferred mode if there is a 				 * self-referencing foreign key constraint.				 */				needsDeferredProcessing[0] = ((ReferencedKeyConstraintDescriptor)cd).									hasSelfReferencingFK(cdl, ConstraintDescriptor.ENABLED);			}			if (cd.needsToFire(statementType, changedColumnIds))			{				/*				** For update, if we are updating a referenced key, then				** we have to do it in deferred mode (in case we update				** multiple rows).				*/				if ((cd instanceof ReferencedKeyConstraintDescriptor) &&					(statementType == StatementType.UPDATE ||					 statementType == StatementType.BULK_INSERT_REPLACE))				{					needsDeferredProcessing[0] = true;				}				relevantConstraints.add(cd);			}		}	}	//	// Provider interface	//	/**				@return the stored form of this provider			@see Dependable#getDependableFinder	 */	public DependableFinder getDependableFinder()	{		if (referencedColumnMap == null) 			return	getDependableFinder(StoredFormatIds.TABLE_DESCRIPTOR_FINDER_V01_ID);		else			return getColumnDependableFinder(StoredFormatIds.COLUMN_DESCRIPTOR_FINDER_V01_ID,											 referencedColumnMap.getByteArray());	}	/**	 * Return the name of this Provider.  (Useful for errors.)	 *	 * @return String	The name of this provider.	 */	public String getObjectName()	{		if (referencedColumnMap == null)			return tableName;		else		{			String name = new String(tableName);			boolean first = true;			for (int i = 0; i < columnDescriptorList.size(); i++)			{				ColumnDescriptor cd = (ColumnDescriptor) columnDescriptorList.elementAt(i);				if (referencedColumnMap.isSet(cd.getPosition()))				{					if (first)					{						name += "(" + cd.getColumnName();						first = false;					}					else						name += ", " + cd.getColumnName();				}			}			if (! first)				name += ")";			return name;		}	}	/**	 * Get the provider's UUID 	 *	 * @return String	The provider's UUID	 */	public UUID getObjectID()	{		return oid;	}	/**	 * Get the provider's type.	 *	 * @return String		The provider's type.	 */	public String getClassType()	{		return Dependable.TABLE;	}	//	// class interface	//	/**	 * Prints the contents of the TableDescriptor	 *	 * @return The contents as a String	 */	public String toString()	{		if (SanityManager.DEBUG)		{			String tempString = "SCHEMA:\n" + schema + "\ntableName: " + tableName + "\n" +				"oid: " + oid + " tableType: " + tableType + "\n" +				"conglomerateDescriptorList: " + conglomerateDescriptorList + "\n" +				"columnDescriptorList: " + columnDescriptorList + "\n" +				"constraintDescriptorList: " + constraintDescriptorList + "\n" +				"heapConglomNumber: " + heapConglomNumber + "\n";			if (tableType == TableDescriptor.GLOBAL_TEMPORARY_TABLE_TYPE)			{				tempString = tempString + "onCommitDeleteRows: " + "\n" + onCommitDeleteRows + "\n";				tempString = tempString + "onRollbackDeleteRows: " + "\n" + onRollbackDeleteRows + "\n";			} else				tempString = tempString + "lockGranularity: " + lockGranularity + "\n";			return tempString;		}		else		{			return "";		}	}	/**	 * Gets the column descriptor list	 *	 * @return	The column descriptor list for this table descriptor	 *	 */	public ColumnDescriptorList getColumnDescriptorList()	{		return columnDescriptorList;	}	/**	 * Gets the constraint descriptor list	 *	 * @return	The constraint descriptor list for this table descriptor	 *	 * @exception StandardException		Thrown on failure	 */	public ConstraintDescriptorList getConstraintDescriptorList()		throws StandardException	{		return constraintDescriptorList;	}	/**

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -