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

📄 norowsresultsetimpl.java

📁 derby database source code.good for you.
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/*   Derby - Class org.apache.derby.impl.sql.execute.NoRowsResultSetImpl   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.services.monitor.Monitor;import org.apache.derby.iapi.services.sanity.SanityManager;import org.apache.derby.iapi.services.stream.HeaderPrintWriter;import org.apache.derby.iapi.services.stream.InfoStreams;import org.apache.derby.iapi.error.StandardException;import org.apache.derby.iapi.services.i18n.MessageService;import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;import org.apache.derby.iapi.sql.conn.StatementContext;import org.apache.derby.iapi.reference.SQLState;import org.apache.derby.iapi.sql.execute.ExecRow;import org.apache.derby.iapi.sql.execute.ExecutionContext;import org.apache.derby.iapi.sql.execute.NoPutResultSet;import org.apache.derby.iapi.sql.execute.ResultSetStatisticsFactory;import org.apache.derby.iapi.sql.Activation;import org.apache.derby.iapi.sql.ResultSet;import org.apache.derby.iapi.sql.ResultDescription;import org.apache.derby.iapi.sql.Row;import org.apache.derby.iapi.services.loader.GeneratedMethod;import org.apache.derby.iapi.types.DataValueDescriptor;import org.apache.derby.iapi.sql.dictionary.DataDictionaryContext;import org.apache.derby.iapi.sql.dictionary.DataDictionary;import org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptor;import org.apache.derby.iapi.sql.dictionary.TableDescriptor;import java.sql.Timestamp;import java.sql.SQLWarning;/** * This implementation of ResultSet * is meant to be overridden by subtypes * in the execution engine. Its primary users * will be DDL, which only need to define a * constructor to create the DDL object being * defined. All other ResultSet operations will * be handled by this superclass -- i.e., nothing * is allowed to be done to a DDL Result Set, since * it has no rows to provide. * <p> * This abstract class does not define the entire ResultSet * interface, but leaves the 'get' half of the interface * for subtypes to implement. It is package-visible only, * with its methods being public for exposure by its subtypes. * <p> * * @author ames */abstract class NoRowsResultSetImpl implements ResultSet{	protected final Activation    activation;	private boolean isTopResultSet = true;	private boolean dumpedStats;	protected NoPutResultSet[]	subqueryTrackingArray;	private final boolean statisticsTimingOn;	private boolean isClosed;	/* fields used for formating run time statistics output */	protected String indent;	protected String subIndent;	protected int sourceDepth;	/* Run time statistics variables */	protected final LanguageConnectionContext lcc;	protected long beginTime;	protected long endTime;	protected long beginExecutionTime;	protected long endExecutionTime;	NoRowsResultSetImpl(Activation activation)		throws StandardException	{		this.activation = activation;		if (SanityManager.DEBUG) {			if (activation == null)				SanityManager.THROWASSERT("activation is null in result set " + getClass());		}		lcc = activation.getLanguageConnectionContext();		statisticsTimingOn = lcc.getStatisticsTiming();		/* NOTE - We can't get the current time until after setting up the		 * activation, as we end up using the activation to get the 		 * LanguageConnectionContext.		 */		beginTime = getCurrentTimeMillis();		beginExecutionTime = beginTime;		StatementContext sc = lcc.getStatementContext();		sc.setTopResultSet(this, (NoPutResultSet[]) null);		// Pick up any materialized subqueries		if (subqueryTrackingArray == null)		{			subqueryTrackingArray = sc.getSubqueryTrackingArray();		}	}    /**	 * Returns FALSE	 */	 public final boolean	returnsRows() { return false; }	/**	 * Returns zero.	 */	public int	modifiedRowCount() { return 0; }	/**	 * Returns null.	 */	public ResultDescription	getResultDescription()	{	    return (ResultDescription)null;	}	/**	 * Returns the row at the absolute position from the query, 	 * and returns NULL when there is no such position.	 * (Negative position means from the end of the result set.)	 * Moving the cursor to an invalid position leaves the cursor	 * positioned either before the first row (negative position)	 * or after the last row (positive position).	 * NOTE: An exception will be thrown on 0.	 *	 * @param row	The position.	 * @return	The row at the absolute position, or NULL if no such position.	 *	 * @exception StandardException		Thrown on failure	 * @see Row	 */	public ExecRow	getAbsoluteRow(int row) throws StandardException	{		/*			The JDBC use of this class will never call here.			Only the DB API used directly can get this exception.		 */		throw StandardException.newException(SQLState.LANG_DOES_NOT_RETURN_ROWS, "absolute");	}	/**	 * Returns the row at the relative position from the current	 * cursor position, and returns NULL when there is no such position.	 * (Negative position means toward the beginning of the result set.)	 * Moving the cursor to an invalid position leaves the cursor	 * positioned either before the first row (negative position)	 * or after the last row (positive position).	 * NOTE: 0 is valid.	 * NOTE: An exception is thrown if the cursor is not currently	 * positioned on a row.	 *	 * @param row	The position.	 * @return	The row at the relative position, or NULL if no such position.	 *	 * @exception StandardException		Thrown on failure	 * @see Row	 */	public ExecRow	getRelativeRow(int row) throws StandardException	{		/*			The JDBC use of this class will never call here.			Only the DB API used directly can get this exception.		 */		throw StandardException.newException(SQLState.LANG_DOES_NOT_RETURN_ROWS, "relative");	}	/**	 * Sets the current position to before the first row and returns NULL	 * because there is no current row.	 *	 * @return	NULL.	 *	 * @exception StandardException		Thrown on failure	 * @see Row	 */	public ExecRow	setBeforeFirstRow() 		throws StandardException	{		/*			The JDBC use of this class will never call here.			Only the DB API used directly can get this exception.		 */		throw StandardException.newException(SQLState.LANG_DOES_NOT_RETURN_ROWS, "beforeFirst");	}	/**	 * Returns the first row from the query, and returns NULL when there	 * are no rows.	 *	 * @return	The first row, or NULL if no rows.	 *	 * @exception StandardException		Thrown on failure	 * @see Row	 */	public ExecRow	getFirstRow() 		throws StandardException	{		/*			The JDBC use of this class will never call here.			Only the DB API used directly can get this exception.		 */		throw StandardException.newException(SQLState.LANG_DOES_NOT_RETURN_ROWS, "first");	}	/**     * No rows to return, so throw an exception.	 *	 * @exception StandardException		Always throws a	 *									StandardException to indicate	 *									that this method is not intended to	 *									be used.	 */	public ExecRow	getNextRow() throws StandardException	{		/*			The JDBC use of this class will never call here.			Only the DB API used directly can get this exception.		 */		throw StandardException.newException(SQLState.LANG_DOES_NOT_RETURN_ROWS, "next");	}	/**	 * Returns the previous row from the query, and returns NULL when there	 * are no more previous rows.	 *	 * @return	The previous row, or NULL if no more previous rows.	 *	 * @exception StandardException		Thrown on failure	 * @see Row	 */	public ExecRow	getPreviousRow() 		throws StandardException	{		/*			The JDBC use of this class will never call here.			Only the DB API used directly can get this exception.		 */		throw StandardException.newException(SQLState.LANG_DOES_NOT_RETURN_ROWS, "previous");	}	/**	 * Returns the last row from the query, and returns NULL when there	 * are no rows.	 *	 * @return	The last row, or NULL if no rows.	 *	 * @exception StandardException		Thrown on failure	 * @see Row	 */	public ExecRow	getLastRow()		throws StandardException	{		/*			The JDBC use of this class will never call here.			Only the DB API used directly can get this exception.		 */		throw StandardException.newException(SQLState.LANG_DOES_NOT_RETURN_ROWS, "last");	}	/**	 * Sets the current position to after the last row and returns NULL	 * because there is no current row.	 *	 * @return	NULL.	 *	 * @exception StandardException		Thrown on failure	 * @see Row	 */	public ExecRow	setAfterLastRow() 		throws StandardException	{		/*			The JDBC use of this class will never call here.			Only the DB API used directly can get this exception.		 */		throw StandardException.newException(SQLState.LANG_DOES_NOT_RETURN_ROWS, "afterLast");	}    /**     * Determine if the cursor is before the first row in the result      * set.        *     * @return true if before the first row, false otherwise. Returns     * false when the result set contains no rows.     */    public boolean checkRowPosition(int isType)	{		return false;	}

⌨️ 快捷键说明

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