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

📄 dependentresultset.java

📁 derby database source code.good for you.
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
            SanityManager.ASSERT(base_row_exists, "base row disappeared.");        }		return currentRow;	}		ExecRow searchRow = null; //the current row we are searching for	//this function will return an index row on dependent table 	public ExecRow	getNextRowCore() throws StandardException 	{				beginTime = getCurrentTimeMillis();		if (searchRow == null)		{			//we are searching for a row first time			if((searchRow = getNextParentRow())!=null)			   openIndexScan(searchRow);		}				ExecRow currentIndexRow = null;	    while(searchRow != null)		{			//get if the current search row has  more 			//than one row in the dependent tables			currentIndexRow = fetchIndexRow();				if(currentIndexRow !=null)				break;			if((searchRow = getNextParentRow())!=null)			   openIndexScan(searchRow);		}		nextTime += getElapsedMillis(beginTime);		if(currentIndexRow!= null)		{			rowsSeen++;			return fetchBaseRow();		}else		{			return currentIndexRow;		}					}	//this function will return the rows from the parent result sets 	private ExecRow	getNextParentRow() throws StandardException 	{		ExecRow cRow;		TemporaryRowHolder rowHolder;		if(sourceOpened[sArrayIndex] == 0)		{			rowHolder = sourceRowHolders[sArrayIndex];			source = (TemporaryRowHolderResultSet)rowHolder.getResultSet();			source.open(); //open the cursor result set			sourceOpened[sArrayIndex] = -1;			sourceResultSets[sArrayIndex] = source;		}		if(sourceOpened[sArrayIndex] == 1)		{			source = sourceResultSets[sArrayIndex];			source.reStartScan(sourceRowHolders[sArrayIndex].getTemporaryConglomId(),							  sourceRowHolders[sArrayIndex].getPositionIndexConglomId());			sourceOpened[sArrayIndex] = -1;					}		if(sVector.size() > sourceRowHolders.length)		{			addNewSources();		}		cRow = source.getNextRow();		while(cRow == null &&  (sArrayIndex+1) <  sourceRowHolders.length)		{			//opening the next source;			sArrayIndex++;			if(sourceOpened[sArrayIndex] == 0)			{				rowHolder = sourceRowHolders[sArrayIndex];				source = (TemporaryRowHolderResultSet)rowHolder.getResultSet();				source.open(); //open the cursor result set				sourceOpened[sArrayIndex] = -1;				sourceResultSets[sArrayIndex] = source;			}			if(sourceOpened[sArrayIndex] == 1)			{				source = sourceResultSets[sArrayIndex];				source.reStartScan(sourceRowHolders[sArrayIndex].getTemporaryConglomId(),								  sourceRowHolders[sArrayIndex].getPositionIndexConglomId());				sourceOpened[sArrayIndex] = -1;			}					cRow = source.getNextRow();		}		if(cRow == null)		{			//which means no source has any more  currently rows.			sArrayIndex = 0;			//mark all the sources to  restartScan.			for(int i =0 ; i < sourceOpened.length ; i++)				sourceOpened[i] = 1;		}				return cRow;	}	/*	** Open the heap Conglomerate controller	**	** @param transaction controller will open one if null	*/	public ConglomerateController openHeapConglomerateController()		throws StandardException	{		return tc.openCompiledConglomerate(                    false,				    TransactionController.OPENMODE_FORUPDATE,					lockMode,					isolationLevel,					heapScoci,					heapDcoci);	}	/**	  Close the all the opens we did in this result set.	  */	public void close()        throws StandardException	{		//save the information for the runtime stastics		// This is where we get the scan properties for the reference index scans		if (runTimeStatisticsOn)		{			startPositionString = printStartPosition();			stopPositionString = printStopPosition();			scanProperties = getScanProperties();		}		if (indexSC != null) 		{			indexSC.close();			indexSC = null;		}		if ( heapCC != null )		{			heapCC.close();			heapCC = null;		}		if(isOpen)		{			source.close();  		}				closeTime += getElapsedMillis(beginTime);	}	public void	finish() throws StandardException	{		if (source != null)			source.finish();		finishAndRTS();	}	public void openCore() throws StandardException	{		sVector = activation.getParentResultSet(parentResultSetId);		int size = sVector.size();		sourceRowHolders = new TemporaryRowHolder[size];		sourceOpened = new int[size];		sourceResultSets = new TemporaryRowHolderResultSet[size];		for(int i = 0 ; i < size ; i++)		{			sourceRowHolders[i] = (TemporaryRowHolder)sVector.elementAt(i);			sourceOpened[i] = 0;		}		//open the table scan		heapCC = openHeapConglomerateController();		numOpens++;		openTime += getElapsedMillis(beginTime);	}	private void addNewSources()	{		int size = sVector.size();		TemporaryRowHolder[] tsourceRowHolders = new TemporaryRowHolder[size];		int[] tsourceOpened = new int[size];		TemporaryRowHolderResultSet[] tsourceResultSets = new TemporaryRowHolderResultSet[size];				//copy the source we have now		System.arraycopy(sourceRowHolders, 0, tsourceRowHolders, 0 , sourceRowHolders.length);		System.arraycopy(sourceOpened, 0, tsourceOpened , 0 ,sourceOpened.length);		System.arraycopy(sourceResultSets , 0, tsourceResultSets ,0 ,sourceResultSets.length);		//copy the new sources		for(int i = sourceRowHolders.length; i < size ; i++)		{			tsourceRowHolders[i] = (TemporaryRowHolder)sVector.elementAt(i);			tsourceOpened[i] = 0;		}		sourceRowHolders = tsourceRowHolders;		sourceOpened = tsourceOpened ;		sourceResultSets = tsourceResultSets;	}	/**	 * Can we get instantaneous locks when getting share row	 * locks at READ COMMITTED.	 */	private boolean canGetInstantaneousLocks()	{		return false;	}	public long getTimeSpent(int type)	{		return constructorTime + openTime + nextTime + closeTime;	}	//Cursor result set information.	public RowLocation getRowLocation() throws StandardException	{		return baseRowLocation;	}	public ExecRow getCurrentRow() throws StandardException 	{		return currentRow;	}	public Properties getScanProperties()	{		if (scanProperties == null)		{			scanProperties = new Properties();		}		try		{			if (indexSC != null)			{				indexSC.getScanInfo().getAllScanInfo(scanProperties);				/* Did we get a coarser lock due to				 * a covering lock, lock escalation				 * or configuration?				 */				coarserLock = indexSC.isTableLocked() && 					(lockMode == TransactionController.MODE_RECORD);			}		}		catch(StandardException se)		{				// ignore		}		return scanProperties;	}	public String printStartPosition()	{		return printPosition(ScanController.GE, indexQualifierRow);	}	public String printStopPosition()	{		return printPosition(ScanController.GT, indexQualifierRow);	}	/**	 * Return a start or stop positioner as a String.	 *	 * If we already generated the information, then use	 * that.  Otherwise, invoke the activation to get it.	 */	private String printPosition(int searchOperator, ExecIndexRow positioner)	{		String idt = "";		String output = "";		String searchOp = null;		switch (searchOperator)		{			case ScanController.GE:				searchOp = ">=";				break;			case ScanController.GT:				searchOp = ">";				break;			default:				if (SanityManager.DEBUG)				{					SanityManager.THROWASSERT("Unknown search operator " +												searchOperator);				}				// NOTE: This does not have to be internationalized because				// this code should never be reached.				searchOp = "unknown value (" + searchOperator + ")";				break;		}		if(positioner !=null)		{			output = output + "\t" +				MessageService.getTextMessage(										  SQLState.LANG_POSITIONER,										  searchOp,										  String.valueOf(positioner.nColumns())) +				"\n";			output = output + "\t" +				MessageService.getTextMessage(											  SQLState.LANG_ORDERED_NULL_SEMANTICS) +				"\n";			for (int position = 0; position < positioner.nColumns(); position++)			{				if (positioner.areNullsOrdered(position))				{					output = output + position + " ";				}			}			}			return output + "\n";	}	/**	 * Return an array of Qualifiers as a String	 */	public String printQualifiers()	{		//There are no qualifiers in thie result set for index scans.		String idt = "";		return idt + MessageService.getTextMessage(SQLState.LANG_NONE);	}}

⌨️ 快捷键说明

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