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

📄 vtiresultset.java

📁 derby database source code.good for you.
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
                    if( ! userVTI.next())                    {                        if( null != fastPath)                            fastPath.rowsDone();                        result = null;                    }                    else                    {                        // Get the cached row and fill it up                        result = getAllocatedRow();                        populateFromResultSet(result);                        if (fastPath != null)                            fastPath.currentRow(userVTI, result.getRowArray());                    }				}			}			catch (Throwable t)			{				throw StandardException.unexpectedUserException(t);			}		}		setCurrentRow(result);		if (result != null)		{			rowsReturned++;			rowsSeen++;		}		nextTime += getElapsedMillis(beginTime);	    return result;	}		/**     * @see org.apache.derby.iapi.sql.ResultSet#close	 *	 * @exception StandardException thrown on error	 */	public void	close() throws StandardException	{		beginTime = getCurrentTimeMillis();		if (isOpen) {			if (closeCleanup != null) {				closeCleanup.invoke(activation); // let activation tidy up			}			// we don't want to keep around a pointer to the			// row ... so it can be thrown away.			// REVISIT: does this need to be in a finally			// block, to ensure that it is executed?	    	clearCurrentRow();	    	next = false;			/* close the user ResultSet.  We have to eat any exception here			 * since our close() method cannot throw an exception.			 */			if (userVTI != null)			{				try				{					userVTI.close();				} catch (SQLException se)				{					throw StandardException.unexpectedUserException(se);				}				finally {					userVTI = null;				}			}			if ((userPS != null) && !reuseablePs)			{				try				{					userPS.close();				} catch (SQLException se)				{					throw StandardException.unexpectedUserException(se);				}				finally {					userPS = null;				}			}			super.close();		}		else			if (SanityManager.DEBUG)				SanityManager.DEBUG("CloseRepeatInfo","Close of VTIResultSet repeated");		closeTime += getElapsedMillis(beginTime);	}	public void finish() throws StandardException {		// for a reusablePS it will be closed by the activation		// when it is closed.		if ((userPS != null) && !reuseablePs)		{			try			{				userPS.close();				userPS = null;			} catch (SQLException se)			{				throw StandardException.unexpectedUserException(se);			}		}		finishAndRTS();	}	/**	 * Return the total amount of time spent in this ResultSet	 *	 * @param type	CURRENT_RESULTSET_ONLY - time spent only in this ResultSet	 *				ENTIRE_RESULTSET_TREE  - time spent in this ResultSet and below.	 *	 * @return long		The total amount of time spent (in milliseconds).	 */	public long getTimeSpent(int type)	{		long totTime = constructorTime + openTime + nextTime + closeTime;		return totTime;	}	//	// CursorResultSet interface	//	/**	 * This is not operating against a stored table,	 * so it has no row location to report.	 *	 * @see CursorResultSet	 *	 * @return a null.	 */	public RowLocation getRowLocation() {		if (SanityManager.DEBUG)			SanityManager.THROWASSERT("RowResultSet used in positioned update/delete");		return null;	}	/**	 * This is not used in positioned update and delete,	 * so just return a null.	 *	 * @see CursorResultSet	 *	 * @return a null.	 */	public ExecRow getCurrentRow() {		if (SanityManager.DEBUG)			SanityManager.THROWASSERT("RowResultSet used in positioned update/delete");		return null;	}	// Class implementation	/**	 * Return the GeneratedMethod for instantiating the VTI.	 *	 * @return The  GeneratedMethod for instantiating the VTI.	 */	GeneratedMethod getVTIConstructor()	{		return constructor;	}	boolean isReuseablePs() {		return reuseablePs;	}	/**	 * Cache the ExecRow for this result set.	 *	 * @return The cached ExecRow for this ResultSet	 *	 * @exception StandardException thrown on failure.	 */	private ExecRow getAllocatedRow()		throws StandardException	{		if (allocatedRow == null)		{			allocatedRow = (ExecRow) row.invoke(activation);		}		return allocatedRow;	}	private int[] getProjectedColList() {		FormatableBitSet refs = referencedColumns;		int size = refs.size();		int arrayLen = 0;		for (int i = 0; i < size; i++) {			if (refs.isSet(i))				arrayLen++;		}		int[] colList = new int[arrayLen];		int offset = 0;		for (int i = 0; i < size; i++) {			if (refs.isSet(i))				colList[offset++] = i + 1;		}		return colList;	}	/**	 * @exception StandardException thrown on failure to open	 */	public void populateFromResultSet(ExecRow row)		throws StandardException	{		try		{			boolean[] nullableColumn = setNullableColumnList();			DataValueDescriptor[] columns = row.getRowArray();			// ExecRows are 0-based, ResultSets are 1-based			int rsColNumber = 1;			for (int index = 0; index < columns.length; index++)			{				// Skip over unreferenced columns				if (referencedColumns != null && (! referencedColumns.get(index)))				{					if (!pushedProjection)						rsColNumber++;					continue;				}				columns[index].setValueFromResultSet(									userVTI, rsColNumber, 									/* last parameter is whether or									 * not the column is nullable									 */									nullableColumn[rsColNumber]);				rsColNumber++;			}		} catch (StandardException se) {			throw se;		}		catch (Throwable t)		{			throw StandardException.unexpectedUserException(t);		}	}	public final int getScanIsolationLevel() {		return scanIsolationLevel;	}	/*	** VTIEnvironment	*/	public final boolean isCompileTime() {		return false;	}	public final String getOriginalSQL() {		return activation.getPreparedStatement().getSource();	}	public final int getStatementIsolationLevel() {		return ExecutionContext.CS_TO_JDBC_ISOLATION_LEVEL_MAP[getScanIsolationLevel()];	}	public final void setSharedState(String key, java.io.Serializable value) {		if (key == null)			return;		if (compileTimeConstants == null) {			Object[] savedObjects = activation.getPreparedStatement().getSavedObjects();			synchronized (savedObjects) {				compileTimeConstants = (FormatableHashtable) savedObjects[ctcNumber];				if (compileTimeConstants == null) {					compileTimeConstants = new FormatableHashtable();					savedObjects[ctcNumber] = compileTimeConstants;				}			}		}		if (value == null)			compileTimeConstants.remove(key);		else			compileTimeConstants.put(key, value);	}	public Object getSharedState(String key) {		if ((key == null) || (compileTimeConstants == null))			return null;		return compileTimeConstants.get(key);	}}

⌨️ 快捷键说明

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