Bug 200516 CachedQueryResults should also implement IQueryService.
data/org.eclipse.birt.data/src/org/eclipse/birt/data/engine/impl/QueryExecutor.java
/**
	 * @param context
	 */
	void setAppContext( Map context )
	{
		queryAppContext = context;
	}
	/**
	 * Prepare Executor so that it is ready to execute the query
	 * 
	 * @param outerRts
	 * @param targetScope
	 * @throws DataException
	 */
	void prepareExecution( IQueryResults outerRts, Scriptable targetScope )
			throws DataException
	{
		if ( isPrepared )
			return;
		this.parentScope = targetScope;
		dataSource = findDataSource( );
		if ( outerRts != null )
		{
			outerResults = ( (IQueryService) outerRts );
			if ( outerResults.isClosed( ) )
			{
				
				throw new DataException( ResourceConstants.RESULT_CLOSED );
			}
			this.nestedLevel = outerResults.getNestedLevel( );