Bug 195970 Two issues when evaluate a query inlcuding a subquery[07]
Description: Currently, when evaluating a query which includes a subquery, the query will be evaluated twice. The binding of query will pass to subquery twice. If user write a java script such as new Date() and i++. The result of query will be incorrect. Another issue: when write the report document, the binding of query will be written twice and the performance is not good to evalulate it twice.
data/org.eclipse.birt.data/src/org/eclipse/birt/data/engine/impl/ResultIterator.java
{
			if ( needsSaveToDoc( ) == false )
				return;
			QueryResults results = (QueryResults) resultIt.getQueryResults( );
			
			results.setID( idInfo.buildSubQueryID( parentQueryID ) );
			if ( ( (ISubqueryDefinition) resultIt.resultService.getQueryDefn( ) ).applyOnGroup( ) )
				
				resultIt.rdSaveHelper = new RDSaveHelper( resultIt.context,
						resultIt.resultService.getQueryDefn( ),
						resultIt.odiResult,
						new IDInfo( resultIt.getQueryResults( ).getID( ),
								subQueryName,
								results.getGroupLevel( ),
								odiResult.getCurrentGroupIndex( results.getGroupLevel( ) ),
								odiResult.getGroupStartAndEndIndex( results.getGroupLevel( ) ) ) );
			else
				resultIt.rdSaveHelper = new RDSaveHelper( resultIt.context,
						resultIt.resultService.getQueryDefn( ),
						resultIt.odiResult,
						new IDInfo( resultIt.getQueryResults( ).getID( ),
								subQueryName,
								1,
								odiResult.getCurrentResultIndex( ),
								IDInfo.getSpecialSubQueryInfo( odiResult.getRowCount( ) ) ) );
		}
	}
	
}