Пример #1
0
  public override G.IEnumerable<bool> GetAll( Value[] final, int [] cols, EvalEnv e )
  {
    Value[] tr = new Value[ TE.CI.Count ];
    EvalEnv ee = new EvalEnv( e.Locals, tr, e.ResultSet );

    StoredResultSet srs = Order == null ? null : new Sorter( null, SortSpec );
    srs = GroupSpec == null ? srs : new Grouper( srs, GroupSpec, AggSpec );

    Value [] outrow = srs != null ? new Value[ Exps.Count ] : null;

    if ( srs == null )
    {
      if ( Ids != null ) 
      {
        foreach ( long id in Ids.All( ee ) ) if ( TE.Get( id, tr, Used ) )
        {
          if ( WhereD == null || WhereD( ee ) )
          {
            for ( int i = 0; i < final.Length; i += 1 ) final[ i ] = Dvs[ i ]( ee ); 
            yield return true;
          }
        }
      }
      else 
      {
        foreach ( bool ok in TE.GetAll( tr, Used, ee ) )
        if ( WhereD == null || WhereD( ee ) )
        {
          for ( int i = 0; i < final.Length; i += 1 ) final[ i ] = Dvs[ i ]( ee ); 
          yield return true;
        }
      }
    }
    else
    {
      if ( Ids != null ) 
      {
        foreach ( long id in Ids.All( ee ) ) if ( TE.Get( id, tr, Used ) )
        {
          if ( WhereD == null || WhereD( ee ) )
          {
            for ( int i = 0; i < Exps.Count; i += 1 ) outrow[ i ] = Dvs[ i ]( ee ); 
            srs.NewRow( outrow ); 
          }
        }
      }
      else 
      {
        foreach ( bool ok in TE.GetAll( tr, Used, ee ) )
        if ( WhereD == null || WhereD( ee ) )
        {
          for ( int i = 0; i < Exps.Count; i += 1 ) outrow[ i ] = Dvs[ i ]( ee );  
          srs.NewRow( outrow ); 
        }
      }

      foreach( bool b in srs.GetStoredRows( final ) ) yield return true;
    }
  }
Пример #2
0
  public override G.IEnumerable<bool> GetAll( Value[] final, bool [] used, EvalEnv e )
  {
    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.

    StoredResultSet srs = Order == null ? null : new Sorter( null, SortSpec );
    srs = GroupSpec == null ? srs : new Grouper( srs, GroupSpec, AggSpec );

    Value [] outrow = srs != null ? new Value[ Exps.Count ] : null;

    if ( srs == null )
    {
      if ( idSet != null ) 
      {
        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 < final.Length; i += 1 ) final[ i ] = Exps[ i ].Eval( ee );  
            yield return true;
          }
        }
      }
      else 
      {
        foreach ( bool ok in TE.GetAll( tr, Used, ee ) )
        if ( Where == null || ( Where.Eval( ee ).B ) )
        {
          for ( int i = 0; i < final.Length; i += 1 ) final[ i ] = Exps[ i ].Eval( ee );  
          yield return true;
        }
      }
    }
    else
    {
      if ( idSet != null ) 
      {
        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 );  
            srs.NewRow( outrow ); 
          }
        }
      }
      else 
      {
        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 );  
          srs.NewRow( outrow ); 
        }
      }
      foreach( bool b in srs.GetAll( final ) ) yield return true;
    }
  }