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

📄 constraintdescriptor.java

📁 derby database source code.good for you.
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
	 * is declared.	 *	 * @return the table descriptor	 */	public TableDescriptor getTableDescriptor()	{		return table;	}	/**	 * Get the column descriptors for all the columns	 * referenced by this constraint.	 *	 * @return the column descriptor list	 *	 * @exception StandardException on error	 */	public ColumnDescriptorList getColumnDescriptors()		throws StandardException	{		if (colDL == null)		{			DataDictionary dd = getDataDictionary();			colDL = new ColumnDescriptorList();				int[]	refCols = getReferencedColumns();			for (int i = 0; i < refCols.length; i++)			{				colDL.add(table.getColumnDescriptor(refCols[i]));			}		}		return colDL;	}	/**	 * Indicates whether the column descriptor list is	 * type comparable with the constraints columns.  The	 * types have to be identical AND in the same order 	 * to succeed.	 *	 * @param otherColumns the columns to compare	 *	 * @return true/false	 *	 * @exception StandardException on error	 */	public boolean areColumnsComparable(ColumnDescriptorList otherColumns)		throws StandardException	{		ColumnDescriptor		myColumn;		ColumnDescriptor		otherColumn;		ColumnDescriptorList	myColDl = getColumnDescriptors();		/*		** Check the lenghts of the lists		*/		if (otherColumns.size() != myColDl.size())		{			return false;		}		int mySize = myColDl.size();		int otherSize = otherColumns.size();		int index;		for (index = 0; index < mySize && index < otherSize; index++)		{			myColumn = (ColumnDescriptor) myColDl.elementAt(index);				otherColumn = (ColumnDescriptor) otherColumns.elementAt(index);				/*			** Just compare the types.  Note that this will	 		** say a decimal(x,y) != numeric(x,y) even though			** it does.			*/			if (!(myColumn.getType()).isExactTypeAndLengthMatch(					(otherColumn.getType())))			{				break;			}		}		return (index == mySize && index == otherSize);	}	/**	 * Does a column intersect with our referenced columns	 * @param int ColumnNumber	 * 	 * Note-- this is not a static method.	 */	public boolean columnIntersects(int columnArray[])	{		// call static method.		return doColumnsIntersect(getReferencedColumns(), columnArray);	}	/**	 * Does a column in the input set intersect with	 * our referenced columns?	 *	 * @param otherColumns the columns to compare. If	 *	null, asssumed to mean all columns	 *	 * @param the columns referenced by the caller	 *	 * @return true/false	 */	static boolean doColumnsIntersect(int[] otherColumns, int[] referencedColumns)	{		/*		** It is assumed that if otherColumns is null, then		** all other columns are modified.  In this case,		** it is assumed that it intersects with some column	 	** of ours, so just return true.		*/		if ((otherColumns == null) || (referencedColumns == null))		{			return true;		}		for (int outer = 0; outer < referencedColumns.length; outer++)		{				for (int inner = 0; inner < otherColumns.length; inner++)			{				if (referencedColumns[outer] == otherColumns[inner])				{					return true;				}			}		}		return false;	}	/**	 * Convert the ColumnDescriptor to a String.	 *	 * @return	A String representation of this ColumnDescriptor	 */	public String	toString()	{		if (SanityManager.DEBUG)		{			String tableDesc =				"table: " +				table.getQualifiedName() + "(" +				table.getUUID()+","+				table.getTableType()+")";			return tableDesc + "\n"+				"constraintName: " + constraintName + "\n" +				"constraintId: " + constraintId + "\n" +				"deferrable: " + deferrable + "\n" +				"initiallyDeferred: " + initiallyDeferred + "\n" +				"referencedColumns: " + referencedColumns + "\n" +				"schemaDesc: " + schemaDesc + "\n"				;		}		else		{			return "";		}	}	////////////////////////////////////////////////////////////////////	//	// PROVIDER INTERFACE	//	////////////////////////////////////////////////////////////////////	/**				@return the stored form of this provider			@see Dependable#getDependableFinder	 */	public DependableFinder getDependableFinder() 	{	    return	getDependableFinder(StoredFormatIds.CONSTRAINT_DESCRIPTOR_FINDER_V01_ID);	}	/**	 * Return the name of this Provider.  (Useful for errors.)	 *	 * @return String	The name of this provider.	 */	public String getObjectName()	{		return constraintName;	}	/**	 * Get the provider's UUID	 *	 * @return 	The provider's UUID	 */	public UUID getObjectID()	{		return constraintId;	}	/**	 * Get the provider's type.	 *	 * @return char		The provider's type.	 */	public String getClassType()	{		return Dependable.CONSTRAINT;	}	//////////////////////////////////////////////////////	//	// DEPENDENT INTERFACE	//	//////////////////////////////////////////////////////	/**	 * Check that all of the dependent's dependencies are valid.	 *	 * @return true if the dependent is currently valid	 */	public synchronized boolean isValid()	{		return true;	}	/**	 * Prepare to mark the dependent as invalid (due to at least one of	 * its dependencies being invalid).	 *	 * @param action	The action causing the invalidation	 * @param p		the provider	 *	 * @exception StandardException thrown if unable to make it invalid	 */	public void prepareToInvalidate(Provider p, int action,					LanguageConnectionContext lcc) 		throws StandardException	{		DependencyManager dm = getDataDictionary().getDependencyManager();		switch (action)		{			/*			** A SET CONSTRAINT stmt will throw an SET_CONSTRAINTS action			** when enabling/disabling constraints.  We'll ignore it.			** Same for SET TRIGGERS			*/		    case DependencyManager.SET_CONSTRAINTS_ENABLE:		    case DependencyManager.SET_CONSTRAINTS_DISABLE:		    case DependencyManager.SET_TRIGGERS_ENABLE:		    case DependencyManager.SET_TRIGGERS_DISABLE:				break;			/*			** Currently, the only thing we are depenedent			** on is another constraint or an alias..			*/		    default:				throw StandardException.newException(SQLState.LANG_PROVIDER_HAS_DEPENDENT_OBJECT, 									dm.getActionString(action), 									p.getObjectName(), "CONSTRAINT", constraintName);		}	}	/**	 * Mark the dependent as invalid (due to at least one of	 * its dependencies being invalid).  Always an error	 * for a constraint -- should never have gotten here.	 *	 * @param	action	The action causing the invalidation	 *	 * @exception StandardException thrown if called in sanity mode	 */	public void makeInvalid(int action, LanguageConnectionContext lcc) 		throws StandardException	{		/*		** SET_CONSTRAINTS/TRIGGERS is the only valid action		*/		if ((action != DependencyManager.SET_CONSTRAINTS_DISABLE) &&			(action != DependencyManager.SET_CONSTRAINTS_ENABLE) &&			(action != DependencyManager.SET_TRIGGERS_ENABLE) &&			(action != DependencyManager.SET_TRIGGERS_DISABLE)		   )		{			/* 			** We should never get here, we should have barfed on 			** prepareToInvalidate().			*/			if (SanityManager.DEBUG)			{				DependencyManager dm;						dm = getDataDictionary().getDependencyManager();					SanityManager.THROWASSERT("makeInvalid("+					dm.getActionString(action)+					") not expected to get called");			}		}	}	/**     * Attempt to revalidate the dependent. Meaningless	 * for constraints.	 */	public void makeValid(LanguageConnectionContext lcc) 	{	}		/** @see TupleDescriptor#getDescriptorName */	public String getDescriptorName() { return constraintName; }		public String getDescriptorType() { return "Constraint"; }}

⌨️ 快捷键说明

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