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

📄 genericresultsetfactory.java

📁 derby database source code.good for you.
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
/*   Derby - Class org.apache.derby.impl.sql.execute.GenericResultSetFactory   Copyright 1997, 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.reference.SQLState;import org.apache.derby.iapi.error.StandardException;import org.apache.derby.iapi.sql.ResultSet;import org.apache.derby.iapi.sql.ResultDescription;import org.apache.derby.iapi.sql.Activation;import org.apache.derby.iapi.sql.execute.ConstantAction;import org.apache.derby.iapi.sql.execute.ExecutionContext;import org.apache.derby.iapi.sql.execute.NoPutResultSet;import org.apache.derby.iapi.sql.execute.ResultSetFactory;import org.apache.derby.iapi.sql.Activation;import org.apache.derby.iapi.services.sanity.SanityManager;import org.apache.derby.iapi.services.loader.GeneratedMethod;import org.apache.derby.iapi.sql.dictionary.TableDescriptor;import org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptor;import org.apache.derby.iapi.sql.dictionary.SchemaDescriptor;import org.apache.derby.iapi.store.access.Qualifier;import org.apache.derby.iapi.store.access.StaticCompiledOpenConglomInfo;import org.apache.derby.iapi.sql.conn.Authorizer;import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;import java.util.Properties;/** * ResultSetFactory provides a wrapper around all of * the result sets used in this execution implementation. * This removes the need of generated classes to do a new * and of the generator to know about all of the result * sets.  Both simply know about this interface to getting * them. * <p> * In terms of modularizing, we can create just an interface * to this class and invoke the interface.  Different implementations * would get the same information provided but could potentially * massage/ignore it in different ways to satisfy their * implementations.  The practicality of this is to be seen. * <p> * The cost of this type of factory is that once you touch it, * you touch *all* of the possible result sets, not just * the ones you need.  So the first time you touch it could * be painful ... that might be a problem for execution. * * @author ames */public class GenericResultSetFactory implements ResultSetFactory {	//	// ResultSetFactory interface	//	public GenericResultSetFactory()	{	}	/**		@see ResultSetFactory#getInsertResultSet		@exception StandardException thrown on error	 */	public ResultSet getInsertResultSet(NoPutResultSet source, 										GeneratedMethod checkGM,										Activation activation)		throws StandardException	{		getAuthorizer(activation).authorize(Authorizer.SQL_WRITE_OP);		return new InsertResultSet(source, checkGM, activation );	}	/**		@see ResultSetFactory#getInsertVTIResultSet		@exception StandardException thrown on error	 */	public ResultSet getInsertVTIResultSet(NoPutResultSet source, 										NoPutResultSet vtiRS,										Activation activation)		throws StandardException	{		getAuthorizer(activation).authorize(Authorizer.SQL_WRITE_OP);		return new InsertVTIResultSet(source, vtiRS, activation );	}	/**		@see ResultSetFactory#getDeleteVTIResultSet		@exception StandardException thrown on error	 */	public ResultSet getDeleteVTIResultSet(NoPutResultSet source, 										Activation activation)		throws StandardException	{		getAuthorizer(activation).authorize(Authorizer.SQL_WRITE_OP);		return new DeleteVTIResultSet(source, activation);	}	/**		@see ResultSetFactory#getDeleteResultSet		@exception StandardException thrown on error	 */	public ResultSet getDeleteResultSet(NoPutResultSet source,										Activation activation)			throws StandardException	{		getAuthorizer(activation).authorize(Authorizer.SQL_WRITE_OP);		return new DeleteResultSet(source, activation );	}	/**		@see ResultSetFactory#getDeleteCascadeResultSet		@exception StandardException thrown on error	 */	public ResultSet getDeleteCascadeResultSet(NoPutResultSet source, 											   Activation activation,												   int constantActionItem,											   ResultSet[] dependentResultSets,											   String resultSetId)		throws StandardException	{					getAuthorizer(activation).authorize(Authorizer.SQL_WRITE_OP);		return new DeleteCascadeResultSet(source, activation, 										  constantActionItem,										  dependentResultSets, 										  resultSetId);	}	/**		@see ResultSetFactory#getUpdateResultSet		@exception StandardException thrown on error	 */	public ResultSet getUpdateResultSet(NoPutResultSet source,										GeneratedMethod checkGM,										Activation activation)			throws StandardException	{		//The stress test failed with null pointer exception in here once and then		//it didn't happen again. It can be a jit problem because after this null		//pointer exception, the cleanup code in UpdateResultSet got a null		//pointer exception too which can't happen since the cleanup code checks		//for null value before doing anything.		//In any case, if this ever happens again, hopefully the following		//assertion code will catch it.		if (SanityManager.DEBUG)		{			SanityManager.ASSERT(getAuthorizer(activation) != null, "Authorizer is null");		}		getAuthorizer(activation).authorize(Authorizer.SQL_WRITE_OP);		return new UpdateResultSet(source, checkGM, activation);	}	/**		@see ResultSetFactory#getUpdateVTIResultSet		@exception StandardException thrown on error	 */	public ResultSet getUpdateVTIResultSet(NoPutResultSet source,                                           Activation activation)			throws StandardException	{		getAuthorizer(activation).authorize(Authorizer.SQL_WRITE_OP);		return new UpdateVTIResultSet(source, activation);	}	/**		@see ResultSetFactory#getDeleteCascadeUpdateResultSet		@exception StandardException thrown on error	 */	public ResultSet getDeleteCascadeUpdateResultSet(NoPutResultSet source,													 GeneratedMethod checkGM,													 Activation activation,													 int constantActionItem,													 int rsdItem)			throws StandardException	{		if (SanityManager.DEBUG)		{			SanityManager.ASSERT(getAuthorizer(activation) != null, "Authorizer is null");		}		getAuthorizer(activation).authorize(Authorizer.SQL_WRITE_OP);		return new UpdateResultSet(source, checkGM, activation,								   constantActionItem, rsdItem);	}	/**		@see ResultSetFactory#getCallStatementResultSet		@exception StandardException thrown on error	 */	public ResultSet getCallStatementResultSet(GeneratedMethod methodCall,				Activation activation)			throws StandardException	{		getAuthorizer(activation).authorize(Authorizer.SQL_CALL_OP);		return new CallStatementResultSet(methodCall, activation);	}	/**		@see ResultSetFactory#getProjectRestrictResultSet		@exception StandardException thrown on error	 */	public NoPutResultSet getProjectRestrictResultSet(NoPutResultSet source,		Activation activation, GeneratedMethod restriction, 		GeneratedMethod projection, int resultSetNumber,		GeneratedMethod constantRestriction,		int mapRefItem,		boolean reuseResult,		boolean doesProjection,		double optimizerEstimatedRowCount,		double optimizerEstimatedCost,		GeneratedMethod closeCleanup)			throws StandardException	{		return new ProjectRestrictResultSet(source, activation, 			restriction, projection, resultSetNumber, 			constantRestriction, mapRefItem, 			reuseResult,			doesProjection,		    optimizerEstimatedRowCount,			optimizerEstimatedCost,			closeCleanup);	}	/**		@see ResultSetFactory#getHashTableResultSet		@exception StandardException thrown on error	 */	public NoPutResultSet getHashTableResultSet(NoPutResultSet source,		Activation activation, GeneratedMethod singleTableRestriction, 		Qualifier[][] equijoinQualifiers,		GeneratedMethod projection, int resultSetNumber,		int mapRefItem,		boolean reuseResult,		int keyColItem,		boolean removeDuplicates,		long maxInMemoryRowCount,		int	initialCapacity,		float loadFactor,		double optimizerEstimatedRowCount,		double optimizerEstimatedCost,		GeneratedMethod closeCleanup)			throws StandardException	{		return new HashTableResultSet(source, activation, 			singleTableRestriction,             equijoinQualifiers,			projection, resultSetNumber, 			mapRefItem, 			reuseResult,			keyColItem, removeDuplicates,			maxInMemoryRowCount,			initialCapacity,			loadFactor,			true,		// Skip rows with 1 or more null key columns		    optimizerEstimatedRowCount,			optimizerEstimatedCost,			closeCleanup);	}	/**		@see ResultSetFactory#getSortResultSet		@exception StandardException thrown on error	 */	public NoPutResultSet getSortResultSet(NoPutResultSet source,		boolean distinct, 		boolean isInSortedOrder,		int orderItem,		Activation activation, 		GeneratedMethod rowAllocator, 		int maxRowSize,		int resultSetNumber, 		double optimizerEstimatedRowCount,		double optimizerEstimatedCost,		GeneratedMethod closeCleanup)			throws StandardException	{		return new SortResultSet(source, 			distinct, 			isInSortedOrder,			orderItem,			activation, 			rowAllocator, 			maxRowSize,			resultSetNumber, 		    optimizerEstimatedRowCount,			optimizerEstimatedCost,			closeCleanup);	}	/**		@see ResultSetFactory#getScalarAggregateResultSet		@exception StandardException thrown on error	 */	public NoPutResultSet getScalarAggregateResultSet(NoPutResultSet source,		boolean isInSortedOrder,		int aggregateItem,		int orderItem,		Activation activation, 		GeneratedMethod rowAllocator, 		int maxRowSize,		int resultSetNumber, 		boolean singleInputRow,		double optimizerEstimatedRowCount,		double optimizerEstimatedCost,		GeneratedMethod closeCleanup) 			throws StandardException	{		return new ScalarAggregateResultSet(						source, isInSortedOrder, aggregateItem, activation,						rowAllocator, resultSetNumber, singleInputRow,						optimizerEstimatedRowCount,						optimizerEstimatedCost, closeCleanup);	}	/**		@see ResultSetFactory#getDistinctScalarAggregateResultSet		@exception StandardException thrown on error	 */	public NoPutResultSet getDistinctScalarAggregateResultSet(NoPutResultSet source,		boolean isInSortedOrder,		int aggregateItem,		int orderItem,		Activation activation, 		GeneratedMethod rowAllocator, 		int maxRowSize,		int resultSetNumber, 		boolean singleInputRow,		double optimizerEstimatedRowCount,		double optimizerEstimatedCost,		GeneratedMethod closeCleanup) 			throws StandardException	{		return new DistinctScalarAggregateResultSet(						source, isInSortedOrder, aggregateItem, orderItem, activation,						rowAllocator, maxRowSize, resultSetNumber, singleInputRow,						optimizerEstimatedRowCount,						optimizerEstimatedCost, closeCleanup);	}	/**		@see ResultSetFactory#getGroupedAggregateResultSet		@exception StandardException thrown on error	 */	public NoPutResultSet getGroupedAggregateResultSet(NoPutResultSet source,		boolean isInSortedOrder,		int aggregateItem,		int orderItem,		Activation activation, 		GeneratedMethod rowAllocator, 		int maxRowSize,		int resultSetNumber, 		double optimizerEstimatedRowCount,		double optimizerEstimatedCost,		GeneratedMethod closeCleanup) 			throws StandardException	{		return new GroupedAggregateResultSet(						source, isInSortedOrder, aggregateItem, orderItem, activation,						rowAllocator, maxRowSize, resultSetNumber, optimizerEstimatedRowCount,						optimizerEstimatedCost, closeCleanup);	}	/**		@see ResultSetFactory#getDistinctGroupedAggregateResultSet		@exception StandardException thrown on error	 */	public NoPutResultSet getDistinctGroupedAggregateResultSet(NoPutResultSet source,		boolean isInSortedOrder,		int aggregateItem,		int orderItem,		Activation activation, 		GeneratedMethod rowAllocator, 		int maxRowSize,		int resultSetNumber, 		double optimizerEstimatedRowCount,		double optimizerEstimatedCost,		GeneratedMethod closeCleanup) 			throws StandardException	{		return new DistinctGroupedAggregateResultSet(						source, isInSortedOrder, aggregateItem, orderItem, activation,

⌨️ 快捷键说明

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