public override void EndTable() { // Output the summed rows. foreach ( Value[] r in Rows ) if ( !Output.NewRow( r ) ) break; Output.EndTable(); }
public override void EndTable() { // Output the sorted rows. foreach (Value[] r in Rows) { if (!Output.NewRow(r)) { break; } } Output.EndTable(); }
public override void FetchTo( ResultSet rs, EvalEnv e ) { ResultSet srs = Order == null ? rs : new Sorter( rs, SortSpec ); srs = GroupSpec == null ? srs : new Grouper( srs, GroupSpec, AggSpec ); Value[] tr = new Value[ TE.Cols.Count ]; EvalEnv ee = new EvalEnv( e.Locals, tr, e.ResultSet ); IdSet idSet = Where == null ? null : Where.GetIdSet( TE, ee ); if ( idSet != null ) idSet = new IdCopy( idSet, ee ); // Need to take a copy of the id values if an index is used. rs.NewTable( Cols ); Value [] outrow = new Value[ Exps.Count ]; if ( idSet != null ) // Fetch subset of source table using id values, send to ResultSet (if it satisfies any WHERE clause ) { foreach ( long id in idSet.All( ee ) ) if ( TE.Get( id, tr, Used ) ) { if ( Where == null || Where.Eval( ee ).B ) { for ( int i = 0; i < Exps.Count; i += 1 ) outrow[ i ] = Exps[ i ].Eval( ee ); if ( !srs.NewRow( outrow ) ) break; } } } else // Fetch every record in source table, send it to output ( if it satisfies any WHERE clause ) { foreach ( bool ok in TE.GetAll( tr, Used, ee ) ) if ( Where == null || Where.Eval( ee ).B ) { for ( int i = 0; i < Exps.Count; i += 1 ) outrow[ i ] = Exps[ i ].Eval( ee ); if ( !srs.NewRow( outrow ) ) break; } } srs.EndTable(); }
public override void FetchTo( ResultSet rs, EvalEnv e ) { ResultSet srs = Order == null ? rs : new Sorter( rs, SortSpec ); srs = GroupSpec == null ? srs : new Grouper( srs, GroupSpec, AggSpec ); Value[] tr = new Value[ TE.CI.Count ]; EvalEnv ee = new EvalEnv( e.Locals, tr, e.ResultSet ); rs.NewTable( CI ); Value [] outrow = new Value[ Exps.Count ]; if ( Ids != null ) // Fetch subset of source table using id values, send to ResultSet (if it satisfies any WHERE clause ) { foreach ( long id in Ids.All( ee ) ) if ( TE.Get( id, tr, Used ) ) { if ( Where == null || WhereD( ee ) ) { for ( int i = 0; i < Exps.Count; i += 1 ) outrow[ i ] = Dvs[ i ]( ee ); if ( !srs.NewRow( outrow ) ) break; } } } else // Fetch every record in source table, send it to output ( if it satisfies any WHERE clause ) { foreach ( bool ok in TE.GetAll( tr, Used, ee ) ) if ( Where == null || WhereD( ee ) ) { for ( int i = 0; i < Exps.Count; i += 1 ) outrow[ i ] = Dvs[ i ]( ee ); if ( !srs.NewRow( outrow ) ) break; } } srs.EndTable(); }